Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
doku:python [2023/03/30 13:05] – [Create your own custom conda environment] katrin | doku:python [2023/04/05 12:24] – [Channels] katrin | ||
---|---|---|---|
Line 38: | Line 38: | ||
To load '' | To load '' | ||
<code bash> | <code bash> | ||
- | spack load miniconda3@4.12.0 | + | # VSC-4 |
+ | module | ||
+ | |||
+ | # VSC-5 | ||
+ | module load miniconda3/ | ||
</ | </ | ||
- | If you plan to use conda more frequently you can simple add the spack load statement to your '' | + | If you plan to use conda more frequently you can simple add the load statement to your '' |
+ | |||
+ | === Optional: execute conda hooks on login === | ||
+ | |||
+ | If you want to have every conda function available directly after logging in you can execute the following statements to add the conda startup code to your '' | ||
- | Also make sure that you run the following statements if you are setting up conda for the **first time**: | ||
<code bash> | <code bash> | ||
conda init bash --dry-run --verbose | grep "# >>> | conda init bash --dry-run --verbose | grep "# >>> | ||
source ~/.bashrc | source ~/.bashrc | ||
</ | </ | ||
- | |||
- | This will add some necessary startup code for conda to your '' | ||
After executing these steps you will see that your prompt changed to '' | After executing these steps you will see that your prompt changed to '' | ||
+ | |||
+ | If you already have an environment you can also add '' | ||
==== Channels ==== | ==== Channels ==== | ||
- | The '' | + | The '' |
+ | |||
+ | Popular channels | ||
+ | - '' | ||
+ | - '' | ||
- | To use '' | + | To use e.g. '' |
- | If you always | + | If you want to set e.g. '' |
<code bash> | <code bash> | ||
conda config --add channels conda-forge | conda config --add channels conda-forge | ||
Line 95: | Line 106: | ||
=== Create conda env from commandline === | === Create conda env from commandline === | ||
- | Note: this method is not recommended since its not reproducible | + | **Note:** this method |
In order to create your own user environment you need to do the following steps. To also give a short example for a package which we do not provide via spack we will install '' | In order to create your own user environment you need to do the following steps. To also give a short example for a package which we do not provide via spack we will install '' | ||
Line 133: | Line 144: | ||
===== SLURM ===== | ===== SLURM ===== | ||
- | See the following minimal example to use conda with slurm in your batch script | + | See the following minimal example to use conda with slurm in your batch script. See [[doku: |
<code bash> | <code bash> | ||
- | # | + | #!/bin/bash |
#SBATCH --job-name=slurm_conda_example | #SBATCH --job-name=slurm_conda_example | ||
Line 143: | Line 154: | ||
#SBATCH --mem=2GB | #SBATCH --mem=2GB | ||
- | spack load miniconda3@4.12.0 | + | # modify SBATCH options according to needs |
+ | |||
+ | # see "Setup Conda" above or consult " | ||
+ | module | ||
+ | eval " | ||
conda activate myenv | conda activate myenv | ||
- | which python | ||
- | python --version | ||
- | </ | ||
- | Please note the '' | + | # print out some info of the python executable |
- | + | # this should point to the python version | |
- | See the following example: | + | |
- | + | ||
- | <code bash> | + | |
- | # | + | |
- | + | ||
- | #SBATCH --job-name=slurm_conda_example | + | |
- | #SBATCH --time 00-00: | + | |
- | #SBATCH --ntasks=2 | + | |
- | #SBATCH --mem=2GB | + | |
- | + | ||
- | spack load miniconda3@4.12.0 | + | |
- | source ~/ | + | |
- | conda activate | + | |
which python | which python | ||
python --version | python --version |