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_PATH
to project folder, because of many small files. - Example:
CONDA_ENVS_PATH=/proj/sens2023598/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.yml
to 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/sens2023598/bjornc/conda" >> ~/.bashrc
- Example:
Warning
- It seems you are required to use this path, ending with the name of your environment, together with
--prefix
when 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.5
loaded -
Open a new terminal and have the old one available for later comparison
-
Make sure
python
module is not active in the new terminal -
Start conda module
-
Make sure you have a folder in the project directory (
$USER
will automatically fill in you username. Handy!!) -
mkdir /proj/sens2023598/$USER
-
mkdir /proj/sens2023598/$USER/conda
-
Set a CONDA_ENVS_PATH
- Example:
echo "export CONDA_ENVS_PATH=/proj/sens2023598/$USER/conda" >> ~/.bashrc
- Example:
-
Use the
conda
module on Bianca and theconda-forge
channel to create an environment with namebianca-course
withpython 3.7
andnumpy 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
y
when asked for!
- It may take a couple of minutes or so and do not forget to press
-
Activate!
-
Check with
pip list
what 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/sens2023598/$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.