bstriner / gym-traffic Goto Github PK
View Code? Open in Web Editor NEWOpenAI Gym Environment for Traffic Control
OpenAI Gym Environment for Traffic Control
I want to play around with the tool, but when I run the example: python examples/example_gym_traffic_dqn.py
I get an error saying python cannot find the traci
module.
I've been going through the installations steps mentioned by this repo readme before running the file, but I can't seem to figure out how to fix this.
What can I do from here?
whenever I try to run the examples I get the following error.
No module named 'dqn'
I changed some of you code in init.py since there are problems on finding the module.
Right now, I get the problem "'nvec (counts) have to be positive'".
I have no idea to fix it.
I'm using python3 and IDE is VScode.
here are my command and log from running on terminal.
python examples/example_gym_traffic_random.py
Traceback (most recent call last):
File "examples/example_gym_traffic_random.py", line 9, in
env = gym.make('Traffic-Simple-cli-v0')
File "c:\users\user\desktop\gym\gym\envs\registration.py", line 145, in make
return registry.make(id, **kwargs)
File "c:\users\user\desktop\gym\gym\envs\registration.py", line 90, in make
env = spec.make(kwargs)
File "c:\users\user\desktop\gym\gym\envs\registration.py", line 60, in make
env = cls(_kwargs)
File "c:\users\user\downloads\gym-traffic-first\gym-traffic-first\gym_traffic\envs\traffic_env_simple.py", line 23, in init
super(TrafficEnvSimple, self).init(mode=mode, lights=lights, netfile=netfile, routefile=routefile,
File "c:\users\user\downloads\gym-traffic-first\gym-traffic-first\gym_traffic\envs\traffic_env.py", line 53, in init
spaces.MultiDiscrete([[0, len(light.actions) - 1 ] for light in self.lights]), 'all')
File "c:\users\user\desktop\gym\gym\spaces\multi_discrete.py", line 30, in init
assert (np.array(nvec) > 0).all(), 'nvec (counts) have to be positive'
AssertionError: nvec (counts) have to be positive
And, I also changed the code in the statement in traffic_env. I think the problem is cause from that statement. But, if I did not change the method, it will show me the error of "AttributeError: module 'gym.spaces' has no attribute 'DiscreteToMultiDiscrete'"
the old one:
self.action_space = spaces.DiscreteToMultiDiscrete(
spaces.MultiDiscrete([[0, len(light.actions) - 1] for light in self.lights]), 'all')
I changed to this:
self.action_space = spaces.multi_discrete(
spaces.MultiDiscrete([[0, len(light.actions) - 1 ] for light in self.lights]), 'all')
I have the next error, in the example: "example_gym_traffic_dqn". Could you help me?
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
RESTART: C:\Python3.6.8\scripts\gym-traffic-master\examples\example_gym_traffic_dqn.py
Traceback (most recent call last):
File "C:\Python3.6.8\scripts\gym-traffic-master\examples\example_gym_traffic_dqn.py", line 4, in
from gym_traffic.agents import DQN, EpsilonExplorer
File "C:\Users\RICARDO\AppData\Local\Programs\Python\Python36\lib\site-packages\gym_traffic-0.0.1-py3.6.egg\gym_traffic_init_.py", line 8, in
nondeterministic=True
File "C:\Users\RICARDO\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\envs\registration.py", line 139, in register
return registry.register(id, **kwargs)
File "C:\Users\RICARDO\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\envs\registration.py", line 133, in register
self.env_specs[id] = EnvSpec(id, **kwargs)
TypeError: init() got an unexpected keyword argument 'tags'
Dear Ben,
In my case, I had several errors. What kind of Gym version did you use ?
gym (0.8.2)
gym-pull (0.1.7)
tensorflow (1.0.1)
keras-rl (0.3.0)
sumo(0.29.0)
Lee~/Downloads/Transportation/bstriner_Ben/gym-traffic-master/examples$ python example_gym_traffic_dqn.py
Using TensorFlow backend.
[2017-05-09 09:31:14,954] Making new env: Traffic-Simple-gui-v0
Traceback (most recent call last):
File "example_gym_traffic_dqn.py", line 51, in
main(sys.argv[1:])
File "example_gym_traffic_dqn.py", line 47, in main
example(args.gui)
File "example_gym_traffic_dqn.py", line 23, in example
train_env = gym.make('Traffic-Simple-gui-v0')
File "/usr/local/lib/python2.7/site-packages/gym/envs/registration.py", line 161, in make
return registry.make(id)
File "/usr/local/lib/python2.7/site-packages/gym/envs/registration.py", line 119, in make
env = spec.make()
File "/usr/local/lib/python2.7/site-packages/gym/envs/registration.py", line 86, in make
env = cls(**self._kwargs)
File "/Users/Lee/Downloads/Transportation/bstriner_Ben/gym-traffic-master/gym_traffic/envs/traffic_env_simple.py", line 19, in init
lanes=lanes, exitloops=exitloops)
File "/Users/Lee/Downloads/Transportation/bstriner_Ben/gym-traffic-master/gym_traffic/envs/traffic_env.py", line 53, in init
self.action_space = spaces.DiscreteToMultiDiscrete(
AttributeError: 'module' object has no attribute 'DiscreteToMultiDiscrete'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/local/lib/python2.7/site-packages/gym/utils/closer.py", line 67, in close
closeable.close()
File "/usr/local/lib/python2.7/site-packages/gym/core.py", line 167, in close
self.render(close=True)
File "/usr/local/lib/python2.7/site-packages/gym/core.py", line 153, in render
return self._render(mode=mode, close=close)
File "/Users/Lee/Downloads/Transportation/bstriner_Ben/gym-traffic-master/gym_traffic/envs/traffic_env.py", line 151, in _render
if self.viewer is not None:
AttributeError: 'TrafficEnvSimple' object has no attribute 'viewer'
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/local/lib/python2.7/site-packages/gym/utils/closer.py", line 67, in close
closeable.close()
File "/usr/local/lib/python2.7/site-packages/gym/core.py", line 167, in close
self.render(close=True)
File "/usr/local/lib/python2.7/site-packages/gym/core.py", line 153, in render
return self._render(mode=mode, close=close)
File "/Users/Lee/Downloads/Transportation/bstriner_Ben/gym-traffic-master/gym_traffic/envs/traffic_env.py", line 151, in _render
if self.viewer is not None:
AttributeError: 'TrafficEnvSimple' object has no attribute 'viewer'
Lee~/Downloads/Transportation/bstriner_Ben/gym-traffic-master/examples$
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.