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

[Question] Failed to build box2d-py #1292

Closed
mariojerez opened this issue Jan 15, 2025 · 1 comment
Closed

[Question] Failed to build box2d-py #1292

mariojerez opened this issue Jan 15, 2025 · 1 comment
Labels
question Further information is requested

Comments

@mariojerez
Copy link

Question

I'm working on issue #1255. After making my changes in my forked repo, I followed the instructions on CONTRIBUTING.md. I tried running pytest --doctest-modules --doctest-continue-on-failure gymnasium. I had to install some dependencies. After successfully installing swig with pip install swig, I ran into issues when I ran pip install "gymnasium[box2d]". I got the error below.

From what I can tell, it's looking for swig in /Users/mariojerez/Documents/coding projects/gym_venv/bin/swig. When I run pip install swig again, it says already satisfied: swig in /Users/mariojerez/Documents/coding projects/gym_venv/lib/python3.11/site-packages (4.3.0). So, it's looking in the wrong place. For context, gym_venv is my virtual environment. I don't think I should have to change the location, and I'm wondering if others are running into this issue. Any recommendations for what I should do?

Requirement already satisfied: gymnasium[box2d] in /Users/mariojerez/Documents/coding projects/gym_venv/lib/python3.11/site-packages (1.0.0)
Requirement already satisfied: numpy>=1.21.0 in /Users/mariojerez/Documents/coding projects/gym_venv/lib/python3.11/site-packages (from gymnasium[box2d]) (2.2.1)
Requirement already satisfied: cloudpickle>=1.2.0 in /Users/mariojerez/Documents/coding projects/gym_venv/lib/python3.11/site-packages (from gymnasium[box2d]) (3.1.1)
Requirement already satisfied: typing-extensions>=4.3.0 in /Users/mariojerez/Documents/coding projects/gym_venv/lib/python3.11/site-packages (from gymnasium[box2d]) (4.12.2)
Requirement already satisfied: farama-notifications>=0.0.1 in /Users/mariojerez/Documents/coding projects/gym_venv/lib/python3.11/site-packages (from gymnasium[box2d]) (0.0.4)
Collecting box2d-py==2.3.5 (from gymnasium[box2d])
  Using cached box2d-py-2.3.5.tar.gz (374 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pygame>=2.1.3 in /Users/mariojerez/Documents/coding projects/gym_venv/lib/python3.11/site-packages (from gymnasium[box2d]) (2.6.1)
Requirement already satisfied: swig==4.* in /Users/mariojerez/Documents/coding projects/gym_venv/lib/python3.11/site-packages (from gymnasium[box2d]) (4.3.0)
Building wheels for collected packages: box2d-py
  Building wheel for box2d-py (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for box2d-py (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      /private/var/folders/01/3v19lss50jj4qp3fbmr3_73r0000gn/T/pip-build-env-iobhjq_7/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py:270: UserWarning: Unknown distribution option: 'test_suite'
        warnings.warn(msg)
      Using setuptools (version 75.8.0).
      running bdist_wheel
      running build
      running build_py
      creating build/lib.macosx-10.9-universal2-cpython-311/Box2D
      copying library/Box2D/Box2D.py -> build/lib.macosx-10.9-universal2-cpython-311/Box2D
      copying library/Box2D/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/Box2D
      creating build/lib.macosx-10.9-universal2-cpython-311/Box2D/b2
      copying library/Box2D/b2/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/Box2D/b2
      running build_ext
      building 'Box2D._Box2D' extension
      swigging Box2D/Box2D.i to Box2D/Box2D_wrap.cpp
      swig -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
      Traceback (most recent call last):
        File "/Users/mariojerez/Documents/coding projects/gym_venv/bin/swig", line 7, in <module>
          from swig import swig
      ModuleNotFoundError: No module named 'swig'
      error: command '/Users/mariojerez/Documents/coding projects/gym_venv/bin/swig' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for box2d-py
Failed to build box2d-py
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (box2d-py)```
@mariojerez mariojerez added the question Further information is requested label Jan 15, 2025
@mariojerez
Copy link
Author

I ended up getting it working. I noticed other people has similar issues in the past, but nothing was working, including solutions that had been proposed. It ended up working after I restarted VS Code. I tried a lot of things before that, so it's hard to say what actually resolved the issue. Maybe I just needed to restart VS Code from the start. Sorry about that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant