Conda notes

From raju

replicate environment

Method 1:

Activate the environment to export:

For example, on Windows, in Anaconda prompt, run

    activate myenv

Export the active environment to a new file

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

By default, the output of "conda env export" contains a line

    prefix: /path/to/the/environment

This line is not necessary in order to recreate the environment. Grepping it out so that the replicating user will not know what the original environment's path is.

To recreate it

    conda env create -f environment.yml
    activate myenv


Method 2: Get the list of packages

    $ conda list -e > req.txt

Create a new environment using

    $ conda create -n new_environment --file req.txt

Create an environment for python 3.6

    conda create -n py36 python=3.6 anaconda

Switch to the new environment

    activate py36

Remove an environment

    conda env remove --name foo

install a specific version of a package in an environment

    conda install -n <env> <package>=<version>

For example

    conda install -n py27 pandas=0.19.2

find the package version

To find the version of the package installed

    conda list pandas

Other related commands

  • conda list - list all packages in the current environment


useful links

file locations

  • pep8 - /c/ProgramData/Anaconda3/Scripts/pep8.exe
  • python interpreter - /c/ProgramData/Anaconda3/python