Conda environment system &
how to use it on CSUC machines
Víctor Pérez
19/ 02 / 2020
Index
1. What is conda?
2. Scope of the project
3. How to use conda
4. Conda environments
5. Package management
6. Python through conda
7. R through conda
What is conda?
• Originally: Anaconda, a distribution of Python
including common scientific packages
https://www.anaconda.com/
• Extended to include R and R packages, scientific
libraries, other software, etc.
• conda: core package manager for the Anaconda
project
What is conda?
• conda installs and updates binary versions of
Python and R packages from its own (or third
party) repositories
• It is an alternative to other repository systems,
like pip for Python or CRAN for R
• It is also a way to manage dependencies for
Python and R packages
But conda isn't...
• A repository of system software packages
(such as apt or yum)
• A repository of source code
• A replacement for environment modules
• Exhaustive or infallible
Scope of the project
• Python
• R
• Jupyter, Spyder, Rstudio...
• NumPy, SciPy, Pandas, Numba, Dask...
• Scikit-learn, TensorFlow, Theano...
• Matplotlib, Bokeh, Datashader, Holoviews...
• A variety of external libraries and tools
Conda channels
• Channels are thematic collections of packages,
useful to avoid version conflicts (equivalent to
repositories)
• Examples:
– pkgs/main: default channel
– conda-forge:large collection of third party packages
– bioconda:software for bioinformatics
– r: tailored to R users
How to use conda
• We need to load an environment module to
configure conda.
module load conda/3
Python 2 (legacy): module load conda/2
How to use conda
• Then we use the command conda (+ action) to
run it:
conda list
conda activate
conda create
conda search
conda install
conda update
conda help
Conda environments
• Inside a given installation of conda (conda/2 or
conda/3), there are a number of environments
• Environments are profiles: each will have a
different list of packages and versions installed
• There is a default base env, shared envs
(accessible to all users) and private envs
(accesible to the current user only)
Activating/Deactivating environments
• To see a list of environments: conda env list
• To load an env: conda activate <env_name>
• To unload: conda deactivate
Activating/Deactivating environments
• To see the contents of an env: conda list [-n env_name]
(by default, currently activated environment)
• Note: source activate and source deactivate are obsolete
Shared environments
• Maintained by our HPC team, available to all
users:
– base: Python and common Python packages
– bio-computation: Python, Biopython, Bioperl and
libraries for bioinformatics
– machine-learning:Python and R for ML, including
Scikit-learn, TensorFlow and Keras
– machine-learning-gpu: same but with GPU support
– quantum-chem: Python tools for QC, including MDtraj,
PySCF, libcint and libxc
– genetics: R tools for NGS, such as DESeq2, edgeR or
LIMMA
Private environments
• Users can create their own private envs (stored at
$HOME/.conda/envs) which won't we visible for
other users
• To create a new empty environment: conda
create -n <env_name>
• To create a new environment with packages
preinstalled in it: conda create –n <env_name>
[list of packages]
Private environments
• To install one or more packages in a private env: conda
install [-n env_name] <packages>
• If no env is specified, installed in currently active
environment
• Version and channel can also be specified: conda install
[-n env_name] [-C channel] <package=version>
• Important note: users don't have permissions to install
packages in shared environments!
Private environments
• To update packages in an environment: conda
update [-n env_name] <specific packages> or
conda update [-n env_name] --all
• To uninstall packages: conda remove [-n
env_name] <packages>
• To completely delete a private environment:
conda remove -n <env_name> --all
Using Python through conda
#!/bin/bash
#SBATCH –p std
#SBATCH –N 1
#SBATCH –n 1
module load conda/3
conda activate machine-learning
python example.py
Using R through conda
#!/bin/bash
#SBATCH –p std
#SBATCH –N 1
#SBATCH –n 1
module load conda/3
conda activate machine-learning
Rscript example.R
Using R through conda
• It is possible to install R packages to the
private library directory using CRAN, although
it requires configuring a proxy:
export http_proxy=192.168.255.254:8080
export https_proxy=192.168.255.254:8080
> install.packages("example")
Best practices
• Creating a private env tailored to your needs is
usually more efficient than using shared envs
• Avoid clutter in your private environments; it's
better to create multiple single-purpose
environments than one large environment with
too many packages
• Be mindful of version collision when updating
environments; if you don't need to update, don't
https://confluence.csuc.cat/display
/HPCKB/Training

