I would like to run some python script (namely the mne package for analyzing EEG data) from Matlab 2021b under Ubuntu 21.04.
While I see various postings saying this is simple, I am not finding that this is the case.
I have python and mne successfully installed and it runs fine via the Terminal app.
I have tried writing a .py file and running it from Matlab, as in system('python3 temp.py')
It doesn't work. From what I've found online, Matlab is running it's own shell and in my case mne is not installed in it. It's not even running the same version of python. I've got python 3.8 in the Terminal but Matlab is running python 3.9, so when I run a .py file with:
import sys
print(sys.path)
I get: ['/media/jdien/Data1/experiments/NP1/artifactPaper/MAAC', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/usr/local/lib/python3.9/dist-packages', '/usr/lib/python3/dist-packages']
I can't find any information on how to add mne to the path or to get it installed into Matlab's apparently private environment.
If I try running a .py file with:
apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6
pip install mne
I just get the error message:
apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6
^
SyntaxError: invalid syntax
Here, if I try something simple like: >> py.sys.path
I get the error message:
Python commands require a supported version of CPython. See Getting Started with
Python.
So here even Python is not installed and again I seem to have no way to get it installed, let alone mne.
Can someone help me with a more useful response than that it is easy to run python from matlab? Sorry, a little frustrated here...
Apparently I should also clarify that I used anaconda to install python so that may be part of what is causing problems. But still not clear what to do. Here is what I get when I do the sys.path command in my Terminal app:
['/media/jdien/Data1/experiments/NP1/artifactPaper/MAAC', '/home/jdien/anaconda3/lib/python38.zip', '/home/jdien/anaconda3/lib/python3.8', '/home/jdien/anaconda3/lib/python3.8/lib-dynload', '/home/jdien/.local/lib/python3.8/site-packages', '/home/jdien/anaconda3/lib/python3.8/site-packages']