Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems pip installing Box2D

Tags:

python

I'm learning Reinforcement learning and I'm having the following errors.

Error(1) = I can't set up the 'CarRacing-v0' gym environment without Box2D

Error(2) = I can't pip install the Box2D module.

Does someone know how to interpret these errors and help me fix this?


enter image description here

enter image description here

Edit:

When trying to pip install box2d-py I get this error:

enter image description here

like image 816
Oliver G Avatar asked Aug 12 '18 17:08

Oliver G


People also ask

Can not install with pip?

A “pip: command not found” error occurs when you fail to properly install the package installer for Python (pip) needed to run Python on your computer. To fix it, you will either need to re-install Python and check the box to add Python to your PATH or install pip on your command line.

What is the E flag for pip install?

The -e flag makes it an “editable” install, leaving the source code in place and allowing you to modify it if desired. (Otherwise, by default, pip would move the python code to some site-packages directory and delete everything else.)

What is legacy install failure?

Check if your Python version is supported by the package # The "error: legacy-install-failure" is sometimes caused when the package you are trying to install doesn't have available wheels for your version of Python. You can check your Python version with the python --version command.


1 Answers

Windows users need to do as follows:

  • Download SWIG with the prebuilt executable and extract somewhere on your PC. Please note: I don't think SWIG 4.0 is compatible with Box2D yet, at time of writing SWIG 3.0.12 must be used.
  • Add the SWIG directory containing swig.exe to system PATH environment variable.
  • Install Microsoft Visual C++ 14.0. Get it with "Microsoft Visual C++ Build Tools".
  • pip install box2d
  • pip install box2d-py
like image 83
BigBadMe Avatar answered Sep 17 '22 14:09

BigBadMe