Conda on Bianca¶
We have mirrored all major non-proprietary Conda repositories (not main, anaconda and r) directly on UPPMAX, on both Rackham and Bianca. These are updated every third day.
Available Conda channels
- bioconda
- biocore
- conda-forge
- dranew
- free
- ~~main~~
- pro
- qiime2
- ~~r~~
- r2018.11
- scilifelab-lts
- nvidia
- pytorch
Warning
- Good to change
CONDA_ENVS_PATHto project folder, because of many small files. - Example:
CONDA_ENVS_PATH=/proj/sens2025560/bjornc/conda
Read Conda user guide
-
Read Conda user guide
-
ONLY for the interested: Working with Conda environments defined by files
- On bianca you have to get the
environments.ymlto wharf first!
- On bianca you have to get the
Exercises¶
Tip
- You may want to have the same path for all conda environments in the present project
echo "export CONDA_ENVS_PATH=/a/path/to/a/place/in/your/project/" >> ~/.bashrc- Example:
echo "export CONDA_ENVS_PATH=/proj/sens2025560/bjornc/conda" >> ~/.bashrc
- Example:
Warning
- It seems you are required to use this path, ending with the name of your environment, together with
--prefixwhen you install new envronments AND packages also after activating the conda environment! Like:conda install --prefix $CONDA_ENVS_PATH/<your-environment> ...
Create a conda environment and install some packages
-
First check the current installed packages while having
python/3.9.5loaded -
Open a new terminal and have the old one available for later comparison
-
Make sure
pythonmodule is not active in the new terminal -
Start conda module
-
Make sure you have a folder in the project directory (
$USERwill automatically fill in you username. Handy!!) -
mkdir /proj/sens2025560/$USER -
mkdir /proj/sens2025560/$USER/conda -
Set a CONDA_ENVS_PATH
- Example:
echo "export CONDA_ENVS_PATH=/proj/sens2025560/$USER/conda" >> ~/.bashrc
- Example:
-
Use the
condamodule on Bianca and theconda-forgechannel to create an environment with namebianca-coursewithpython 3.7andnumpy 1.15 -
Use your a path for
CONDA_ENVS_PATH- It may take a couple of minutes or so and do not forget to press
ywhen asked for!
- It may take a couple of minutes or so and do not forget to press
-
Activate!
-
Check with
pip listwhat is there. Compare with the environment given from the python module in the first terminal window. -
Which version of Python did you get?
-
Don't forget to deactivate the Conda environment before doing other exercises!
Solution
Write this in the terminal
$ module load conda
($ export CONDA_ENVS_PATH=/proj/sens2025560/$USER)
$ conda create -c conda-forge --prefix $CONDA_ENVS_PATH/bianca-course python=3.7 numpy=1.15
$ source activate bianca-course
$ pip list
$ python -V
$ conda deactivate
- It should show numpy=1.15 among others and the python version 3.7.X for the conda env
keypoints
-
Conda is an installer of packages but also bigger toolkits
-
Conda on Bianca is easy since the repos in the most used channels are local.
-
Conda creates isolated environments not clashing with other installations of python and other versions of packages
-
Conda environment requires that you install all packages needed by yourself, although automatically.
-
That is, you cannot load the python module and use the packages therein inside your Conda environment.