Currently, Box2D environments cannot be imported
env=gym.make('LunarLander-v2')
AttributeError: module 'gym.envs.box2d' has no attribute 'LunarLander'
env=gym.make('CarRacing-v0')
module 'gym.envs.box2d' has no attribute 'CarRacing'
Seems to be with the prelim version, installing full version with pip install 'gym[all]' solved it. Perhaps a warning would be helpful.
@sritee What python version you were using?
I think it was 2.7. I could import Box2D, but the environments wasn't working, which made it confusing.
Seems to be with the prelim version, installing full version with pip install 'gym[all]' solved it. Perhaps a warning would be helpful.
I tried this but i got a wheel error. Anyone knows how to solve this?
(...)
swig.exe -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library\Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D\Box2D_wrap.cpp Box2D\Box2D.i
error: command 'swig.exe' failed: No such file or directory
----------------------------------------
ERROR: Failed building wheel for box2d-py
I was able to get pip install gym[box2d] working on Windows 10 / Python 3.7.4 by downloading prebuilt swig (http://www.swig.org/download.html lacks HTTPS but links to https://sourceforge.net/projects/swig/ - never download prebuilt binaries over http!) and adding the extracted folder to %PATH%. Installation is able to find swig.exe and everything works fine after that.
Didn't solve my problem. Still getting wheel building error
Adding the directory containing prebuilt swig.exe to %PATH% fixed error: command 'swig.exe' failed: No such file or directory for me. If it's still complaining about not finding swig.exe, it means you didn't add it to %PATH% correctly. Is cmd.exe or powershell able to find swig?
C:\Users\thavlik>swig -version
SWIG Version 4.0.1
Compiled with i686-w64-mingw32-g++ [i686-w64-mingw32]
Configured options: +pcre
Please see http://www.swig.org for reporting bugs and further information
Adding the directory containing prebuilt swig.exe to %PATH% fixed
error: command 'swig.exe' failed: No such file or directoryfor me. If it's still complaining about not findingswig.exe, it means you didn't add it to %PATH% correctly. Is cmd.exe or powershell able to findswig?C:\Users\thavlik>swig -version SWIG Version 4.0.1 Compiled with i686-w64-mingw32-g++ [i686-w64-mingw32] Configured options: +pcre Please see http://www.swig.org for reporting bugs and further information
I'm having the same issue, I added the folder that was extracted to the path environment variable and yet it doesn't seem to be able to find swig, not even just swig -version works. Is extracting and adding the path the only steps needed for swig?
You might ensure you editing PATH under "System Variables" (the bottom section, not the top). You add the folder containing swig.exe. New command prompts should have access to swig.exe. Maybe you need to restart? Windows is strange
For me a simple pip install Box2D solved the issue (in contrast, pip install gym[all] didn't readily work on my machine (Ubuntu 16.04, Python 3.6)
For me a simple
pip install Box2Dsolved the issue (in contrast,pip install gym[all]didn't readily work on my machine (Ubuntu 16.04, Python 3.6)
This worked for me.
I was able to get
pip install gym[box2d]working on Windows 10 / Python 3.7.4 by downloading prebuilt swig (http://www.swig.org/download.html lacks HTTPS but links to https://sourceforge.net/projects/swig/ - never download prebuilt binaries over http!) and adding the extracted folder to %PATH%. Installation is able to find swig.exe and everything works fine after that.
Thanks. this fixed it.
I was able to get
pip install gym[box2d]working on Windows 10 / Python 3.7.4 by downloading prebuilt swig (http://www.swig.org/download.html lacks HTTPS but links to https://sourceforge.net/projects/swig/ - never download prebuilt binaries over http!) and adding the extracted folder to %PATH%. Installation is able to find swig.exe and everything works fine after that.Thanks. this fixed it.
====>>> Worked for me too on Ubuntu 20.04 LTS, python 3.8.5.
Most helpful comment
For me a simple
pip install Box2Dsolved the issue (in contrast,pip install gym[all]didn't readily work on my machine (Ubuntu 16.04, Python 3.6)