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] Building wheel for gym (setup.py) ... error #3202

Open
wbc23 opened this issue Mar 29, 2023 · 10 comments
Open

[Bug Report] Building wheel for gym (setup.py) ... error #3202

wbc23 opened this issue Mar 29, 2023 · 10 comments

Comments

@wbc23
Copy link

wbc23 commented Mar 29, 2023

Describe the bug
Building wheel for gym (setup.py) ... error

System Info
My python version is 3.7.3,My linux version is Ubuntu18.04

The bug info is:
Building wheels for collected packages: gym
Building wheel for gym (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [481 lines of output]

Traceback (most recent call last):
File "", line 36, in
File "", line 34, in
File "/tmp/pip-install-ghwoed05/gym_e92a96bf7ac54dd59edd31213e4aa557/setup.py", line 74, in
"Programming Language :: Python :: 3.9",
File "/usr/local/python3.7/lib/python3.7/site-packages/setuptools/init.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/usr/local/python3.7/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/usr/local/python3.7/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/usr/local/python3.7/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
self.run_command(cmd)
File "/usr/local/python3.7/lib/python3.7/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/usr/local/python3.7/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/usr/local/python3.7/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 395, in run
self.egg2dist(self.egginfo_dir, distinfo_dir)
File "/usr/local/python3.7/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 534, in egg2dist
pkg_info = pkginfo_to_metadata(egginfo_path, pkginfo_path)
File "/usr/local/python3.7/lib/python3.7/site-packages/wheel/metadata.py", line 160, in pkginfo_to_metadata
for key, value in generate_requirements({extra: reqs}):
File "/usr/local/python3.7/lib/python3.7/site-packages/wheel/metadata.py", line 138, in generate_requirements
for new_req in convert_requirements(depends):
File "/usr/local/python3.7/lib/python3.7/site-packages/wheel/metadata.py", line 103, in convert_requirements
parsed_requirement = Requirement(req)
File "/usr/local/python3.7/lib/python3.7/site-packages/wheel/vendored/packaging/requirements.py", line 37, in init
raise InvalidRequirement(str(e)) from e
wheel.vendored.packaging.requirements.InvalidRequirement: Expected end or semicolon (after version specifier)
opencv-python>=3.
~~~^
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for gym
Running setup.py clean for gym
Failed to build gym

@wbc23 wbc23 changed the title [Bug Report] Bug title [Bug Report] Building wheel for gym (setup.py) ... error Mar 29, 2023
@pseudo-rnd-thoughts
Copy link
Contributor

pip install setuptools == 66 or modify the setup.py file to fix the issue

@heiheiheibj
Copy link

heiheiheibj commented Apr 16, 2023

I'm getting the same error, it's not a setuptools version problem, it's a configuration error.
Look carefully, opencv-python>=3.
There is no number after 3. just change it to 3.0 or 3

@HelloCentaurus
Copy link

I'm getting the same error, it's not a setuptools version problem, it's a configuration error. Look carefully, opencv-python>=3. There is no number after 3. just change it to 3.0 or 3

Where can I find this file and modify it?

@heiheiheibj
Copy link

heiheiheibj commented Apr 16, 2023

I couldn't find the location of the configuration file, so i used a very inelegant way to modify the code and solved this problem. [doge]
Modify /usr/local/python3.7/lib/python3.7/site-packages/wheel/vendored/packaging/requirements.py

`
def init(self, requirement_string: str) -> None:

    try:

        if requirement_string.find('opencv-python>=3.')>=0:

            requirement_string += "0"    # opencv-python>=3.0

        parsed = parse_requirement(requirement_string)

`

@HelloCentaurus
Copy link

I couldn't find the location of the configuration file, so I did a very dumb solution. Modify /usr/local/python3.7/lib/python3.7/site-packages/wheel/vendored/packaging/requirements.py

` def init(self, requirement_string: str) -> None:

    try:

        if requirement_string.find('opencv-python>=3.')>=0:

            requirement_string += "0"    # opencv-python>=3.0

        parsed = parse_requirement(requirement_string)

`

Anyway, this method helped me solve the problem. Thank you very much!

@JakobThumm
Copy link

Alternatively,

pip install git+https://github.com/openai/gym.git@9180d12e1b66e7e2a1a622614f787a6ec147ac40

installs gym==0.21 with the typo opencv-python>=3. fixed.

@saulfield
Copy link

This appears to be because of a change with wheel. Using wheel==0.38.4 worked for me.

passalis added a commit to opendr-eu/opendr that referenced this issue May 15, 2023
passalis added a commit to opendr-eu/opendr that referenced this issue May 15, 2023
passalis added a commit to opendr-eu/opendr that referenced this issue May 15, 2023
pkel added a commit to pkel/cpr that referenced this issue May 16, 2023
Problem description: openai/gym#3202

It would be much better to upgrade to a recent version of gym, or even
better, switch to gymnasium. But stable-baselines3 has not done this
upgrade/switch yet, so I'll have to wait.

When doing the switch/upgrade, don't forget to fix all three files:
- setup.py
- Makefile (_venv rule)
- .github/workflows/main.yml
stefaniapedrazzi added a commit to opendr-eu/opendr that referenced this issue May 17, 2023
* Disable mobile manipulation test

* PyTorch version bump

* PyTorch version bump

* PyTorch version bump

* PyTorch version bump

* PyTorch version bump

* Gym version bump

* Gym version bump

* Wheel version downgrade to openai/gym#3202

* Wheel version downgrade due to openai/gym#3202

* Wheel version downgrade due to openai/gym#3202

* Removed unsupported argument `enable_onnx_checker`

* Added opset version

* Added opset versions

* Fixed `load_state_dict_from_url` calls

* Fixed interpolation argument due to pytorchvision bump

* Fixed `load_state_dict_from_url` import

* Removed inplace operation

* Remove inplace operation

* Added missing dependency

* Style fix

* Removed unused import

* DCN update

* DCN update

* DCN update

* DCN version fix

* Fix DCN loading to be backward compatible

* Update tests_suite.yml

* Update tests_suite_develop.yml

* Update test_packages.yml

* Update test_packages.yml

* Update tests_suite.yml

* Update tests_suite_develop.yml

* Update test_packages.yml

* Update tests_suite.yml

* Update tests_suite_develop.yml

* Update test_packages.yml

* Update tests_suite.yml

* Update tests_suite_develop.yml

* Update deprecated macos image

* Disable source tests on ubuntu for testing

* Revert previous commit

* Try to fix apt errors

* Update macos image

---------

Co-authored-by: Nikolaos Passalis <passalis@csd.auth.gr>
Co-authored-by: Nikolaos Passalis <passalis@users.noreply.github.com>
@pseudo-rnd-thoughts
Copy link
Contributor

In my case I just had to replace the gym== version being installed to gym, and the most recent version works, I guess.

Be aware that there are major api changes with the latest version compared to v0.21

lucamarchionni pushed a commit to lucamarchionni/opendr that referenced this issue Jun 10, 2024
* Disable mobile manipulation test

* PyTorch version bump

* PyTorch version bump

* PyTorch version bump

* PyTorch version bump

* PyTorch version bump

* Gym version bump

* Gym version bump

* Wheel version downgrade to openai/gym#3202

* Wheel version downgrade due to openai/gym#3202

* Wheel version downgrade due to openai/gym#3202

* Removed unsupported argument `enable_onnx_checker`

* Added opset version

* Added opset versions

* Fixed `load_state_dict_from_url` calls

* Fixed interpolation argument due to pytorchvision bump

* Fixed `load_state_dict_from_url` import

* Removed inplace operation

* Remove inplace operation

* Added missing dependency

* Style fix

* Removed unused import

* DCN update

* DCN update

* DCN update

* DCN version fix

* Fix DCN loading to be backward compatible

* Update tests_suite.yml

* Update tests_suite_develop.yml

* Update test_packages.yml

* Update test_packages.yml

* Update tests_suite.yml

* Update tests_suite_develop.yml

* Update test_packages.yml

* Update tests_suite.yml

* Update tests_suite_develop.yml

* Update test_packages.yml

* Update tests_suite.yml

* Update tests_suite_develop.yml

* Update deprecated macos image

* Disable source tests on ubuntu for testing

* Revert previous commit

* Try to fix apt errors

* Update macos image

---------

Co-authored-by: Nikolaos Passalis <passalis@csd.auth.gr>
Co-authored-by: Nikolaos Passalis <passalis@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@heiheiheibj @pseudo-rnd-thoughts @HelloCentaurus @saulfield @JakobThumm @wbc23 and others