Anaconda: Difference between revisions

From NU HPC Wiki
Jump to navigation Jump to search
(Created page with "Anaconda Description: Anaconda, also known as "conda," is a tool for managing Python packages. It helps you create virtual environments for different Python and package versions. You can use Anaconda to install, remove, and update packages within your project environments. For instance you can create virtual environment for game development which requires Pygame with version of Python and you can create environment for machine learning which requires Pytorch with new ver...")
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Anaconda
Description: Anaconda, also known as "conda," is a tool for managing Python packages. It helps you create virtual environments for different Python and package versions. You can use Anaconda to install, remove, and update packages within your project environments. For instance you can create virtual environment for game development which requires Pygame with version of Python and you can create environment for machine learning which requires Pytorch with new version of Python.


Usage: module load Anaconda3/2022.05
Anaconda, also known as "conda," is a tool for managing Python packages. It helps you create virtual environments for different Python and package versions. You can use Anaconda to install, remove, and update packages within your project environments. For instance you can create virtual environment for game development which requires Pygame with version of Python and you can create environment for machine learning which requires Pytorch with new version of Python. 


Working with Anaconda environments
'''Usage:''' module load Anaconda3/2022.05 
 
'''Working with Anaconda environments'''


Below is a list of main commands you should use in order to start working with Anaconda.
Below is a list of main commands you should use in order to start working with Anaconda.
# To Check available environments, please type: <code>conda env list</code>
# View a list of packages in an environment
#* If the environment is not activated, please type: <code>conda list -n virtualenv</code>
#* If the environment is activated, then type: <code>conda list</code>
# Create Conda environment
#* Create an environment: <code>conda create -n virtualenv</code>
#* Create an environment with a specific Python version: <code>conda create -n virtualenv python=3.12</code>
#* Create an environment to target directory: <code>conda create -p /shared/home/{username}/.conda/envs/virtualenv</code>
# Activate an environment: <code>source activate virtualenv</code>
# Deactivate an environment:  <code>conda deactivate</code>
# Remove an environment
<code>conda remove -n virtualenv --all</code> or <code>conda env remove -n virtualenv</code>


To Check available environments, please type: conda env list
'''Working with packages'''
View a list of packages in an environment
If the environment is not activated, please type: conda list -n virtualenv
If the environment is activated, then type: conda list
Create Conda environment
Create an environment: conda create -n virtualenv
Create an environment with a specific Python version: conda create -n virtualenv python=3.12
Create an environment to target directory: conda create -p /shared/home/{username}/.conda/envs/virtualenv
Activate an environment: source activate virtualenv
Deactivate an environment: conda deactivate
Remove an environment
conda remove -n virtualenv --all or conda env remove -n virtualenv


Working with packages
Install packages into ''virtualenv'' environment


Install packages into virtualenv environment
* If the environment is not activated, please type: <code>conda --name virtualenv install PACKAGENAME</code>
* If the environment is activated, please type: <code>conda install PACKAGENAME</code>
* If you want to install multiple packages at once: <code>conda install pkg1 pkg2 pkg3</code>
* If you need to install package with specific version: <code>conda install numpy=1.15.2</code>


If the environment is not activated, please type: conda --name virtualenv install PACKAGENAME
'''External links''' 
If the environment is activated, please type: conda install PACKAGENAME
If you want to install multiple packages at once: conda install pkg1 pkg2 pkg3
If you need to install package with specific version: conda install numpy=1.15.2
External links


Documentation
[https://docs.conda.io/projects/conda/en/latest/ Documentation]


User Guide
[https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html User Guide]


Video
[https://www.youtube.com/watch?v=23aQdrS58e0 Video]


Conda Cheat Sheet
[https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf Conda Cheat Sheet]

Latest revision as of 04:07, 3 July 2024

Anaconda, also known as "conda," is a tool for managing Python packages. It helps you create virtual environments for different Python and package versions. You can use Anaconda to install, remove, and update packages within your project environments. For instance you can create virtual environment for game development which requires Pygame with version of Python and you can create environment for machine learning which requires Pytorch with new version of Python.

Usage: module load Anaconda3/2022.05

Working with Anaconda environments

Below is a list of main commands you should use in order to start working with Anaconda.

  1. To Check available environments, please type: conda env list
  2. View a list of packages in an environment
    • If the environment is not activated, please type: conda list -n virtualenv
    • If the environment is activated, then type: conda list
  3. Create Conda environment
    • Create an environment: conda create -n virtualenv
    • Create an environment with a specific Python version: conda create -n virtualenv python=3.12
    • Create an environment to target directory: conda create -p /shared/home/{username}/.conda/envs/virtualenv
  4. Activate an environment: source activate virtualenv
  5. Deactivate an environment: conda deactivate
  6. Remove an environment

conda remove -n virtualenv --all or conda env remove -n virtualenv

Working with packages

Install packages into virtualenv environment

  • If the environment is not activated, please type: conda --name virtualenv install PACKAGENAME
  • If the environment is activated, please type: conda install PACKAGENAME
  • If you want to install multiple packages at once: conda install pkg1 pkg2 pkg3
  • If you need to install package with specific version: conda install numpy=1.15.2

External links

Documentation

User Guide

Video

Conda Cheat Sheet