Tutorial, module simulation.simulations

Hy everybody,
I’m trying to follow the tutorial at Sumo-interface but I’m failing to execute the minimal example Python script provided.

I trace down here the whole troubleshooting history, as there may be valuable information for you guys that I don’t recognise as such (bear me, I beg your pardon…)

I issued python3 -m pip install sumo-cr
but got message

commonroad-rl 2022.2 requires commonroad-io==2022.1, but you have commonroad-io 2022.3 which is incompatible.

I ignored it for the moment, as I think I stumbled upon a vicious cycle in dependencies (basically I firstly installed commonroad-all, then tried the commonroad-rl tutorial with issues, and ended up discovering that updating either commonroad-rl or commonroad-io makes someone amongst the two and sumocr sad…but this is another story, maybe for another forum post)

I proceeded to run the minimal example script but got error

ModuleNotFoundError: No module named 'simulation'

I then run python3 -m pip install simulation but got error

ERROR: Failed building wheel for scikit-sparse

that traced back to

fatal error: 'cholmod.h' file not found

I solved it after somme googling by installing sparse-suit via homebrew (the interested reader is referred to here and there)

Now I am stuck with error

ModuleNotFoundError: No module named 'simulation.simulations'

I’ve seen that there is a simulations.py at https://gitlab.lrz.de/tum-cps/commonroad-interactive-scenarios/-/tree/master/simulation, it is the one Python is looking for?

If yes, can you spot what I did wrong based on the report above?
Did I miss some installation steps?

FYI I have installed

  • Name: commonroad-all Version: 0.0.1
  • Name: commonroad-io Version: 2022.3
  • Name: sumocr Version: 2022.3

I tried to install other versions of sumocr (all from 2022.*) but neither succeeded

Hi,

Thanks for your message. The example page which you are referring to is for the interactive scenarios package. Installing sumocr is only a prerequisite to this.

If you execute the following steps, the tutorials on interactive scenarios should work:

  1. Clone commonroad-interactive-scenarios repository

  2. Create a NEW conda environment (it seems linke you have already installed multiple packages in your existing one)
    conda create -n commonroadNEW python=3.9

  3. Navigate with the terminal to the cloned repo folder

  4. Activate your conda environment
    conda activate commonroadNEW

  5. Install the required packages (commonroad-io and sumocr) by running
    pip install -r requirements.txt

If the installation succeeded, you should be able to run the tutorials. Please note that the tutorial files within in the repos are typically more up to date. Therefore, I suggest that you should run the Jupyter Notebook at tutorials/1_tutorial_scenario_simulation.ipynb instead.

Best regards,
Florian

Dear @florian.finkeldei , many thanks for your kind reply.
I tried and now get

Traceback (most recent call last):
  File "/Users/sm/PycharmProjects/RomoliGiacomo/commonroad-interactive-scenarios/tutorials/tutorial-sumo-v2.py", line 4, in <module>
    from simulation.simulations import simulate_without_ego, simulate_with_solution, simulate_with_planner
  File "/Users/sm/PycharmProjects/RomoliGiacomo/commonroad-interactive-scenarios/tutorials/../simulation/simulations.py", line 26, in <module>
    from sumocr.interface.sumo_simulation import SumoSimulation
  File "/Users/sm/PycharmProjects/RomoliGiacomo/interactive_env/lib/python3.9/site-packages/sumocr/interface/sumo_simulation.py", line 25, in <module>
    from sumocr.interface.util import *
  File "/Users/sm/PycharmProjects/RomoliGiacomo/interactive_env/lib/python3.9/site-packages/sumocr/interface/util.py", line 6, in <module>
    import libsumo as traci
  File "/Users/sm/PycharmProjects/RomoliGiacomo/interactive_env/lib/python3.9/site-packages/libsumo/__init__.py", line 30, in <module>
    from .libsumo import vehicle, simulation, person, trafficlight  # noqa
  File "/Users/sm/PycharmProjects/RomoliGiacomo/interactive_env/lib/python3.9/site-packages/libsumo/libsumo.py", line 13, in <module>
    from . import _libsumo
ImportError: dlopen(/Users/sm/PycharmProjects/RomoliGiacomo/interactive_env/lib/python3.9/site-packages/libsumo/_libsumo.so, 2): Library not loaded: /usr/local/opt/proj/lib/libproj.25.dylib
  Referenced from: /Users/sm/PycharmProjects/RomoliGiacomo/interactive_env/lib/python3.9/site-packages/libsumo/_libsumo.so
  Reason: image not found

Am I missing installation of this SUMO component called “libsumo”? I usually use TRACI so I’m not really familiar with this one…

Dear @smariani,

Sorry for the late reply! The libsumo package, which is causing the problem, is automatically installed when running pip install -r requirements.txt. Did you install the Sumo software successfully before installing the requirements.txt?

Best regards,
Florian

Dear @florian.finkeldei ,
many thanks for your kind reply.

Yes I have sumo installed an working as follows

Eclipse SUMO sumo Version 1.15.0
 Build features: Darwin-20.6.0 x86_64 Clang 13.0.0.13000029 Release FMI Proj GUI Intl
 Copyright (C) 2001-2022 German Aerospace Center (DLR) and others; https://sumo.dlr.de

I also have sumolib as follows (from pip3 show)

Name: sumolib
Version: 1.15.0
Summary: Python helper modules to read networks, parse output data and do other useful stuff related to the traffic simulation Eclipse SUMO
Home-page: https://sumo.dlr.de/docs/Tools/Sumolib.html
Author: DLR and contributors
Author-email: sumo@dlr.de
License: EPL-2.0
Location: /Users/sm/PycharmProjects/RomoliGiacomo/romoli_env/lib/python3.9/site-packages
Requires:
Required-by: traci

And traci

Name: traci
Version: 1.15.0
Summary: The pure python version of the TraCI API to communicate with the traffic simulation Eclipse SUMO
Home-page: https://sumo.dlr.de/docs/TraCI/Interfacing_TraCI_from_Python.html
Author: DLR and contributors
Author-email: sumo@dlr.de
License: EPL-2.0
Location: /Users/sm/PycharmProjects/RomoliGiacomo/romoli_env/lib/python3.9/site-packages
Requires: sumolib
Required-by: libsumo

And finally libsumo

Name: libsumo
Version: 1.15.0
Summary: The python version of the libsumo API to communicate with the traffic simulation Eclipse SUMO
Home-page: https://sumo.dlr.de/docs/Libsumo.html
Author: DLR and contributors
Author-email: sumo@dlr.de
License: EPL-2.0
Location: /Users/sm/PycharmProjects/RomoliGiacomo/romoli_env/lib/python3.9/site-packages
Requires: traci
Required-by: sumocr