Hi,
As you said, you installed the Motorcortex module (motorcortex-python) and, thus, I presume this is a virtual environment issue. These steps can slim down the problem and, hopefully, even solve it:
- In a new terminal, activate the virtual environment you want to use:
source .venv/bin/activate. (This is a relative path and thus make sure to correct it to your situation.
- Check if the virtual environment is activated, visible by the
(.venv) in front of a new line in the Terminal:
For example: (.venv) coen@coen:~$
- Now run
pip list to see if motorcortex-python is installed.
- If it is not installed install it with:
pip install motorcortex-python.
- Double check with
pip list if motorcortex-python is now installed.
If motorcortex-python is installed, but your script still gives the error of ModuleNotFoundError: No module named 'motorcortex'. You are, probably, not running the script correctly in the environment. To verify this add the following code to the top of your python script:
import sys
print(f"Using python from: {sys.executable}")
This will print the location of the Python executable that runs the script. This executable must be in the bin of the virtual environment folder: Ending in .venv/bin/python. Ensure this is the correct virtual environment.
If it is both installed and Python is running with the correct python executable, motorcortex-python will be imported.
Hopefully, this works, otherwise please do not hesitate to provide further information in what is going wrong, so we can help you.
Coen