openai / gym

A toolkit for developing and comparing reinforcement learning algorithms.
https://www.gymlibrary.dev
Other
34.48k stars 8.59k forks source link

Attribute Error: module 'gym' has no attribute 'make' #535

Closed danwong closed 7 years ago

danwong commented 7 years ago

`import gym import universe # register the universe environments

env = gym.make('flashgames.DuskDrive-v0')

env.configure(remotes=1) # automatically creates a local docker container

observation_n = env.reset()

while True: action_n = [[('KeyEvent', 'ArrowUp', True)] for ob in observation_n] # your agent here observation_n, reward_n, done_n, info = env.step(action_n) env.render()` My current directory consists of a demo.py file readme, cloned gym, and cloned universe. I am just trying to run the sample code but I am getting this error.

File "demo.py", line 3, in env = gym.make('flashgames.DuskDrive-v0') AttributeError: module 'gym' has no attribute 'make'

Not sure what to do to fix this. I was just trying to verify that I set up the dependencies correctly.

hholst80 commented 7 years ago

How did you install gym?

danwong commented 7 years ago

I used sudo pip install -e .

tlbtlbtlb commented 7 years ago

You must have another file called gym.py or directory called gym which Python is finding instead of the installed gym. You can find out what Python is loading with

$ python
>>> import gym
>>> gym.__file__
danwong commented 7 years ago

Right now, I'm trying to just get universe to work. But when importing universe, I get this error.

Traceback (most recent call last): File "", line 1, in File "/Users/brehski/Downloads/universe/universe/init.py", line 22, in from universe import error, envs File "/Users/brehski/Downloads/universe/universe/envs/init.py", line 1, in import universe.envs.vnc_env File "/Users/brehski/Downloads/universe/universe/envs/vnc_env.py", line 11, in from universe.envs import diagnostics File "/Users/brehski/Downloads/universe/universe/envs/diagnostics.py", line 2, in import fastzbarlight File "/Users/brehski/anaconda3/lib/python3.6/site-packages/fastzbarlight/init.py", line 7, in from ._zbarlight import zbar_code_scanner ImportError: dlopen(/Users/brehski/anaconda3/lib/python3.6/site-packages/fastzbarlight/_zbarlight.cpython-36m-darwin.so, 2): Symbol not found: _iconv Referenced from: /Users/brehski/anaconda3/lib/python3.6/site-packages/fastzbarlight/_zbarlight.cpython-36m-darwin.so Expected in: flat namespace in /Users/brehski/anaconda3/lib/python3.6/site-packages/fastzbarlight/_zbarlight.cpython-36m-darwin.so

danwong commented 7 years ago

I was able to get gym to import correctly now though.

I think this issue is the same as https://github.com/openai/universe/issues/139 for universe. Not sure how to fix it 😨

hholst80 commented 7 years ago

I think the problem was that you used sudo install -e You should not use sudo with install -e

zhaolongkzz commented 5 years ago

I think that a py file named gym.py may be created in your workspace, this will conflict with gym package.

xiaopengfei9376 commented 5 years ago

I think you should run the 'gym.make' command in the gym directory. Try run 'cd gym' to change current directory and problem can be solved. Or you can add 'export PYTHONPATH=your installed gym directory: $PYTHONPATH' at the end of your ~/.bashrc file.

muzilify commented 5 years ago

I meet the same problem,can you tell me how do you solve this problem?