Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'module could not be found' when running gym.make for atari environment. #1726

Closed
razzzu opened this issue Oct 29, 2019 · 24 comments
Closed

Comments

@razzzu
Copy link

razzzu commented Oct 29, 2019

I solved this issue check the 3rd comment

when I run

gym.make('SpaceInvaders-v0')

I get the following TraceBack

OSError                                   Traceback (most recent call last)
<ipython-input-7-bd3516c22348> in <module>
----> 1 env = gym.make('SpaceInvaders-v0')

~\Anaconda3\lib\site-packages\gym\envs\registration.py in make(id, **kwargs)
    154 
    155 def make(id, **kwargs):
--> 156     return registry.make(id, **kwargs)
    157 
    158 def spec(id):

~\Anaconda3\lib\site-packages\gym\envs\registration.py in make(self, path, **kwargs)
     99             logger.info('Making new env: %s', path)
    100         spec = self.spec(path)
--> 101         env = spec.make(**kwargs)
    102         # We used to have people override _reset/_step rather than
    103         # reset/step. Set _gym_disable_underscore_compat = True on

~\Anaconda3\lib\site-packages\gym\envs\registration.py in make(self, **kwargs)
     70             env = self.entry_point(**_kwargs)
     71         else:
---> 72             cls = load(self.entry_point)
     73             env = cls(**_kwargs)
     74 

~\Anaconda3\lib\site-packages\gym\envs\registration.py in load(name)
     15 def load(name):
     16     mod_name, attr_name = name.split(":")
---> 17     mod = importlib.import_module(mod_name)
     18     fn = getattr(mod, attr_name)
     19     return fn

~\Anaconda3\lib\importlib\__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

~\Anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)

~\Anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)

~\Anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)

~\Anaconda3\lib\importlib\_bootstrap.py in _load_unlocked(spec)

~\Anaconda3\lib\importlib\_bootstrap_external.py in exec_module(self, module)

~\Anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

~\Anaconda3\lib\site-packages\gym\envs\atari\__init__.py in <module>
----> 1 from gym.envs.atari.atari_env import AtariEnv

~\Anaconda3\lib\site-packages\gym\envs\atari\atari_env.py in <module>
      7 
      8 try:
----> 9     import atari_py
     10 except ImportError as e:
     11     raise error.DependencyNotInstalled(

~\Anaconda3\lib\site-packages\atari_py\__init__.py in <module>
----> 1 from .ale_python_interface import *
      2 import os
      3 
      4 def _game_dir():
      5     return os.path.join(os.path.abspath(os.path.dirname(__file__)), "atari_roms")

~\Anaconda3\lib\site-packages\atari_py\ale_python_interface.py in <module>
     16 else:
     17     ale_lib = cdll.LoadLibrary(os.path.join(os.path.dirname(__file__),
---> 18                                             'ale_interface/ale_c.dll'))
     19 
     20 ale_lib.ALE_new.argtypes = None

~\Anaconda3\lib\ctypes\__init__.py in LoadLibrary(self, name)
    432 
    433     def LoadLibrary(self, name):
--> 434         return self._dlltype(name)
    435 
    436 cdll = LibraryLoader(CDLL)

~\Anaconda3\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    354 
    355         if handle is None:
--> 356             self._handle = _dlopen(self._name, mode)
    357         else:
    358             self._handle = handle

OSError: [WinError 126] The specified module could not be found

I Think i am missing a dependency or some file but i cannot figure out which it is. I have 'cmake' and i have installed the gym[atari] dependency. I can run the CartPole enviorment without any issues but cannot run any atari environments.

Requirement already satisfied: gym[atari] in c:\users\swifty\anaconda3\lib\site-packages (0.15.3) Requirement already satisfied: pyglet<=1.3.2,>=1.2.0 in c:\users\swifty\anaconda3\lib\site-packages (from gym[atari]) (1.3.2) Requirement already satisfied: six in c:\users\swifty\anaconda3\lib\site-packages (from gym[atari]) (1.12.0) Requirement already satisfied: numpy>=1.10.4 in c:\users\swifty\anaconda3\lib\site-packages (from gym[atari]) (1.16.4) Requirement already satisfied: cloudpickle~=1.2.0 in c:\users\swifty\anaconda3\lib\site-packages (from gym[atari]) (1.2.1) Requirement already satisfied: scipy in c:\users\swifty\anaconda3\lib\site-packages (from gym[atari]) (1.2.1) Requirement already satisfied: opencv-python; extra == "atari" in c:\users\swifty\anaconda3\lib\site-packages (from gym[atari]) (4.1.1.26) Requirement already satisfied: atari-py~=0.2.0; extra == "atari" in c:\users\swifty\anaconda3\lib\site-packages (from gym[atari]) (0.2.6) Requirement already satisfied: Pillow; extra == "atari" in c:\users\swifty\anaconda3\lib\site-packages (from gym[atari]) (6.1.0) Requirement already satisfied: future in c:\users\swifty\anaconda3\lib\site-packages (from pyglet<=1.3.2,>=1.2.0->gym[atari]) (0.17.1)

P.S. This is my first time posting on github so i am sorry if i am doing something wrong.

@christopherhesse
Copy link
Contributor

This looks like atari-py is somehow installed incorrectly. We don't officially support the windows binaries, but you can try uninstalling and reinstalling atari-py (make sure you're on windows 10).

