SlideShare a Scribd company logo
Conda environment system &
how to use it on CSUC machines
Víctor Pérez
17 / 03 / 2021
Index
1. Notice: model transition
2. What is conda?
3. Scope of the project
4. How to use conda
5. Conda environments
6. Package management
7. Python through conda
8. R through conda
Notice: model transition
• Very important: we are in the process of
abandoning shared environments in favour of
private environments only
• Old shared environments will be available for
your old scripts, but won't be modified further
• We will clone them as private environments for
users and groups who need them
Notice: model transition
• We will progressively contact users of shared
environments to assist you in the "privatisation" of the
environments you need
• If you already use private environments, simply change
the module you load and that's all, no transition
needed :)
• New live and minimal conda installation:
module load conda/current
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/current
Obsolete versions for backwards compatibility:
module load conda/2 & module load conda/3
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, there are a
number of environments
• Environments are profiles: each will have a
different list of packages and versions installed
• We are transitioning to working exclusively
with private environments owned by users
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
Environments
• Users can create their own private envs (stored at
$HOME/.conda/envs) visible only to them
• 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]
Environments
• To install one or more packages in a private
env: conda install [-n env_name] <packages>
• If no env is specified, they are installed in the
currently active environment
• Version and channel can also be
specified: conda install [-n env_name] [-C
channel] <package=version>
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 an environment: conda
remove -n <env_name> --all
Environments
• Private environments can be shared with
other users in your group
• To be able to use environments created by
your group coleague, create a .condarc file in
your home with the following lines:
• Or just contact us to do it for you!
Using Python through conda
#!/bin/bash
#SBATCH –p std
#SBATCH –N 1
#SBATCH –n 1
module load conda/current
conda activate <your_environment>
python example.py
Using R through conda
#!/bin/bash
#SBATCH –p std
#SBATCH –N 1
#SBATCH –n 1
module load conda/current
conda activate <your_environment>
Rscript example.R
Using pip or CRAN through conda
• It is possible to install Python packages using
pip, or R packages using BioConductor or
CRAN, but it requires configuring a proxy
• Let us know if you need to do this so we can
set up proxy details for you
Best practices
• It is more convenient to designate one person in the group
as environment manager and install/configure everything
on their account
• Avoid clutter; 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
• When in doubt, contact us – we can do it for you
https://confluence.csuc.cat/display
/HPCKB/Training

More Related Content

PDF
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
PDF
Xdp and ebpf_maps
PPTX
Basic Git Intro
PDF
Trace kernel code tips
PPTX
Linux device drivers
PPTX
U-boot and Android Verified Boot 2.0
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
Xdp and ebpf_maps
Basic Git Intro
Trace kernel code tips
Linux device drivers
U-boot and Android Verified Boot 2.0

What's hot (20)

PDF
Faster Container Image Distribution on a Variety of Tools with Lazy Pulling
PPTX
Embedded linux
PDF
Git-flow workflow and pull-requests
PDF
GPUが100倍速いという神話をぶち殺せたらいいな ver.2013
PPTX
Understand more about C
PPTX
“Automation Testing for Embedded Systems”
PPTX
Unit 4 _ ARM Processors .pptx
PDF
ELC21: VM-to-VM Communication Mechanisms for Embedded
PDF
Writing a fast HTTP parser
PDF
BeagleBone Black Bootloaders
PDF
Linux Kernel Startup Code In Embedded Linux
PPTX
System Booting Process overview
PDF
Course 102: Lecture 9: Input Output Internals
PDF
Git for beginners
PDF
Embedded Systems: Lecture 1: Course Overview
PDF
Velocity 2015 linux perf tools
PDF
Arduino 底層原始碼解析心得
PPTX
はりぼて OS で ELF なアプリを起動してみた
PPTX
Introduction Linux Device Drivers
PPT
Basic Unix
Faster Container Image Distribution on a Variety of Tools with Lazy Pulling
Embedded linux
Git-flow workflow and pull-requests
GPUが100倍速いという神話をぶち殺せたらいいな ver.2013
Understand more about C
“Automation Testing for Embedded Systems”
Unit 4 _ ARM Processors .pptx
ELC21: VM-to-VM Communication Mechanisms for Embedded
Writing a fast HTTP parser
BeagleBone Black Bootloaders
Linux Kernel Startup Code In Embedded Linux
System Booting Process overview
Course 102: Lecture 9: Input Output Internals
Git for beginners
Embedded Systems: Lecture 1: Course Overview
Velocity 2015 linux perf tools
Arduino 底層原始碼解析心得
はりぼて OS で ELF なアプリを起動してみた
Introduction Linux Device Drivers
Basic Unix
Ad

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

