UpperEastSide
UpperEastSide

Reputation: 137

Can you export a created python conda environment for others to activate on their machines?

I do the following:

conda create -n myenv -c conda-forge jupyter xarray cmocean numpy matplotlib netCDF4 cartopy pandas

conda activate myenv

jupyter notebook

Is there a way that I can export this environment to another computer to be activated by another user?

I want other users to run my jupyter notebook script without having to install python packages.

Upvotes: 5

Views: 10311

Answers (3)

Prayson W. Daniel
Prayson W. Daniel

Reputation: 15578

Yes you can:

conda activate ENV
conda env export | grep -v "^prefix: " > environment.yml

The grep command removes your prefix. That yml file can be used by others as

 conda env create -f environment.yml
 conda activate ENV

Upvotes: 5

Jainil Patel
Jainil Patel

Reputation: 1324

You can copy the complete folder of the environment. It can be found easily, where your python is installed.

Upvotes: 1

pmarcol
pmarcol

Reputation: 463

See https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#sharing-an-environment.

  1. Activate the environment to export: conda activate myenv
  2. Export your active environment to a new file: conda env export > environment.yml
  3. Email or copy the exported environment.yml file to the other person.

To create environment from .yml file: conda env create -f environment.yml
The first line of the yml file sets the new environment's name.

Upvotes: 8

Related Questions