Difference between revisions of "Environment"

From UFAL AIC
(Python venv primer for cluster users.)
 
(Virtual environment)
Line 9: Line 9:
  
 
=== Virtual environment ===
 
=== Virtual environment ===
The recommended way is to use a virtual environment.
+
The recommended way is to use python through a virtual environment.
 
You need to decide which PYTHON_VERSION you want to use and where do you want to store your virtual environment (VENV_PATH). Then you can create it:
 
You need to decide which PYTHON_VERSION you want to use and where do you want to store your virtual environment (VENV_PATH). Then you can create it:
  

Revision as of 14:14, 9 May 2022

Python

If you need to use a different version of python than the default one installed with node OS you can use pre-installed versions found at:

/opt/python

If you need some specific version not found in this directory please contact the AIC administrators.


Virtual environment

The recommended way is to use python through a virtual environment. You need to decide which PYTHON_VERSION you want to use and where do you want to store your virtual environment (VENV_PATH). Then you can create it:

/opt/python/<PYTHON_VERSION>/bin/python3 -m venv <VENV_PATH>

You need to activate the environment before you actually use it:

source <VENV_PATH>/bin/activate

Then you should be able to use the python version of your choice. More about virtual environments can be found here