Oll
Oll

Reputation: 312

Transfer a Conda environment between Ubuntu and Windows

I want to take my Conda environment from my Ubuntu PC to my Windows 11 PC.

I export my environment from the Ubuntu PC like this.

conda env export --file my_env.yml

The file looks something like:

name: testing
channels:
  - rigge
  - anaconda
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=4.5=1_gnu
  - blas=1.0=mkl
  - blosc=1.21.0=h8c45485_0
  - brotli=1.0.9=he6710b0_2
  - brunsli=0.1=h2531618_0
  - bzip2=1.0.8=h7b6447c_0
  - ca-certificates=2020.10.14=0
...etc
 - python=3.10.0=h12debd9_5
- pip:
    - certifi==2021.5.30
    - cytoolz==0.11.0
    - imagecodecs==2021.8.26
prefix: /home/me/anaconda3/envs/my_env

When importing into Windows 11:

conda env create --file my_env.yml

Solving environment: failed

ResolvePackageNotFound:
  - libffi==3.3=he6710b0_2
  - expat==2.4.4=h295c915_0
etc..

I am aware that I can just remove most of the dependencies and it will work, I was just wondering if there was a better way to do this?

Upvotes: 2

Views: 1605

Answers (1)

FlyingTeller
FlyingTeller

Reputation: 20526

Note the section in the conda docs that deals specifically with this question. When exporting the env, use the from-history flag:

conda env export --from-history

this will make sure that the yml file only contains the packages that you installed explicitly

Upvotes: 2

Related Questions