Skip to content

Instantly share code, notes, and snippets.

Created October 13, 2020 11:17
Show Gist options
  • Save andrewyates/970c570411c4a36785f6c0e9362eb1eb to your computer and use it in GitHub Desktop.
Save andrewyates/970c570411c4a36785f6c0e9362eb1eb to your computer and use it in GitHub Desktop.
Guide to installing Python with Conda

Installing Python 3 via Conda

This tutorial describes how to install Python 3 into your home directory using the Conda package manager. We'll use the Miniconda variant, which is just Anaconda with fewer packages installed by default.

  1. Download: wget
  2. Make executable: chmod +x
  3. Run installer: ./ When prompted, say yes when asked if you want to initialize Miniconda.
  4. Close and re-open your shell in order for the installation to take effect. (e.g., close your terminal or SSH connection and then re-open)
  5. Update your conda environment to the latest: conda update -n base -c defaults conda


You should now have a functioning base Conda environment. It's best to leave this default Conda environment untouched and to create new Conda environments for each project you use.

  • Create a new environment: conda create --name MyNewEnv python=3.7
  • Activate an existing environment: conda activate MyNewEnv
  • Deactivate the current enrivonment: conda deactivate

The standard workflow is to create a separate environment for each project. When switching projects, you then run conda activate <name> to activate the appropriate environment. This replaces the common practice of using a separate Python virtual environment for each project.

Packages can be installed into the Conda environment using both pip and conda. The latter can install non-Python programs in addition to Python packages. The standard practice is to install any needed conda packages first, followed by any pip packages. For example, you can install PyTorch and Java 11:

  • conda install -c conda-forge 'openjdk>=11,<12'
  • conda install -c pytorch pytorch torchvision cudatoolkit=10.1

Followed by Capreolus via pip:

  • pip install capreolus

Additional resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment