Do you like this page?

Views of this page

Views of the site

Please help share my site. Thank you!

Install Python and Packages with Anaconda - Easy Microbial Genomics

Install Python and Packages with Anaconda

Last updated: April 18, 2022

Some Linux distribution may have Python installed in the system directory. However, I recommend installing Anaconda to update Python regularly. More importantly, Anaconda is a versatile package installer. You can install many Python packages by simply typing 'conda install xxx' and it will install all the dependencies automatically before installing your packages.

Install wget

Before installing Anaconda, you need to install ‘wget’. ‘wget’ is a downloader to download stuff from websites with URLs. Check if you have ‘wget’ installed by typing ‘wget’. If you see the usage information, you already have it. If you see something like ‘command not found’, then you don’t have it.

Test it by typing ‘wget’ after you install it.

Install Anaconda

Go to and find the URL of downloading your Anaconda install file. Usually it is in ‘Products > Anaconda Distribution’. Then find the link from the MacOS or Linux section. At last, use wget to download the install file. For example:


After you finish the downloading, you will see a file (e.g. You can run it to install Anaconda. For example:


You will be prompt to agree the terms and set a path to install. Follow the guide to finish the installation. Test the installation by running ‘conda -h'.

Install packages

Anaconda will install your packages with dependencies automatically installed. Run ‘conda install -h' for the help information. Generally, to install a package, you just need to run ‘conda install [package_name]’. For example:

conda install pandas

To upgrade a package, run ‘conda update [package_name]’. For example:

conda update pandas

To specify a version, run ‘conda install [package_name]==[version number]’. For example:

conda update pandas==0.14.0

Many packages are only available in some specific channels that are not in your channel list, then you should add an option ‘-c’ to specify the channel. In any case, you can check the command by Googling it.

Create a virtual environment

If you want to make an isolated place to host some special packages, you can generate a virtual environment and install packages there. By doing this, you can avoid some issues like version conflict. For example, a pandas package of version 0.14 has been install in the system, and you want to use an older version 0.13. You don’t want to downgrade pandas for the whole system, so you need to install it only in a virtual environment. Packages in the environment have higher priority than the same ones outside. You can still use packages installed outside it in the system (but not from other virtual environments).

To check what environments have you created, run ‘conda env list’. Run ‘conda create -n [env_name]’ to create a virtual environment. For example:

conda create -n emg

To activate it, run:

conda activate emg

Now you can install packages here by ‘conda install’.

To exit it, run:

conda deactivate

To remove it, simple run ‘conda env remove -n emg’.