[go: nahoru, domu]

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

[Bug]: ModuleNotFoundError: No module named 'stable_baselines3' in Google Colab? #1440

Closed
4 tasks done
windowshopr opened this issue Apr 11, 2023 · 4 comments
Closed
4 tasks done
Labels
bug Something isn't working colab Related to Google Colab Notebooks duplicate This issue or pull request already exists openai gym related to OpenAI Gym interface

Comments

@windowshopr
Copy link

🐛 Bug

Trying to get SB3 installed in a Colab notebook is proving to be quite challenging. Here's what I'm trying to run:

image

And here's the output:

!apt-get install ffmpeg freeglut3-dev xvfb  # For visualization
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ffmpeg is already the newest version (7:4.2.7-0ubuntu0.1).
The following additional packages will be installed:
  freeglut3 libfontenc1 libxfont2 libxkbfile1 x11-xkb-utils xfonts-base
  xfonts-encodings xfonts-utils xserver-common
The following NEW packages will be installed:
  freeglut3 freeglut3-dev libfontenc1 libxfont2 libxkbfile1 x11-xkb-utils
  xfonts-base xfonts-encodings xfonts-utils xserver-common xvfb
0 upgraded, 11 newly installed, 0 to remove and 24 not upgraded.
Need to get 7,895 kB of archives.
After this operation, 13.0 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 freeglut3 amd64 2.8.1-3 [73.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal/universe amd64 freeglut3-dev amd64 2.8.1-3 [124 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 libfontenc1 amd64 1:1.1.4-0ubuntu1 [14.0 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 libxfont2 amd64 1:2.0.3-1 [91.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main amd64 libxkbfile1 amd64 1:1.1.0-1 [65.3 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/main amd64 x11-xkb-utils amd64 7.7+5 [158 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/main amd64 xfonts-encodings all 1:1.0.5-0ubuntu1 [573 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 xfonts-utils amd64 1:7.7+6 [91.5 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 xfonts-base all 1:1.0.5 [5,896 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 xserver-common all 2:1.20.13-1ubuntu1~20.04.8 [27.2 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 xvfb amd64 2:1.20.13-1ubuntu1~20.04.8 [780 kB]
Fetched 7,895 kB in 3s (3,039 kB/s)
Selecting previously unselected package freeglut3:amd64.
(Reading database ... 122349 files and directories currently installed.)
Preparing to unpack .../00-freeglut3_2.8.1-3_amd64.deb ...
Unpacking freeglut3:amd64 (2.8.1-3) ...
Selecting previously unselected package freeglut3-dev:amd64.
Preparing to unpack .../01-freeglut3-dev_2.8.1-3_amd64.deb ...
Unpacking freeglut3-dev:amd64 (2.8.1-3) ...
Selecting previously unselected package libfontenc1:amd64.
Preparing to unpack .../02-libfontenc1_1%3a1.1.4-0ubuntu1_amd64.deb ...
Unpacking libfontenc1:amd64 (1:1.1.4-0ubuntu1) ...
Selecting previously unselected package libxfont2:amd64.
Preparing to unpack .../03-libxfont2_1%3a2.0.3-1_amd64.deb ...
Unpacking libxfont2:amd64 (1:2.0.3-1) ...
Selecting previously unselected package libxkbfile1:amd64.
Preparing to unpack .../04-libxkbfile1_1%3a1.1.0-1_amd64.deb ...
Unpacking libxkbfile1:amd64 (1:1.1.0-1) ...
Selecting previously unselected package x11-xkb-utils.
Preparing to unpack .../05-x11-xkb-utils_7.7+5_amd64.deb ...
Unpacking x11-xkb-utils (7.7+5) ...
Selecting previously unselected package xfonts-encodings.
Preparing to unpack .../06-xfonts-encodings_1%3a1.0.5-0ubuntu1_all.deb ...
Unpacking xfonts-encodings (1:1.0.5-0ubuntu1) ...
Selecting previously unselected package xfonts-utils.
Preparing to unpack .../07-xfonts-utils_1%3a7.7+6_amd64.deb ...
Unpacking xfonts-utils (1:7.7+6) ...
Selecting previously unselected package xfonts-base.
Preparing to unpack .../08-xfonts-base_1%3a1.0.5_all.deb ...
Unpacking xfonts-base (1:1.0.5) ...
Selecting previously unselected package xserver-common.
Preparing to unpack .../09-xserver-common_2%3a1.20.13-1ubuntu1~20.04.8_all.deb ...
Unpacking xserver-common (2:1.20.13-1ubuntu1~20.04.8) ...
Selecting previously unselected package xvfb.
Preparing to unpack .../10-xvfb_2%3a1.20.13-1ubuntu1~20.04.8_amd64.deb ...
Unpacking xvfb (2:1.20.13-1ubuntu1~20.04.8) ...
Setting up freeglut3:amd64 (2.8.1-3) ...
Setting up freeglut3-dev:amd64 (2.8.1-3) ...
Setting up libfontenc1:amd64 (1:1.1.4-0ubuntu1) ...
Setting up xfonts-encodings (1:1.0.5-0ubuntu1) ...
Setting up libxkbfile1:amd64 (1:1.1.0-1) ...
Setting up libxfont2:amd64 (1:2.0.3-1) ...
Setting up x11-xkb-utils (7.7+5) ...
Setting up xfonts-utils (1:7.7+6) ...
Setting up xfonts-base (1:1.0.5) ...
Setting up xserver-common (2:1.20.13-1ubuntu1~20.04.8) ...
Setting up xvfb (2:1.20.13-1ubuntu1~20.04.8) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for fontconfig (2.13.1-2ubuntu3) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
!pip3 install stable-baselines3[extra]
!pip3 install pyglet==1.4
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Collecting stable-baselines3[extra]
  Downloading stable_baselines3-1.8.0-py3-none-any.whl (174 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 174.5/174.5 kB 2.6 MB/s eta 0:00:00
Requirement already satisfied: numpy in /usr/local/lib/python3.9/dist-packages (from stable-baselines3[extra]) (1.22.4)
Requirement already satisfied: cloudpickle in /usr/local/lib/python3.9/dist-packages (from stable-baselines3[extra]) (2.2.1)
Collecting importlib-metadata~=4.13
  Downloading importlib_metadata-4.13.0-py3-none-any.whl (23 kB)
Requirement already satisfied: torch>=1.11 in /usr/local/lib/python3.9/dist-packages (from stable-baselines3[extra]) (2.0.0+cu118)
Collecting gym==0.21
  Downloading gym-0.21.0.tar.gz (1.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 23.9 MB/s eta 0:00:00
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Preparing metadata (setup.py) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Collecting pyglet==1.4
  Downloading pyglet-1.4.0-py2.py3-none-any.whl (1.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 13.9 MB/s eta 0:00:00
Requirement already satisfied: future in /usr/local/lib/python3.9/dist-packages (from pyglet==1.4) (0.18.3)
Installing collected packages: pyglet
Successfully installed pyglet-1.4.0
import stable_baselines3
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
[<ipython-input-3-97ebbd2a3a98>](https://localhost:8080/#) in <cell line: 1>()
----> 1 import stable_baselines3

ModuleNotFoundError: No module named 'stable_baselines3'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

To Reproduce

To reproduce, create a new Colab notebook, and run these commands

!apt-get install ffmpeg freeglut3-dev xvfb  # For visualization
!pip3 install stable-baselines3[extra]
!pip3 install pyglet==1.4
import stable_baselines3

Relevant log output / Error message

No response

System Info

No response

Checklist

  • I have checked that there is no similar issue in the repo
  • I have read the documentation
  • I have provided a minimal working example to reproduce the bug
  • I've used the markdown code blocks for both code and stack traces.
@windowshopr windowshopr added the bug Something isn't working label Apr 11, 2023
@windowshopr
Copy link
Author

It would appear Gym is having a tough time being installed as well, v0.21:

Collecting gym==0.21
  Downloading gym-0.21.0.tar.gz (1.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 23.9 MB/s eta 0:00:00
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Preparing metadata (setup.py) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

@araffin araffin added duplicate This issue or pull request already exists colab Related to Google Colab Notebooks openai gym related to OpenAI Gym interface labels Apr 11, 2023
@araffin
Copy link
Member
araffin commented Apr 11, 2023

Duplicate of #1406

@araffin araffin marked this as a duplicate of #1406 Apr 11, 2023
@araffin araffin closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2023
@windowshopr
Copy link
Author
windowshopr commented Apr 11, 2023

!pip3 install git+https://github.com/JY251/stable-baselines3.git

Maybe that could be updated somewhere in the docs for new people? All of those example workbooks seem to be outdated now...

@araffin
Copy link
Member
araffin commented Apr 11, 2023

Maybe that could be updated somewhere in the docs for new people? All of those example workbooks seem to be outdated now...

We're going to merge #1327 with master soon.

The two recommended options for now are:

pip install setuptools==66

(for gym 0.21)
or

pip install "sb3_contrib>=2.0.0a1" --upgrade

to have SB3 2.0 with gymnasium support
(the notebooks have been updated too and are ready to be merged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working colab Related to Google Colab Notebooks duplicate This issue or pull request already exists openai gym related to OpenAI Gym interface
Projects
None yet
Development

No branches or pull requests

2 participants