PDF
Conda environment system & how to use it on CSUC machines
PDF
Conda environment system how to use it on CSUC machines
PDF
Conda environment system how to use it on CSUC machines
PDF
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)
PPTX
2022.03.23 Conda and Conda environments.pptx
PDF
Installing Anaconda Distribution of Python
PPTX
Bioconda and the Conda Package Manager
PDF
Setting-Up Python Environment (Jupyter Notebook)
PDF
Elevate Your Enterprise Python and R AI, ML Software Strategy with Anaconda T...
PDF
Using Conda in Oracle Data Science.pdf
PDF
Python Versions and Dependencies Made Easy
PDF
PyData Barcelona Keynote
PPTX
Run Python on windows
PPTX
Top 10 Anaconda Interview Questions and Answers.pptx
PPTX
anaconda.pptx
Conda environment system & how to use it on CSUC machines
Conda environment system how to use it on CSUC machines
Conda environment system how to use it on CSUC machines
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)
2022.03.23 Conda and Conda environments.pptx
Installing Anaconda Distribution of Python
Bioconda and the Conda Package Manager
Setting-Up Python Environment (Jupyter Notebook)
Elevate Your Enterprise Python and R AI, ML Software Strategy with Anaconda T...
Using Conda in Oracle Data Science.pdf
Python Versions and Dependencies Made Easy
PyData Barcelona Keynote
Run Python on windows
Top 10 Anaconda Interview Questions and Answers.pptx
anaconda.pptx
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
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPT
Teaching material agriculture food technology
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Big Data Technologies - Introduction.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
KodekX | Application Modernization Development
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Chapter 3 Spatial Domain Image Processing.pdf
Teaching material agriculture food technology
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
cuic standard and advanced reporting.pdf
Encapsulation theory and applications.pdf
Empathic Computing: Creating Shared Understanding
Big Data Technologies - Introduction.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
KodekX | Application Modernization Development
NewMind AI Weekly Chronicles - August'25 Week I
Spectral efficient network and resource selection model in 5G networks
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Understanding_Digital_Forensics_Presentation.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

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 17 / 03 / 2021
  • 2. Index 1. Notice: model transition 2. What is conda? 3. Scope of the project 4. How to use conda 5. Conda environments 6. Package management 7. Python through conda 8. R through conda
  • 3. Notice: model transition • Very important: we are in the process of abandoning shared environments in favour of private environments only • Old shared environments will be available for your old scripts, but won't be modified further • We will clone them as private environments for users and groups who need them
  • 4. Notice: model transition • We will progressively contact users of shared environments to assist you in the "privatisation" of the environments you need • If you already use private environments, simply change the module you load and that's all, no transition needed :) • New live and minimal conda installation: module load conda/current
  • 5. 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
  • 6. 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
  • 7. 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
  • 8. 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
  • 9. 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
  • 10. How to use conda • We need to load an environment module to configure conda. module load conda/current Obsolete versions for backwards compatibility: module load conda/2 & module load conda/3
  • 11. 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
  • 12. Conda environments • Inside a given installation of conda, there are a number of environments • Environments are profiles: each will have a different list of packages and versions installed • We are transitioning to working exclusively with private environments owned by users
  • 13. Activating/Deactivating environments • To see a list of environments: conda env list • To load an env: conda activate <env_name> • To unload: conda deactivate
  • 14. 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
  • 15. Environments • Users can create their own private envs (stored at $HOME/.conda/envs) visible only to them • 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]
  • 16. Environments • To install one or more packages in a private env: conda install [-n env_name] <packages> • If no env is specified, they are installed in the currently active environment • Version and channel can also be specified: conda install [-n env_name] [-C channel] <package=version>
  • 17. 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 an environment: conda remove -n <env_name> --all
  • 18. Environments • Private environments can be shared with other users in your group • To be able to use environments created by your group coleague, create a .condarc file in your home with the following lines: • Or just contact us to do it for you!
  • 19. Using Python through conda #!/bin/bash #SBATCH –p std #SBATCH –N 1 #SBATCH –n 1 module load conda/current conda activate <your_environment> python example.py
  • 20. Using R through conda #!/bin/bash #SBATCH –p std #SBATCH –N 1 #SBATCH –n 1 module load conda/current conda activate <your_environment> Rscript example.R
  • 21. Using pip or CRAN through conda • It is possible to install Python packages using pip, or R packages using BioConductor or CRAN, but it requires configuring a proxy • Let us know if you need to do this so we can set up proxy details for you
  • 22. Best practices • It is more convenient to designate one person in the group as environment manager and install/configure everything on their account • Avoid clutter; 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 • When in doubt, contact us – we can do it for you