More Related Content

PDF
Conda environment system how to use it on CSUC machines
PDF
Conda environment system & how to use it on CSUC machines
PDF
Containers with systemd-nspawn
PDF
Full system roll-back and systemd in SUSE Linux Enterprise 12
DOCX
Isolating an applications using LXC – Linux Containers
PDF
Lxc- Linux Containers
PDF
Linux Containers & Docker
Conda environment system how to use it on CSUC machines
Conda environment system & how to use it on CSUC machines
Containers with systemd-nspawn
Full system roll-back and systemd in SUSE Linux Enterprise 12
Isolating an applications using LXC – Linux Containers
Lxc- Linux Containers
Linux Containers & Docker

What's hot (20)

PDF
CoreOS, or How I Learned to Stop Worrying and Love Systemd
PDF
Docker internals
PDF
Systemd mlug-20140614
PPTX
Docker advance1
PDF
Docker 1.11 @ Docker SF Meetup
PPTX
First steps on CentOs7
PDF
Consul and docker swarm cluster
PDF
Docker Meetup: Docker Networking 1.11, by Madhu Venugopal
PDF
Linux Containers From Scratch
PDF
Systemd: the modern Linux init system you will learn to love
PPTX
Docker advance topic
PDF
The age of orchestration: from Docker basics to cluster management
PDF
Systemd evolution revolution_regression
PDF
Introduction to systemd
PDF
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
PDF
Devoxx 2016: A Developer's Guide to OCI and runC
PDF
Effective service and resource management with systemd
PPTX
Docker: Aspects of Container Isolation
PDF
Your first dive into systemd!
PDF
Virtualization which isn't: LXC (Linux Containers)
CoreOS, or How I Learned to Stop Worrying and Love Systemd
Docker internals
Systemd mlug-20140614
Docker advance1
Docker 1.11 @ Docker SF Meetup
First steps on CentOs7
Consul and docker swarm cluster
Docker Meetup: Docker Networking 1.11, by Madhu Venugopal
Linux Containers From Scratch
Systemd: the modern Linux init system you will learn to love
Docker advance topic
The age of orchestration: from Docker basics to cluster management
Systemd evolution revolution_regression
Introduction to systemd
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Devoxx 2016: A Developer's Guide to OCI and runC
Effective service and resource management with systemd
Docker: Aspects of Container Isolation
Your first dive into systemd!
Virtualization which isn't: LXC (Linux Containers)
Ad

Similar to Conda environment system how to use it on CSUC machines (20)

PPTX
Conda environment system & how to use it on CSUC machines
PDF
The Conda environment system and how to use it on CSUC machines
PDF
Effectively using Open Source with conda
PDF
Conda cheatsheet
PPTX
25532813.pptx
PDF
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
PDF
Installing Anaconda Distribution of Python
PPTX
Bioconda and the Conda Package Manager
PPTX
2022.03.23 Conda and Conda environments.pptx
PDF
Elevate Your Enterprise Python and R AI, ML Software Strategy with Anaconda T...
PDF
Setting-Up Python Environment (Jupyter Notebook)
PDF
Using Conda in Oracle Data Science.pdf
PDF
Conda and Bioconda
PDF
conda-cheatsheetaaaaaaaaaaaaaaaaaaaa.pdf
PPTX
anaconda.pptx
PPTX
Top 10 Anaconda Interview Questions and Answers.pptx
PDF
Python Versions and Dependencies Made Easy
PDF
Virtualenv
PDF
Introduction to the Python conda package manager
PDF
PyData Barcelona Keynote
Conda environment system & how to use it on CSUC machines
The Conda environment system and how to use it on CSUC machines
Effectively using Open Source with conda
Conda cheatsheet
25532813.pptx
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Installing Anaconda Distribution of Python
Bioconda and the Conda Package Manager
2022.03.23 Conda and Conda environments.pptx
Elevate Your Enterprise Python and R AI, ML Software Strategy with Anaconda T...
Setting-Up Python Environment (Jupyter Notebook)
Using Conda in Oracle Data Science.pdf
Conda and Bioconda
conda-cheatsheetaaaaaaaaaaaaaaaaaaaa.pdf
anaconda.pptx
Top 10 Anaconda Interview Questions and Answers.pptx
Python Versions and Dependencies Made Easy
Virtualenv
Introduction to the Python conda package manager
PyData Barcelona Keynote
Ad

