Search code examples
pythonvirtualenvpython-3.5sumo

Using SUMO and TraCI: Could not connect to TraCI server 61


I am trying to run the traci_tls tutorial with SUMO 0.28.0 on my MacBook Air running MacOS 10.12.1 Sierra.

I created a virtual environment with Python 3.5.2 and copied the traci_tls folder into it. From the terminal I can run sumo as well as sumo-gui with the file cross.sumocfg and that works. However when I try to run the runner.py file I get the following error message:

Could not connect to TraCI server at localhost:56666 [Errno 61] Connection refused
 Retrying in 1 seconds
Could not connect to TraCI server at localhost:56666 [Errno 61] Connection refused
 Retrying in 2 seconds

etc...

The SUMO_HOME environment variable points to /Users/Isabelle/sumo-0.28.0, which is where I installed SUMO. I have only this version of SUMO. I build the installation myself and it is configured with TRACI. If I type sumo in terminal from within the virtual environment it shows this information:

SUMO Version 0.28.0
 Build features: x86_64-apple-darwin16.1.0 InternalLanes DoublePrecision TRACI PROJ GDAL GUI Python
 Copyright (C) 2001-2016 DLR and contributors; http://sumo.dlr.de
 License GPLv3+: GNU GPL Version 3 or later <http://gnu.org/licenses/gpl.html>
 Use --help to get the list of options.

I have used TraCI and SUMO outside of the virtual environment before. That resulted in the same error but if I started the sumo-gui via the terminal before I ran runner.py it did work. However this fix does not work for me now that I am working within the virtual environment.

I searched the web but haven't been able to find a solution.

Thank you in advance!


Solution

  • For completeness I put the answer that arose from the comments here:

    Establishing the connection took a lot longer than I expected, leaving it for a minute or so did the job.