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
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[edit | edit source] ==
'''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.


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


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
Documentation

Revision as of 04:06, 3 July 2024

Anaconda[edit | edit source]

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

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