Skip to content

Instantly share code, notes, and snippets.

@niittymaa
Forked from supriya-premkumar/conda-commands.md
Created March 15, 2023 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niittymaa/76abf04f92b78acdb52d6a0d93245eaa to your computer and use it in GitHub Desktop.
Save niittymaa/76abf04f92b78acdb52d6a0d93245eaa to your computer and use it in GitHub Desktop.
Conda Commands

Conda Commands

Install Anaconda Link: https://www.continuum.io/downloads

  1. Check/List installed packages:
    Conda list

  2. Upgrade Conda packages:
    conda upgrade conda conda upgrade --all

  3. Install conda package:
    conda install package_name

  4. Installing multiple packages:
    conda install numpy scipy pandas

  5. To specify which version of a package you want by adding the version number:
    conda install numpy=1.10

  6. To uninstall package:
    conda remove package_name

  7. To update a package:
    conda update package_name

  8. To update all packages:
    conda update --all

  9. If you are not familiar with the exact name you are searching for, try searching with:
    conda search search_term

  10. Create an environment:
    conda create -n env_name list of packages

    -n env_name --> sets name of your environment
    list of packages --> list of packages you want installed in the environment.
    `example: conda create -n my_env numpy

    conda create -n py3 python=3

    conda create -n py python=3.3 `

  11. Entering an environment:
    source activate my_env

  12. Leaving an environment:
    source deactivate my_env

  13. Save packages of the environment to YAML file:
    conda env export > environment.yaml
    conda env export --> writes out all the packages in the environment including python version.

  14. To check all the versions of the packages:
    conda env export

  15. To create an environment from an environment file:
    conda env create -f environment.yaml

  16. To list all the environments:
    conda env list

  17. Removing environments:
    conda env remove -n env_name

  18. Sharing Environments: When sharing your code on GitHub, it's good practice to make an environment file and include it in the repository. This will make it easier for people to install all the dependencies for your code. Include a pip requirements.txt file using pip freeze (learn more here) for people not using conda.

    pip freeze > requirements.txt

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