Conda package and environment manager and collection of 1,000+ open source packages with free community support. It’s Anaconda Distribution without the collection of 1,000+ open source packages. With Miniconda you install only the packages you want with the conda command, conda install PACKAGENAME Example: conda install anaconda-navigator. To restore environment to a previous revision: conda install-revision=REVNUM or conda install-rev REVNUM. PDF CONDA CHEAT SHEET, Delete an environment and everything in it. Deactivate the current environment. Create environment from a text file. Stack commands: create a new environment, First you have to deactivate your environment before. Conda cheat sheet Setup a conda environment conda create -name cr python=3.8 numpy pandas scikit-learn matplotlib seaborn jupyter plotly. Activate the environment. 1 file 0 forks 0 comments 0 stars ryanbehdad / bash.md. Last active Jul 10, 2020. Get a list of all my environments. Active environment shown with. Conda create -name snowflakes biopython. Conda create -n snowflakes biopython. Create an environment and install program (s) conda activate snowflakes. Activate the new environment to use it. Conda deactivate. CONDA CHEAT SHEET Command line package and environment manager Learn to use conda in 30 minutes at bit.ly/tryconda TIP: Anaconda Navigator is a graphical interface to use conda.
// |
# Deactivating the activation of the base environment in Python: |
conda config --set auto_activate_base false |
// |
**Listing all installed packages |
conda list |
// |
#To install a package |
conda install packagename |
#To install a package from a certain channel |
conda install -c bioconda pybedtools |
#To uninstall (deinstall) a certain package |
conda uninstall packagename |
#We can upgrage packages: |
conda update numpy |
#Verify environment we are right now: |
conda info --envs |
#create a new environment with some packages installed |
conda create --name bamqc numpy pandas |
#activate the created environment |
source activate bamqc |
#deactivate the environment |
source deactivate |
#installing a new environment with a new python version: |
conda create --name blahblah python=2.7 |
#installing a new version with all python packages included in anaconda |
conda create -n python2.7_env python=2.7 anaconda |
#list all envs |
conda env list |
#remove a given env |
conda env remove --name bamqc |
#setting the environment variables for a specific environment: |
#Read useful post: |
http://www.benjaminmgross.com/conda-env-vars/ |
1) |
$ echo $PATH |
/home/benjaminmgross/anaconda/envs/my_env/ |
2) |
$ cd PATH |
$ mkdir -p ./etc/conda/activate.d |
$ mkdir -p ./etc/conda/deactivate.d |
3) |
$ touch ./etc/conda/activate.d/env_vars.sh |
$ touch ./etc/conda/deactivate.d/env_vars.sh |
4) |
./etc/conda/activate.d/env_vars.sh <File> |
#!/bin/sh |
export MY_KEY='secret-key-value' |
export MY_FILE=/path/to/my/file/ |
5) |
./etc/conda/deactivate.d/env_vars.sh <File> |
#!/bin/sh |
unset MY_KEY |
unset MY_FILE |
#activating table of contents in jupyter: |
Install extensions from: |
https://github.com/ipython-contrib/jupyter_contrib_nbextensions |
#opening jupyter notebook on a particular working dir: |
jupyter notebook --notebook-dir=/Users/yourname/folder1/folder2/ |
#Enter in the command mode (gray box with blue edges) and enter with ESC |
# Select cells downwards: |
shift+down_arrow |
# Python markdown |
This nbextension allows to display output generated by the kernel in Markdown cells |
For example: If you set variable a in Python |
a = 1.23 |
and write the following line in a markdown cell: |
a is {{a}} |
It will be displayed as: |
a is 1.23 |
// |
#save to a file all packages in an environment: |
conda list --export > packages.env |
#Then we can use this file to create a new environment: |
$ conda create -n ch1env --file packages.env |
// |
*Saving an entire environment to a file: |
conda env export --file env.yml |
/ |
*Now, we can create the environment from the env.yml file: |
conda env create -f environment.yml |
// |
#having info on the conda we have: |
conda info |
# especially important are the channels, because it conditions what programs are available |
// |
#adding bioconda channels |
#The first one is optional and the order is important |
(conda config --add channels r) |
conda config --add channels defaults |
conda config --add channels conda-forge |
conda config --add channels bioconda |
#Now we can install one the bioconda programs, like for example bwa: |
conda install bwa |
// |
* Creating an environment from a yaml file: |
conda env create -f environment.yml |
And the contents of environment.yml is: |
name: stats |
dependencies: |
- python=3.4 |
- numpy |
- pandas |
# create env with R and some certain basic packages |
$ conda create -n r_env r-essentials r-base |
# How do I prevent Conda from activating the base environment by default? |
conda config --set auto_activate_base false |
The first time you run it, it'll create a ./condarc in your home directory with that setting to override the default. |
Here we will explain how to install pytorch with conda.
Downloading
You can choose right version for your system fromhttps://docs.conda.io/en/latest/miniconda.html.
Windows users should follow the tutorial fromhttps://docs.conda.io/projects/conda/en/latest/user-guide/install/windows.html.
Linux users can run the following script:
In terminal execute the following line:
Mac users can also run the same script changingMiniconda3-latest-Linux-x86_64.sh
intoMiniconda3-latest-MacOSX-x86_64.sh
.
Adding conda to PATH (Mac and Linux)
Conda Create Environment Cheat Sheet
Then add conda
to $PATH
by running
If you do not want to run it each time you start the system you can add this line to ~/.bashrc
(or .zshrc
). For example by calling
(Mac.zshrc
) and adding these lines at the end of the file. Then run
Conda Environment Cheat Sheet
Update conda (all platforms)
Creating and activating environment
You can deactivate it with source deactive
. More info on https://conda.io/docs/user-guide/tasks/manage-environments.html
Installing pytorch (with numpy, jupyter and matplotlib)
Conda Environment Cheat Sheet Printable
Install other useful packages
Run jupyter and test it
After activating environment run
When the web page opens, click on button “New”, choose “Python 3”.
Then copy the following into the cell and press Control+Enter. Change imgs/shelf.JPG
to any image of your coice.
Conda Environment Cheat Sheet Pdf
Updated: 2020-02-02