gym icon indicating copy to clipboard operation
gym copied to clipboard

[Question] stucking when running pip install `gym[accept-rom-license]==0.21.0`

Open maguro27 opened this issue 2 years ago • 60 comments

Question

The pip install gym[accept-rom-license] script stucks after getting the message Building wheel for AutoROM.accept-rom-license (pyproject.toml) ... -.

How can I solve it?

Entire messages

$ pip install gym[accept-rom-license]
Requirement already satisfied: gym[accept-rom-license] in /mydir/anaconda3/envs/iris/lib/python3.8/site-packages (0.21.0)
Requirement already satisfied: cloudpickle>=1.2.0 in/mydir/anaconda3/envs/iris/lib/python3.8/site-packages (from gym[accept-rom-license]) (2.2.0)
Requirement already satisfied: numpy>=1.18.0 in /mydir/anaconda3/envs/iris/lib/python3.8/site-packages (from gym[accept-rom-license]) (1.24.1)
Collecting autorom[accept-rom-license]~=0.4.2
  Using cached AutoROM-0.4.2-py3-none-any.whl (16 kB)
Requirement already satisfied: click in /mydir/anaconda3/envs/iris/lib/python3.8/site-packages (from autorom[accept-rom-license]~=0.4.2->gym[accept-rom-license]) (8.1.3)
Requirement already satisfied: importlib-resources in /mydir/anaconda3/envs/iris/lib/python3.8/site-packages (from autorom[accept-rom-license]~=0.4.2->gym[accept-rom-license]) (5.10.2)
Requirement already satisfied: tqdm in /mydir/anaconda3/envs/iris/lib/python3.8/site-packages (from autorom[accept-rom-license]~=0.4.2->gym[accept-rom-license]) (4.62.3)
Requirement already satisfied: requests in /mydir/anaconda3/envs/iris/lib/python3.8/site-packages (from autorom[accept-rom-license]~=0.4.2->gym[accept-rom-license]) (2.28.1)
Collecting AutoROM.accept-rom-license
  Using cached AutoROM.accept-rom-license-0.5.0.tar.gz (10 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting libtorrent
  Using cached libtorrent-2.0.7-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (8.6 MB)
Requirement already satisfied: zipp>=3.1.0 in /mydir/anaconda3/envs/iris/lib/python3.8/site-packages (from importlib-resources->autorom[accept-rom-license]~=0.4.2->gym[accept-rom-license]) (3.11.0)
Requirement already satisfied: charset-normalizer<3,>=2 in /mydir/anaconda3/envs/iris/lib/python3.8/site-packages (from requests->autorom[accept-rom-license]~=0.4.2->gym[accept-rom-license]) (2.1.1)
Requirement already satisfied: certifi>=2017.4.17 in /mydir/anaconda3/envs/iris/lib/python3.8/site-packages (from requests->autorom[accept-rom-license]~=0.4.2->gym[accept-rom-license]) (2022.12.7)
Requirement already satisfied: idna<4,>=2.5 in /mydir/anaconda3/envs/iris/lib/python3.8/site-packages (from requests->autorom[accept-rom-license]~=0.4.2->gym[accept-rom-license]) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /mydir/anaconda3/envs/iris/lib/python3.8/site-packages (from requests->autorom[accept-rom-license]~=0.4.2->gym[accept-rom-license]) (1.26.13)
Building wheels for collected packages: AutoROM.accept-rom-license
  Building wheel for AutoROM.accept-rom-license (pyproject.toml) ... -

Thanks.

maguro27 avatar Jan 09 '23 04:01 maguro27

Hiya, could we get more information about your setup? What operating system, python version?

jjshoots avatar Jan 09 '23 19:01 jjshoots

I'm experiencing the same issue on Ubuntu 20.04.5 LTS, python 3.8.10, with the following minimal setup:

> python3 -m venv testenv
> source testenv/bin/activate
> pip install --upgrade pip
> pip install gym[accept-rom-license]

which results in the following output (freezing on the last line)

Collecting gym[accept-rom-license]
  Using cached gym-0.26.2-py3-none-any.whl
Collecting importlib-metadata>=4.8.0
  Using cached importlib_metadata-6.0.0-py3-none-any.whl (21 kB)
Collecting gym-notices>=0.0.4
  Using cached gym_notices-0.0.8-py3-none-any.whl (3.0 kB)
Collecting cloudpickle>=1.2.0
  Using cached cloudpickle-2.2.0-py3-none-any.whl (25 kB)
Collecting numpy>=1.18.0
  Using cached numpy-1.24.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)
