No module named 'commonroad'

Hi there,

When I go through the tutorial notebook tutorial_commonroad-io.ipynb I get the error No module named ‘commonroad’.

When I check the installed packages of the commonroad-py37 environment in anaconda it also isn’t listed there. Is commonroad even supposed to be listed here so that it can be imported?
On the other hand, when I navigate to the commonroad-py37 environment folder and go to /lib/python3.7/site-packages I can find commonroad there.

When I try in the terminal (with the activated environment) import commonroad, it seems to work because I don’t get any error there.

sys.executable gives me ‘/Users/zachow/opt/anaconda3/envs/commonroad-py37/bin/python’ and in sys.path the path mentioned above of the site-packages is also listed.

Can anybody help me with this please?

Thanks a lot in advance already!
Max

Hi Max,
Have you entered the “jupyter notebook” command in the environment commonroad-py37?

Hi Edmond,

thanks for your quick reply, yes I did but I actually just fixed the problem.

For everybody else who is facing a similar issue:

I simply had to add two lines of code to the notebook:
import sys
sys.path.append(’/Users/zachow/opt/anaconda3/envs/commonroad-py37/lib/python3.7/site-packages’)

The sys.path that I mentioned in the original question was the one from the terminal.
Now it looks like it is all working now :slight_smile:

Hello Max,
usually this is not required. When installing it through
pip install commonroad-io
import commonroad should already work. Maybe you installed it in another conda environment or didn’t activate it.