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 Report] Simple install with [all] option fails without swig #881

Closed
kwinkunks opened this issue Jan 15, 2024 · 1 comment
Closed

[Bug Report] Simple install with [all] option fails without swig #881

kwinkunks opened this issue Jan 15, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@kwinkunks
Copy link

Describe the bug

The README says

use pip install "gymnasium[all]" to install all dependencies

But I think running pip install "gymnasium[all]" in a clean Conda environment (with Python 3.11) fails without install swig first, because box2d-py will not build without it.

I guess the problem lies with the box2d project, who should specify that it is required in their build process, but possibly the README be updated to reflect this requirement?

Similar to #735 and #632, but for [all] option, not [box2d].

Not sure how best to proceed, so won't make a PR.

Code example

conda create -n foo Python=3.11

Then, when complete:

conda activate foo
pip install "gymnasium[all]"

Results in (eventually):

Building wheels for collected packages: box2d-py, moviepy
  Building wheel for box2d-py (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      Using setuptools (version 69.0.3).
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-x86_64-cpython-311
      creating build/lib.macosx-10.9-x86_64-cpython-311/Box2D
      copying library/Box2D/Box2D.py -> build/lib.macosx-10.9-x86_64-cpython-311/Box2D
      copying library/Box2D/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-311/Box2D
      creating build/lib.macosx-10.9-x86_64-cpython-311/Box2D/b2
      copying library/Box2D/b2/__init__.py -> build/lib.macosx-10.9-x86_64-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
      error: command 'swig' failed: No such file or directory
      [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
  Running setup.py clean for box2d-py
  Building wheel for moviepy (setup.py) ... done
  Created wheel for moviepy: filename=moviepy-1.0.3-py3-none-any.whl size=110720 sha256=a56f6896b944860e0e19c40ca9e48b0043718c3bf13cd9c319ea9374c1761440
  Stored in directory: /Users/MTHA/Library/Caches/pip/wheels/83/b1/d9/119ef7c144b44d591ec0a9a140465133c23ea95d2a161184ba
Successfully built moviepy
Failed to build box2d-py
ERROR: Could not build wheels for box2d-py, which is required to install pyproject.toml-based projects

Running pip install swig first solves the issue.



### System info

Installing with `[all]` option using `pip`.

Gymnasium v0.29.1, MacOS v14.1.1, Python v3.11.7.

### Additional context

Thank you for maintaining this project!

### Checklist

- [X] I have checked that there is no similar [issue](https://github.com/Farama-Foundation/Gymnasium/issues) in the repo
@kwinkunks kwinkunks added the bug Something isn't working label Jan 15, 2024
@kir0ul
Copy link
Contributor

kir0ul commented Jan 15, 2024

The strange thing is that [all] should already install Swig: https://github.com/Farama-Foundation/Gymnasium/blob/main/pyproject.toml#L63. Same for [box2d]: https://github.com/Farama-Foundation/Gymnasium/blob/main/pyproject.toml#L39. Maybe there's an issue of chronological order, like Swig needs to be installed before building the box2d wheel? 🤔

But conda install "gymnasium[all]" seems to work seamlessly, maybe it should be added to the README as well?
(Indeed AFAIK, when possible, it's recommended to avoid mixing Pip and Conda packages: https://www.anaconda.com/blog/using-pip-in-a-conda-environment.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants