Virtual environments are a convenient way for you to have complete control over potentially many versions of Python. The LMS provides the conda utility to allow you to create and manage virtual Python environments. This page describes the basics of using conda, as well as some LMS-specific configuration that you are likely to find useful. The full documentation of conda, can be found in the conda online documentation.
Initial Setup
By default, conda will create environments and install packages into subdirectories of your HOME directory, which will end up containing a vast number of files. To avoid hitting quota limits, you can tell conda to store files in your scratch space instead, which is much larger. To do this, you need to work through these steps.
...
Code Block |
---|
module load lang/Miniconda3 |
Creating an environment
The most reliable way to create an environment using conda is by using an environment file. This is a .yaml file that describes the Python environment you would like to create. This method allows you to recreate the same environment in multiple places, and easily pass on the specification for a Python environment to other users. A simple example of an environment file is given below.
...
This will list all of the environments installed with conda, and in this example we can see that my_first_environment has been successfully created. Note the asterisk highlights the active environment, which is currently the base environment (over which you have no control).
Using an environment
Once an environment has been created, you can activate it with the following command:
...