More from CSUC - Consorci de Serveis Universitaris de Catalunya (20)

PDF
Novetats a l'Anella Científica, per Maria Isabel Gandia
PDF
IPCEI Cloud - Using European Open-Source Technologies to Build a Sovereign, M...
PDF
L'impacte geopolític a les TIC, per Genís Roca
PDF
Pirineus OnDemand: l'accés fàcil al càlcul científic del CSUC
PDF
Funcionament del servei de càlcul científic del CSUC
PDF
El servei de càlcul científic del CSUC: presentació
PPTX
RDM Training: Publish research data with the Research Data Repository
PPTX
Facilitar a gestão, a visibilidade e a reutilização dos dados de investigação...
PDF
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
PDF
Construint comunitat i governança: ​ el rol del CSUC en el cicle de vida de l...
PDF
Formació RDM: Publicar dades de recerca amb el Repositori de Dades de Recerca
PDF
Publica les teves dades de recerca al Repositori de Dades de Recerca
PDF
Com fer un pla de gestió de dades amb l'eiNa DMP (en català)
PDF
Los datos abiertos: movimiento en expansión
PDF
Dataverse as a FAIR Data Repository (Mercè Crosas)
PDF
From Automation to Autonomous Networks with AI
PDF
Jornada de presentació de les noves infraestructures de càlcul i emmagatzematge
PDF
Les subvencions del Departament de Cultura per a projectes relatius al patrim...
PDF
Presentació dels serveis d'eScire (patrocinador)
PDF
L'Arxiu Històric de la Biblioteca del Centre de Lectura de Reus
Novetats a l'Anella Científica, per Maria Isabel Gandia
IPCEI Cloud - Using European Open-Source Technologies to Build a Sovereign, M...
L'impacte geopolític a les TIC, per Genís Roca
Pirineus OnDemand: l'accés fàcil al càlcul científic del CSUC
Funcionament del servei de càlcul científic del CSUC
El servei de càlcul científic del CSUC: presentació
RDM Training: Publish research data with the Research Data Repository
Facilitar a gestão, a visibilidade e a reutilização dos dados de investigação...
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
Construint comunitat i governança: ​ el rol del CSUC en el cicle de vida de l...
Formació RDM: Publicar dades de recerca amb el Repositori de Dades de Recerca
Publica les teves dades de recerca al Repositori de Dades de Recerca
Com fer un pla de gestió de dades amb l'eiNa DMP (en català)
Los datos abiertos: movimiento en expansión
Dataverse as a FAIR Data Repository (Mercè Crosas)
From Automation to Autonomous Networks with AI
Jornada de presentació de les noves infraestructures de càlcul i emmagatzematge
Les subvencions del Departament de Cultura per a projectes relatius al patrim...
Presentació dels serveis d'eScire (patrocinador)
L'Arxiu Històric de la Biblioteca del Centre de Lectura de Reus

Recently uploaded (20)

PDF
Zenith AI: Advanced Artificial Intelligence
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
STKI Israel Market Study 2025 version august
PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
Getting Started with Data Integration: FME Form 101
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PPT
Module 1.ppt Iot fundamentals and Architecture
Zenith AI: Advanced Artificial Intelligence
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
STKI Israel Market Study 2025 version august
Web Crawler for Trend Tracking Gen Z Insights.pptx
sustainability-14-14877-v2.pddhzftheheeeee
Enhancing emotion recognition model for a student engagement use case through...
Developing a website for English-speaking practice to English as a foreign la...
Getting started with AI Agents and Multi-Agent Systems
WOOl fibre morphology and structure.pdf for textiles
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
Getting Started with Data Integration: FME Form 101
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
A comparative study of natural language inference in Swahili using monolingua...
Univ-Connecticut-ChatGPT-Presentaion.pdf
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
CloudStack 4.21: First Look Webinar slides
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Hindi spoken digit analysis for native and non-native speakers
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Module 1.ppt Iot fundamentals and Architecture

