How to clone conda environment, which have pip packages besides of conda packages?
Asked Answered
K

2

6

Context

I am trying to clone my dev conda environment to a test server. In this environment besides of many conda packages I had to install some packages via pip. I am using miniconda.

What I've tried:

conda list --explicit > spec-file.txt

then

conda create --name myclonedenv --file spec-file.txt

however this is not installing the few packages what were installed via pip in the original conda environment.

Question

How can I export a current conda environment, and clone it on an other machine, if the current conda environment contains some packages installed via pip

Kiker answered 14/5, 2022 at 5:24 Comment(0)
A
5

The conda env export command will capture both Conda- and Pip-installed packages. The YAML can then be used with conda env create to recreate the environment.

Arise answered 15/5, 2022 at 1:3 Comment(0)
K
12

This is a much faster way to clone a conda environment containing pip installations:

conda create --name cloned --clone original

Kizzie answered 26/3, 2023 at 16:24 Comment(1)
Are you sure this includes pip environments? I saw: PackagesNotFoundError: The following packages are missing from the target environment: for my pip environmentsIsadora
A
5

The conda env export command will capture both Conda- and Pip-installed packages. The YAML can then be used with conda env create to recreate the environment.

Arise answered 15/5, 2022 at 1:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.