Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
To package a conda environment (Requirement.txt and virtual environment)
# For Windows users# Note: <> denotes changes to be made
#Create a conda environment
conda create --name <environment-name> python=<version:2.7/3.5>
#To create a requirements.txt file:
conda list #Gives you list of packages used for the environment
conda list -e > requirements.txt #Save all the info about packages to your folder
#To export environment file
activate <environment-name>
conda env export > <environment-name>.yml
#For other person to use the environment
conda env create -f <environment-name>.yml
# For Windows users
@hanifa2102

This comment has been minimized.

Copy link

hanifa2102 commented Feb 14, 2019

#Remove conda environments
conda env remove -n <env_name>

Duplicate conda environments
conda create --name <clone_name> --clone <env_name>

#List Conda environments
conda env list

@marinagolden

This comment has been minimized.

Copy link

marinagolden commented Mar 4, 2019

where does the .yml and .txt file go so i can share with the team and where does the team paste it in?

@codewerkebeckum

This comment has been minimized.

Copy link

codewerkebeckum commented Mar 6, 2019

The file is written to the directory where you execute the command. I would recommend to put it in the corresponding project root and add it to git or any other SCM in use.

@neerajvashistha

This comment has been minimized.

Copy link

neerajvashistha commented Apr 9, 2019

#Install from .txt file
conda create --name <env_name> --file <.txt file>

@SundeepPidugu

This comment has been minimized.

Copy link

SundeepPidugu commented Jun 13, 2019

How to get the list for a specific conda environment ?

@spookyQubit

This comment has been minimized.

Copy link

spookyQubit commented Jun 18, 2019

@SundeepPidugu

One way to know the list of packages for a specific conda environment is to follow a two-step process:
conda activate <env_you_are_interested_in> # First activate the environment
conda list # List linked packages in a conda environment. See conda --help | grep list

PS: Will be happy to know if there is an alternate way which does not require to activate the env.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.