Collecting autorom[accept-rom-license]~=0.4.2
  Using cached AutoROM-0.4.2-py3-none-any.whl (16 kB)
Collecting click
  Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting importlib-resources
  Using cached importlib_resources-5.10.2-py3-none-any.whl (34 kB)
Collecting requests
  Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting tqdm
  Using cached tqdm-4.64.1-py2.py3-none-any.whl (78 kB)
Collecting AutoROM.accept-rom-license
  Using cached AutoROM.accept-rom-license-0.5.0.tar.gz (10 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting zipp>=0.5
  Using cached zipp-3.11.0-py3-none-any.whl (6.6 kB)
Collecting libtorrent
  Using cached libtorrent-2.0.7-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (8.6 MB)
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.13-py2.py3-none-any.whl (140 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting charset-normalizer<3,>=2
  Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Building wheels for collected packages: AutoROM.accept-rom-license
  Building wheel for AutoROM.accept-rom-license (pyproject.toml) ... -

vmichals avatar Jan 09 '23 20:01 vmichals

same here on Rocky Linux, conda Python 3.9.15

lcebaman avatar Jan 10 '23 12:01 lcebaman

I've been going through the same, no loading for the autorom.accept-rom-license on my sagemaker instance

OS: Amazon Linux 2 python: 3.7.12 pip: 22.3.1

TakeshiJay avatar Jan 10 '23 15:01 TakeshiJay

@jjshoots Thank you for getting back to me. My environment is as follows,

OS: CentOS 7.5 and Red Hat Enterprise Linux 8.2 virtual env: anaconda 4.10.3 python: 3.8 pip: 22.3.1

maguro27 avatar Jan 10 '23 15:01 maguro27

This is weird error, could you try with --verbose, pip install gym[accept-rom-license] --verbose

pseudo-rnd-thoughts avatar Jan 10 '23 16:01 pseudo-rnd-thoughts

I am also having the same problem, I tried the command 'pip install gym[accept-rom-license] --verbose', but the installation got stuck in running install_scripts.

Running command Building wheel for AutoROM.accept-rom-license (pyproject.toml) C:\Users\neiju\AppData\Local\Temp\pip-build-env-68wjugte\overlay\Lib\site-packages\setuptools\config\setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead. warnings.warn(msg, warning_class) running bdist_wheel running build running build_py creating build creating build\lib copying AutoROM.py -> build\lib installing to build\bdist.win-amd64\wheel running install running install_lib creating build\bdist.win-amd64 creating build\bdist.win-amd64\wheel copying build\lib\AutoROM.py -> build\bdist.win-amd64\wheel. running install_egg_info running egg_info writing AutoROM.accept_rom_license.egg-info\PKG-INFO writing dependency_links to AutoROM.accept_rom_license.egg-info\dependency_links.txt writing requirements to AutoROM.accept_rom_license.egg-info\requires.txt writing top-level names to AutoROM.accept_rom_license.egg-info\top_level.txt reading manifest file 'AutoROM.accept_rom_license.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE.txt' writing manifest file 'AutoROM.accept_rom_license.egg-info\SOURCES.txt' Copying AutoROM.accept_rom_license.egg-info to build\bdist.win-amd64\wheel.\AutoROM.accept_rom_license-0.5.0-py3.9.egg-info running install_scripts

This is weird error, could you try with --verbose, pip install gym[accept-rom-license] --verbose

neijunior1995 avatar Jan 10 '23 18:01 neijunior1995

I haven't been able to solve this locally Could you run

pip install autorom
AutoROM --accept-license

Does the first stage work to pip install autorom.

pseudo-rnd-thoughts avatar Jan 10 '23 22:01 pseudo-rnd-thoughts

AutoROM still gets stuck during the AutoROM --accept-license. Also it does work installing autorom

TakeshiJay avatar Jan 10 '23 23:01 TakeshiJay

Would you be able to download the project (https://github.com/Farama-Foundation/AutoROM) Then run src/autorom.py. If this hangs then could you identify the line where it hangs

pseudo-rnd-thoughts avatar Jan 11 '23 00:01 pseudo-rnd-thoughts

It hangs in the function torrent_tar_to_buffer() starting on line 159

while handle.status().state != 5: time.sleep(1)

TakeshiJay avatar Jan 11 '23 00:01 TakeshiJay

That is very helpful, we will hopefully make a release tomorrow that will add a timeout to the while loop to prevent it looping forever. It would seem from the comment that the system is always seeding and never changes to download. I suspect there might be something wrong with our torrent server.

pseudo-rnd-thoughts avatar Jan 11 '23 01:01 pseudo-rnd-thoughts

@TakeshiJay Sorry this took longer than expected. We have made a new release for AutoROM, (the software used to download the rooms) with a couple of changes with more bug fixes to try and identify the cause of the issues.

https://pypi.org/project/AutoROM/ You can install through pip install --upgrade AutomROM then AutoROM --accept-license

pseudo-rnd-thoughts avatar Jan 13 '23 22:01 pseudo-rnd-thoughts

@pseudo-rnd-thoughts Getting this error after running the AutoROM --accept-license Screenshot 2023-01-13 182503

TakeshiJay avatar Jan 14 '23 02:01 TakeshiJay

I got another message in the final traceback.

File "/mydir/anaconda3/envs/iris/lib/python3.8/site-packages/AutoROM/AutoROM.py", line 188, in torrent_tar_to_buffer
    print(f"time={timeit}/20 seconds - Trying to download atari roms, "
TypeError: get() takes no keyword arguments

maguro27 avatar Jan 14 '23 02:01 maguro27

I got another message in the final traceback.

File "/mydir/anaconda3/envs/iris/lib/python3.8/site-packages/AutoROM/AutoROM.py", line 188, in torrent_tar_to_buffer
    print(f"time={timeit}/20 seconds - Trying to download atari roms, "
TypeError: get() takes no keyword arguments

same

xzqxnet0990 avatar Jan 14 '23 02:01 xzqxnet0990

Same problem here, I tried all the options, nothing seems to work. I use Google Colab PRO.

The weird thing is that a nootebook that i wrote weeks ago successfully runs the following commands, while a new notebook fails: !pip install gym[atari,accept-rom-license] !pip install stable-baselines3[extra]

Looking forward to a solution

217c avatar Jan 14 '23 16:01 217c

Same problem on Google Colab for me. Running Ubuntu 18.04 and python 3.8.16. I have also tried all the options.

jucamohedano avatar Jan 14 '23 18:01 jucamohedano

Ok, I suspect that the issue is with the torrent seeding server as it has a relatively small number of available download slots. Therefore, if there is a large amount of traffic this might cause issue for users. I would try downloading 5 minutes later otherwise there might be an unknown issue

@TakeshiJay We have fixed the bug and there should be more debug data printed every 5 seconds. @everyone pip install --upgrade AutoROM AutoROM --accept-license

Additionally, sorry about the slow fix for this, everyone who works on this project currently is a volunteer and currently, the team is very busy with the rest of their lives (PhD viva deadline this week, IJCAI submission deadline this week, visiting family around the world)

pseudo-rnd-thoughts avatar Jan 14 '23 21:01 pseudo-rnd-thoughts

Today everything works just fine, I didn't even need to run --upgrade AutoROM.

217c avatar Jan 15 '23 11:01 217c

I'm unsure if this is exactly related, but I'm encountering a similar issue when attempting to install stable-baselines3. I followed the advice to install OpenSSL from the link, and installed Win64 OpenSSL v3.0.7, however even after a restart it didn't seem to make a difference. perhaps I need to make changes to my path or something?

image

joeagriffith avatar Jan 17 '23 16:01 joeagriffith

Its seems like libtorrent is not installed, do you get an error when you run pip install libtorrent then import libtorrent in python?

pseudo-rnd-thoughts avatar Jan 17 '23 17:01 pseudo-rnd-thoughts

Ah yes ofcourse. Turns out I do have libtorrent installed but its having trouble linking. I'll look for a suitable fix.

joeagriffith avatar Jan 17 '23 20:01 joeagriffith

OK I had the same error with libtorrent linking as joeagriffith and found two maybe solutions:

  1. go to the shady website prompted by the terminal. I reluctantly did this and it worked after installing, rebooting, and entering: pip install gym[accept-rom-license]==0.21.0.
  2. for whatever reason this only worked from pip and not pip3.8. At this point, I'm not sure if the shady website or switching to pip from pip3.8 was the solution. I used python3.8 in the past for my repo simply because it was tried and true, but everything seems to be running fine on whatever the new version of python is. So older Python versions could also be the problem.

WreckItTim avatar Jan 19 '23 06:01 WreckItTim

Still not working here:

$ AutoROM --accept-license
AutoROM will download the Atari 2600 ROMs.
They will be installed to:
	/home/users/test/miniconda3/lib/python3.9/site-packages/AutoROM/roms

Existing ROMs will be overwritten.
time=1.0/60 seconds - Trying to download atari roms
	current status=downloading metadata (downloading_metadata)
	total downloaded bytes=0
	total payload download=0
	total failed bytes=0
time=2.0/60 seconds - Trying to download atari roms
	current status=downloading metadata (downloading_metadata)
	total downloaded bytes=0
	total payload download=0
	total failed bytes=0

lcebaman avatar Jan 20 '23 10:01 lcebaman

I suspect the torrent URL isn't working on some machines. I overcame this problem by manually downloading the Roms.tar.gz file and placing the ROMs where they are expected, then setting success: bool = True in AutoROM.py. Unfortunately, many packages depend on this one and will always try to overwrite the ROMs, could this be fixed from the source? I understand that if ROMs are already in place there is no need to overwrite them.

lcebaman avatar Jan 20 '23 11:01 lcebaman

@lcebaman That is very annoying. To avoid spamming this issue, would you be able to join our discord server (https://discord.gg/bnJ6kubTg6) and @jjshoots and myself can see if we can find a solution.

Yes, we will implement the change to not need to download the ROM if it is already installed

pseudo-rnd-thoughts avatar Jan 21 '23 19:01 pseudo-rnd-thoughts

Hi @pseudo-rnd-thoughts, thanks for your work! I'm experiencing the same problem pointed out by @lcebaman, are there any updates on this?

fedeceola avatar Jan 26 '23 13:01 fedeceola

Same problem here, I tried all the options, nothing seems to work. I use Google Colab PRO.

The weird thing is that a nootebook that i wrote weeks ago successfully runs the following commands, while a new notebook fails: !pip install gym[atari,accept-rom-license] !pip install stable-baselines3[extra]

Looking forward to a solution

Hey Ya. I ran into this problem myself and found the following solution:

  1. We need to upgrade pip python.exe -m pip install --upgrade pip (for Python)
  2. Install two packages (I needed for Windows) OpenSSL a) OpenSSL v3.0.7 b) OpenSSL v1.1.1S
  3. Install the libtorrent package (I did it in Pycharm via Settings)
  4. Run the commands in sequence: a) pip install autorom b) AutoROM --accept-license (here you have to wait a few minutes until the message "Done!" appears)

After these steps I was able to install stable-baselines3[extra] (And I installed the stable-baselines3 package without any problems) Hope my solution helps. I use Python 3.10

For those who will work with stable-baselines3[extra] I want to give advice, replace gym with gymnasium, and if there are problems in the code, refer to this guide. Also for those who use Jupyter Notebook install ipywidgets (I did it through Notebook itself !pip install ipywidgets)

2rbo4n avatar Jan 31 '23 15:01 2rbo4n

@fedeceola Hey, sorry we are unsure on the issue. Could you provide us some information on your computer? Python version? OS? etc and also general information on what network type you are downloading it on. As it requires torrenting then we suspect there might be issues when downloading on certain networks that disable / disallow it.

pseudo-rnd-thoughts avatar Jan 31 '23 17:01 pseudo-rnd-thoughts