Anaconda is an excellent python data science environment

Anaconda

Open Data Science Core: Anaconda is a package manager, an environment manager, a Python distribution, and a collection of over 1,000+ open source packages. It is free and easy to install, and it offers free community support. https://anaconda.org/

Context

Anaconda is well documented and has excellent support. All I include here are a few tasks that I have had to repeat.

Jupyter

Activate and deactivate the environment

  • Windows: activate env_name

    • deactivate env_name

  • Linux: source activate env_name

    • source deactivate env_name

Run a notebook

jupyter notebook

Save the files of a notebook tree into an archive (assumes system with tar)

  • When in a notebook, go to a new cell

  • !tar chzf notebook.tgz --exclude notebook.tgz * (change notebook to your choice)

Download that archive

  • From the Jupyter File menu, select Open

  • Click the archive you created, i.e. notebook.tgz

  • It will download to your location

  • Unarchive to use it

Run a command in a notebook

Prepend the command with !

Build identical environment

The operating systems of the host computers must be similar. This cannot be done to copy a Linux environment to Windows.

First a listing of the environment is needed.

  • Try conda list --explicit

    • If you get an error similar to Error: environment does not exist: ../anaconda/envs/name/envs/name

  • Then try conda list -n root --explicit

  • To save the output to a file use a pipe appended to the end of the command, similar to > spec-file.txt

  • Next, on your anaconda installation: conda create --name myenv --file spec-file.txt

References