If you can't run python -c 'import atari_py; print(atari_py.list_games())' then it's likely things are broken and you won't be able to make that environment.

@Rong-Tao
Copy link

Rong-Tao commented Nov 6, 2019

same problem. The ale_c.dll file is missing. And I checked the folder, it is indeed missing in the folder. which is specified the import. could you please provide the dll file?

@razzzu
Copy link
Author

razzzu commented Nov 7, 2019

I solved this problem.

  1. Uninstall gym and atari-py (If already installed):
    pip uninstall atari-py
    pip uninstall gym[atari]

  2. Download VS build tools here: https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16

  3. Run the VS build setup and select "C++ build tools" and install it.
    image

  4. Restart PC.

  5. Install cmake, atari-py and gym
    pip install cmake
    pip install atari-py
    pip install gym[atari]

  6. Now run the following code:
    import atari_py
    print(atari_py.list_games())

and if everything worked then it should return a list of all games as shown below

['adventure', 'air_raid', 'alien', 'amidar', 'assault', 'asterix', 'asteroids', 'atlantis', 'bank_heist', 'battle_zone', 'beam_rider', 'berzerk', 'bowling', 'boxing', 'breakout', 'carnival', 'centipede', 'chopper_command', 'crazy_climber', 'defender', 'demon_attack', 'double_dunk', 'elevator_action', 'enduro', 'fishing_derby', 'freeway', 'frostbite', 'gopher', 'gravitar', 'hero', 'ice_hockey', 'jamesbond', 'journey_escape', 'kaboom', 'kangaroo', 'krull', 'kung_fu_master', 'montezuma_revenge', 'ms_pacman', 'name_this_game', 'phoenix', 'pitfall', 'pong', 'pooyan', 'private_eye', 'qbert', 'riverraid', 'road_runner', 'robotank', 'seaquest', 'skiing', 'solaris', 'space_invaders', 'star_gunner', 'tennis', 'time_pilot', 'tutankham', 'up_n_down', 'venture', 'video_pinball', 'wizard_of_wor', 'yars_revenge', 'zaxxon']

@JUZI1
Copy link

JUZI1 commented Mar 9, 2020

oooo you are so cool !!

@bode135
Copy link

bode135 commented Apr 8, 2020

Thank u !!!! very cool!!!!!!!!!!!

@chenranhuang
Copy link

cool! Thank you very much!

@delphinidae32
Copy link

it worked!! thank you so much :D

@Arjunsekar
Copy link

thank you

@tylerhnothing
Copy link

Dude thank you so much for posting the steps you took to fix this. This worked perfectly and I'm so excited to play with this.

@MoeinR69
Copy link

MoeinR69 commented Jul 8, 2020

thank you so much

@weiguowilliam
Copy link

thank u!

@Ze1598
Copy link

Ze1598 commented Aug 27, 2020

Thanks @razzzu got it working by following your instructions

@imdeep2905
Copy link

If anyone is facing issue like ...ale_c.dll' (or one of its dependencies). Try using the full path with constructor syntax. and can't fix with the steps described in the comment above, checkout this.

@sparshgarg23
Copy link

imdeep 2905,thanks for the suggestion,I was facing the same issue.
On a sidenote,it would be better if OpenAI could make sure their relase was stable and interoperable on all platforms.

@XyuQian
Copy link

XyuQian commented Dec 8, 2020

thank u so much~ it works perfectly well!

@hudsontek
Copy link

If anyone is facing issue like ...ale_c.dll' (or one of its dependencies). Try using the full path with constructor syntax. and can't fix with the steps described in the comment above, checkout this.

After doing all steps mentioned by razzzu, the problem still exists. This worked for me! Thanks!

@heartInsert
Copy link

Thanks,bro.

@Lifedecoder
Copy link

cool, thanks!

@RezaKakooee
Copy link

so cool. works for me too. many thanks !

@changfyg
Copy link

changfyg commented Mar 25, 2021

It's an amazing solution by Razzzu. It works perfectly. What a saver. Many hugs and thank you very much
👍 💯

@luiseia
Copy link

luiseia commented May 7, 2021

万分感谢

@KaiHong1015
Copy link

wtf bro it works for me haha, ty so much!!!

@changfyg
Copy link

changfyg commented May 14, 2021 via email

@Katherinaxxx
Copy link

I solved the problem by
conda install -c conda-forge atari_py

@openai openai locked as resolved and limited conversation to collaborators Jan 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests