error when trying to import gym_miniworld on Google Colab
See original GitHub issueBefore, I had no problems in running minigrid
over Colab, however I have tried several options in order to run Miniworld
over Colab but have not succeeded. At the beginning of my Colab notebook, I first install the following libraries:
!pip install rarfile --quiet
!pip install stable-baselines3 > /dev/null
!pip install box2d-py > /dev/null
!pip install gym pyvirtualdisplay > /dev/null 2>&1
!sudo apt-get install -y xvfb python-opengl ffmpeg > /dev/null 2>&1
!pip install gym-miniworld > /dev/null 2>&1
Then, the error appears right when importing the libraries:
import gym
import gym_miniworld
The error I get is the following:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
[<ipython-input-13-7f542eec6530>](https://fv0dqg4ruxm-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20220224-060059-RC00_430667398#) in <module>()
1 import gym
----> 2 import gym_miniworld
3 frames
[/usr/local/lib/python3.7/dist-packages/pyglet/gl/__init__.py](https://fv0dqg4ruxm-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20220224-060059-RC00_430667398#) in <module>()
233 elif compat_platform == 'darwin':
234 from .cocoa import CocoaConfig as Config
--> 235 del base # noqa: F821
236
237
NameError: name 'base' is not defined
Any suggestion on how to handle this? Many thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Googel Colab: Can't import py or ipynb file from Google Drive ...
I am writing some code for a project in Google Colab which requires importing various functions and classes from other .py files.
Read more >Unable to import module in Google Colab after installing #42
Hello, I need your help please , I'm working with google colab and I got an error: No module named 'reco_utils' ? I...
Read more >Google Colab — The Beginner's Guide | by Vishakha Lall
This command outputs the folders /content and /drive (if it has been mounted). Run the following snippet to change the current folder. import...
Read more >7 ways to load external data into Google Colab | by B. Chen
You can import files module from google.colab . Then call upload() to launch a “File Upload” dialog and select the file(s) you wish...
Read more >Ways to import CSV files in Google Colab - GeeksforGeeks
You will see a screen with “Google Cloud SDK wants to access your Google Account” at the top. After you allow permission, copy...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve been able to get around this by first adding your code to a script, and then executing on Colab as:
!xvfb-run -a -s “-screen 0 1024x768x24 -ac +extension GLX +render -noreset” python3 script_name.py
(there may be other ways too).
I updated the readme to make it clearer that this is needed to run on Colab and on clusters 👍