Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Problem with using libsumo

Hello,
 Thank you for the reply!
 Indeed python 3.7 seems to work. I have tried to cmake it once more.
I use the generator "Visual Studio 14 2015 Win64". This time i used cmake-gui this time and I have added
 SWIG_EXECUTABLE to point to swig.exe (found in SUMOLibraries) and the
 SWIG_DIR to point to the swig directory in SUMOLibraries.
Now it seems to work. I don't know what exactly the problem was but maybe in my previous attempts
 I didn't build the sln in Release (I am not sure).

For anyone who has this problem in windows here are the steps to build in order to use libsumo:
 1. Make sure to have python 3.7 in PATH environmental variable.
2. Download SUMOLibraries (git clone them from https://github.com/DLR-TS/SUMOLibraries) 3. Configure them in the PATH (like it is specified in https://github.com/DLR-TS/SUMOLibraries README.md)
 4. git clone https://github.com/eclipse/sumo
5. Open terminal as administrator and go to the path that is cloned. (cd sumo)
 6. Set SUMO_HOME at that directory
 7. Make directory cmake-buid inside sumo folder
 8. use cmake-gui
    8.1 specify the source to be the folder that was cloned
    8.2 specify the build to be the created cmake-build folder
8.3 click Configure and use Visual Studio 14 2015 <target> (other versions should work) -> Finish 8.4 Add Entry Name: SWIG_EXECUTABLE Type: FILE_PATH value: /path/to/swige.exe (inside SUMOLibraries) 8.5 Add Entry Name: SWIG_DIR Type: PATH value: /path/to/swig (inside SUMOLibraries)
    8.9 Click Generate
 9. go to cmake-build folder and open SUMO.SLN
 10. !!!Build solution as RELEASE!!!

Thank  you,

P.S I would really appreciate it if you could guide me on how I could use SWIG for c#. I don't know how I should go about this and I have just used libsumo in python now.

Quoting Michael Behrisch <oss@xxxxxxxxxxx>:

Hello Tom,
using Python 3 is definitely the right thing to do because libsumo only works with Python3. Concerning the error it seems that the configure step already fails because it is looking for pthread.h and does not find it. Which cmake version do you use? And did you clone SUMOLibraries?

Best regards,
Michael

Am 2019-04-16 23:39, schrieb cchadj01@xxxxxxxxxxxx:
Hello,
I am happy to learn that sumo 1.2.0 was released with cool new
features and bug fixes.
I tried to install sumo v1.2.0 again using cmake so I can use
libsumo. This time  I decided to use python version 3.7
and for this reason I created a conda environment that uses python
3.7. Having this environment activated the python.exe is in path and
so when using cmake correctly configures the python to desired
executable.
SUMO_LIBRARIES were correctly set up in PATH. I changed the
SUMO_HOME to the newly downloaded directory.
I have the PYTHONPATH=%SUMO_HOME%/tools/libsumo;%SUMO_HOME%/tools/%
and the PATH to point to these directories as-well.

I have attached the CMakeCache.txt. Also attached you can find
CMakeOutput.log and CMakeError.log

I have again tried to import libsumo but it did't work. Attached you
can find an image with the error.

Thank you,
Tom.

Quoting cchadj01@xxxxxxxxxxxx:

Hello,

I am trying to run sumo simulation faster so I decided to use libsumo.
I followed the guide to build using cmake.
I have set up the SUMO_HOME.
in SUMO_HOME/tools/libsumo I have libsumo.py (which helps import _libsumo), the _libsumo.pyd dll and some other stuff. I have set the PATH to have SUMO_HOME/tools/libsumo. I have also set PYTHONPATH to SUMO_HOME/tools/libsumo. I use conda and I have an environment called sumo which uses python 2.7. I have build sumo by following the guide at https://sumo.dlr.de/wiki/Installing/Windows_CMake (command line) and having the sumo environment activated during that process. I have also build as release (Visual Studio 2013 Win64).

I have created a simple script just importing libsumo like so:

import os
import sys

if 'SUMO_HOME' in os.environ:
   tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
   sys.path.append(tools)
else:
   sys.exit("please declare environment variable 'SUMO_HOME'")

from sumolib import checkBinary # noqa
import traci
import sumolib
import libsumo as libs

and I get this error:


Traceback (most recent call last):
File "C:/Users/VR_Lab/source/repos/sumo/tools/libsumo/test.py", line 14, in <module>
   import libsumo as libs
File "C:\Users\VR_Lab\source\repos\sumo\tools\libsumo\libsumo.py", line 17, in <module>
   _libsumo = swig_import_helper()
File "C:\Users\VR_Lab\source\repos\sumo\tools\libsumo\libsumo.py", line 16, in swig_import_helper
   return importlib.import_module('_libsumo')
File "C:\ProgramData\Anaconda2\envs\sumo\lib\importlib\__init__.py", line 37, in import_module
   __import__(name)
ImportError: DLL load failed: The specified procedure could not be found.


This script was called with python 2.7 (having the same conda environment activated as the one it was build from).
The PYTHONPATH is correctly set to SUMO_HOME/tools/libsumo.
Why does that happen?

I would like to add that in https://sumo.dlr.de/wiki/Libsumo it says to use the extended package and has a reference to a link but the referenced package doesn't have any CMakeLists.txt so I can use cmake.

Thank you,
Tom






_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user



_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user




Back to the top