Use Conda in Coder

It is possible to use multiple Python interpreters within the same instance of the Coder Python app.

For example, consider a local installation of Miniconda, say miniconda3, mounted inside the app. From the app terminal interface add Conda to the search path via:

$ eval "$(/work/miniconda3/bin/conda shell.bash hook)"

Tip

(base) ucloud:/work$

The list of Conda environments is returned by:

$ conda env list

Tip

# conda environments:

#

base                             * /work/miniconda3

py_env                             /work/miniconda3/envs/py_env

So, one of the environments can be activated as in the example below:

$ conda activate py_env

Tip

(py_env) ucloud:/work$

To use the Python interpreter which corresponds to the selected environment, repeat the following steps from the app interface:

  • Press Ctrl/Cmd + Shift + P or select the menu View -> Command Palette...

  • Execute the command > Python: Select Intepreter

  • Click on Enter intepreter path...

  • Add the full path of the Python command: /work/miniconda3/envs/py_env/bin/python