Could not find module \atari_py\ale_interface\ale_c.dll (or one of its dependencies)
Asked Answered
F

6

9

I'm trying to work with the openai gym module but I get this error:

>>> import atari_py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\ssit5\AppData\Local\Programs\Python\Python38\lib\site-packages\atari_py\__init__.py", line 1, in <module>
    from .ale_python_interface import *
  File "C:\Users\ssit5\AppData\Local\Programs\Python\Python38\lib\site-packages\atari_py\ale_python_interface.py", line 17, in <module>
    ale_lib = cdll.LoadLibrary(os.path.join(os.path.dirname(__file__),
  File "C:\Users\ssit5\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 451, in LoadLibrary
    return self._dlltype(name)
  File "C:\Users\ssit5\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\ssit5\AppData\Local\Programs\Python\Python38\lib\site-packages\atari_py\ale_interface\ale_c.dll' (or one of its dependencies). Try using the full path with constructor syntax.

I don't have an ale_c.dll and tried finding solutions but nothing worked. I followed the solution here https://github.com/openai/gym/issues/1726 but when trying to import atari_py it comes up with the same error. I don't see why the __init__ would search for something that didn't come with the module either. There were other StackOverflow questions that I looked at but they also yielded no results. The only solution I can think of is to get a copy of ale_c.dll but I don't know how I would get it.

Franklynfrankness answered 24/7, 2020 at 19:30 Comment(0)
O
15

I was facing the same error. Fortunately, I was able to find one workaround. Follow this steps and you should be good to go.

  1. Download ale_c.dll from here.
  2. Copy it in C:\Users\Deep Raval\AppData\Local\Programs\Python\Python38\Lib\site-packages\atari_py\ale_interface (Your path can be different).
Odd answered 28/9, 2020 at 14:39 Comment(4)
That does the trick, but where does that DLL come from? Should there be an 'official' source to go and get it?Eyeshot
This error occurred when I was setting up gym on my new laptop. I tried to find official distribution of dll but couldn't find any. That's why here's the link of dll find which was present in my old laptop.Odd
I would not recommend this, downloading executable code from someone's personal google drive is a very bad idea and could contain malicious code.Helyn
Yup, you're absolutely right. But as long as there's no official fix available you can use above link. I can guarantee that it doesn't contain any malicious things.Odd
S
5

Try to download arari-py package from conda

conda install -c conda-forge atari_py

this will fix your problem even if you are using Python > 3.7

Sanguineous answered 4/8, 2021 at 17:28 Comment(0)
S
4

For anybody else in the future, my problem was that I got the same error but I already had the ale_c.dll file in the right folder.

I followed a solution on this link --> https://github.com/openai/gym/issues/1726

Schouten answered 14/7, 2021 at 19:58 Comment(0)
C
3

I have tried to make it work with python 3.8 and 3.9 on Windows 10. Installing Python 3.7 and using it as the Python Interpreter on PyCharm resolved the issue. I have searched for the missing file while having 3.8 + version of Python and it did not exist at all. Atari-py is supported only for Python 3.7 (https://github.com/openai/atari-py) so having a higher version of that would not work. It is a bad idea to download files from unlicensed places so I advise you to install the supported version of Python (3.5, 3.6, and 3.7). Even though gym can work on 3.9 the atari version will not.

Just an update because gym 0.21.0 came out which supports ale-py and no longer uses atari-py (so any game marked v0 - v4 will no longer work if you use gym 0.21.0 and ale-py (which is supposed to come with gym). Make sure when you install your libraries that they are actually compatible. Link to new version of gym https://brosa.ca/blog/ale-release-v0.7. When running v5 I do manage to render the game but I cannot find the other supported games. If you use gym 0.21.0 you will not need atari-py (atari_py). From the example:

import gym

env = gym.make('ALE/Breakout-v5',
    obs_type='rgb',                   # ram | rgb | grayscale
    frameskip=5,                     # frame skip
    mode=0,                           # game mode, see Machado et al. 2018
    difficulty=0,                     # game difficulty, see Machado et al. 2018
    repeat_action_probability=0.25,   # Sticky action probability
    full_action_space=True,           # Use all actions
    render_mode=None                  # None | human | rgb_array
)

it does actually run but the game is broken even in older versions of gym.

What I managed to get working after trying various python, gym and atari-py versions is: enter image description here

Califate answered 15/5, 2021 at 15:43 Comment(0)
P
1

I would suggest to the downloade the wheel file for you Windows and Python version from here: https://pypi.org/simple/atari-py/

and then execute pip install on this file like:

pip install atari_py-0.2.9-cp39-cp39-win_amd64.whl

This one helped for me (solution from github seems much much better, but it was not working for me - maybe because of venv? ) - for me it's a more safe solution than downloading a .dll from google drive.

Peephole answered 4/9, 2021 at 11:57 Comment(0)
L
-2

This is a problem that you may face when using Windows.

Uninstall and reinstall atari using:

pip install -f https://github.com/Kojoley/atari-py/releases atari_py 
Lory answered 11/12, 2020 at 1:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.