How to configure Python with Matlab for NeuroMiner on the server#
Check the current Python environment in Matlab, type
pe = pyenv
in the MATLAB command window and press enter.
If you have a python installation on your computer it will look something like this:
>> pe = pyenv
pe =
PythonEnvironment with properties:
Version: "3.9"
Executable: "/opt/anaconda3/bin/python"
Library: "/opt/anaconda3/lib/libpython3.9.so"
Home: "/opt/anaconda3"
Status: NotLoaded
ExecutionMode: InProcess
To change the python executable, type
pyversion(“PATH_TO_PYTHON_EXECUTABLE”)
in the MATLAB command window and press enter.
Note
If you’ve installed the required Python packages in a conda environment, make sure to use the respective python executable.
Now pe should contain
>> pyversion("PATH_TO_PYTHON_EXECUTABLE")
>> pe
pe =
PythonEnvironment with properties:
Version: "3.9"
Executable: "/volume/data/CV_condaevns/.conda/envs/venv_nm/bin/python"
Library: "/volume/data/CV_condaevns/.conda/envs/venv_nm/lib/libpython3.9.so"
Home: "/volume/data/CV_condaevns/.conda/envs/venv_nm"
Status: NotLoaded
ExecutionMode: InProcess
Next we need to change the property ExecutionMode to ‘OutOfProcess’ (see matlab documentation for more details). To do so type:
pyenv("ExecutionMode","OutOfProcess")
Now pe should have the following properties:
pe =
PythonEnvironment with properties:
Version: "3.9"
Executable: "/volume/data/CV_condaevns/.conda/envs/venv_nm/bin/python"
Library: "/volume/data/CV_condaevns/.conda/envs/venv_nm/lib/libpython3.9.so"
Home: "/volume/data/CV_condaevns/.conda/envs/venv_nm"
Status: NotLoaded
ExecutionMode: OutOfProcess