Conda environment system how to use it on CSUC machines

  • 1. Conda environment system & how to use it on CSUC machines Víctor Pérez 19/ 02 / 2020
  • 2. Index 1. What is conda? 2. Scope of the project 3. How to use conda 4. Conda environments 5. Package management 6. Python through conda 7. R through conda
  • 3. What is conda? • Originally: Anaconda, a distribution of Python including common scientific packages https://www.anaconda.com/ • Extended to include R and R packages, scientific libraries, other software, etc. • conda: core package manager for the Anaconda project
  • 4. What is conda? • conda installs and updates binary versions of Python and R packages from its own (or third party) repositories • It is an alternative to other repository systems, like pip for Python or CRAN for R • It is also a way to manage dependencies for Python and R packages
  • 5. But conda isn't... • A repository of system software packages (such as apt or yum) • A repository of source code • A replacement for environment modules • Exhaustive or infallible
  • 6. Scope of the project • Python • R • Jupyter, Spyder, Rstudio... • NumPy, SciPy, Pandas, Numba, Dask... • Scikit-learn, TensorFlow, Theano... • Matplotlib, Bokeh, Datashader, Holoviews... • A variety of external libraries and tools
  • 7. Conda channels • Channels are thematic collections of packages, useful to avoid version conflicts (equivalent to repositories) • Examples: – pkgs/main: default channel – conda-forge:large collection of third party packages – bioconda:software for bioinformatics – r: tailored to R users
  • 8. How to use conda • We need to load an environment module to configure conda. module load conda/3 Python 2 (legacy): module load conda/2
  • 9. How to use conda • Then we use the command conda (+ action) to run it: conda list conda activate conda create conda search conda install conda update conda help
  • 10. Conda environments • Inside a given installation of conda (conda/2 or conda/3), there are a number of environments • Environments are profiles: each will have a different list of packages and versions installed • There is a default base env, shared envs (accessible to all users) and private envs (accesible to the current user only)
  • 11. Activating/Deactivating environments • To see a list of environments: conda env list • To load an env: conda activate <env_name> • To unload: conda deactivate
  • 12. Activating/Deactivating environments • To see the contents of an env: conda list [-n env_name] (by default, currently activated environment) • Note: source activate and source deactivate are obsolete
  • 13. Shared environments • Maintained by our HPC team, available to all users: – base: Python and common Python packages – bio-computation: Python, Biopython, Bioperl and libraries for bioinformatics – machine-learning:Python and R for ML, including Scikit-learn, TensorFlow and Keras – machine-learning-gpu: same but with GPU support – quantum-chem: Python tools for QC, including MDtraj, PySCF, libcint and libxc – genetics: R tools for NGS, such as DESeq2, edgeR or LIMMA
  • 14. Private environments • Users can create their own private envs (stored at $HOME/.conda/envs) which won't we visible for other users • To create a new empty environment: conda create -n <env_name> • To create a new environment with packages preinstalled in it: conda create –n <env_name> [list of packages]
  • 15. Private environments • To install one or more packages in a private env: conda install [-n env_name] <packages> • If no env is specified, installed in currently active environment • Version and channel can also be specified: conda install [-n env_name] [-C channel] <package=version> • Important note: users don't have permissions to install packages in shared environments!
  • 16. Private environments • To update packages in an environment: conda update [-n env_name] <specific packages> or conda update [-n env_name] --all • To uninstall packages: conda remove [-n env_name] <packages> • To completely delete a private environment: conda remove -n <env_name> --all
  • 17. Using Python through conda #!/bin/bash #SBATCH –p std #SBATCH –N 1 #SBATCH –n 1 module load conda/3 conda activate machine-learning python example.py
  • 18. Using R through conda #!/bin/bash #SBATCH –p std #SBATCH –N 1 #SBATCH –n 1 module load conda/3 conda activate machine-learning Rscript example.R
  • 19. Using R through conda • It is possible to install R packages to the private library directory using CRAN, although it requires configuring a proxy: export http_proxy=192.168.255.254:8080 export https_proxy=192.168.255.254:8080 > install.packages("example")
  • 20. Best practices • Creating a private env tailored to your needs is usually more efficient than using shared envs • Avoid clutter in your private environments; it's better to create multiple single-purpose environments than one large environment with too many packages • Be mindful of version collision when updating environments; if you don't need to update, don't