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

"uv add pybullet" throws cpp compilation error when compiling the wheel #7376

Closed
cube1324 opened this issue Sep 13, 2024 · 13 comments · Fixed by #8907
Closed

"uv add pybullet" throws cpp compilation error when compiling the wheel #7376

cube1324 opened this issue Sep 13, 2024 · 13 comments · Fixed by #8907
Labels
question Asking for clarification or support windows Specific to the Windows platform

Comments

@cube1324
Copy link

cube1324 commented Sep 13, 2024

Hello,

when i try to add pybullet via uv add pybullet i get some c++ compilation error:

error: Failed to prepare distributions
  Caused by: Failed to fetch wheel: pybullet==3.2.6
  Caused by: Build backend failed to build wheel through `build_wheel()` with exit code: 1
--- stdout:
win-amd64
numpy is enabled.
numpy_include_dirs = C:\Users\jonas\Documents\cremini-rl\.venv\lib\site-packages\numpy\_core\include
win32!
.
. (here are a lot of warnings)
.
C:\Users\jonas\AppData\Local\uv\cache\built-wheels-v3\index\b2a7eb67d4c26b82\pybullet\3.2.6\WoWqLNnKv9F-ugJ1yInbm\pybullet-3.2.6.tar.gz\examples\SharedMemory\plugins\tinyRendererPlugin\TinyRendererVisualShapeConverter.cpp : fatal error C1083: Cannot open compiler generated file: '': Invalid argument
--- stderr:
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX86\\x64\\cl.exe' failed with exit code 1

However installing pybullet via uv pip install pybullet works flawlesly. I am using Windows 11 with uv version 0.4.9.
I already tried to disable build isolation but that does not solve the issue. Is there anything else i have overlooked or is the package just too old / not compatible?

@charliermarsh
Copy link
Member

That's interesting... Are they using different underlying Python interpreters? (If you run with --verbose, we should tell you the Python interpreter that's being used in each case.

@charliermarsh charliermarsh added the question Asking for clarification or support label Sep 14, 2024
@cube1324
Copy link
Author

Below are the debug messages for both cases. As far as i understand uv pip install uses the venv interpreter and uv add uses the miniconda interpreter. Installing pybullet without uv with just plain pip works for the minicoda intepreter. I tried a default python interpreter instead of the miniconda one in case there are some weird permission issue. However it still has the same issue.

C:\Users\jonas\Documents\test>uv pip install pybullet --no-cache --verbose
DEBUG uv 0.4.9
DEBUG Searching for Python interpreter in system path or `py` launcher
DEBUG Found `cpython-3.9.12-windows-x86_64-none` at `C:\Users\jonas\Documents\test\.venv\Scripts\python.exe` (virtual environment)
DEBUG Using Python 3.9.12 environment at .venv\Scripts\python.exe
DEBUG Acquired lock for `.venv`
DEBUG At least one requirement is not satisfied: pybullet
DEBUG Using request timeout of 30s
DEBUG Solving with installed Python version: 3.9.12
DEBUG Solving with target Python version: >=3.9.12
DEBUG Adding direct dependency: pybullet*
DEBUG No cache entry for: https://pypi.org/simple/pybullet/
DEBUG Searching for a compatible version of pybullet (*)
DEBUG Selecting: pybullet==3.2.6 [compatible] (pybullet-3.2.6.tar.gz)
DEBUG No cache entry for: https://files.pythonhosted.org/packages/e9/56/2a0a0b46cf65d2dd533a3f3a5647d63a1e4558646eab3a57a8e502b78c82/pybullet-3.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
DEBUG Tried 1 versions: pybullet 1
DEBUG Split specific environment resolution took 0.076s
Resolved 1 package in 76ms
DEBUG Identified uncached requirement: pybullet==3.2.6
DEBUG Acquired lock for `C:\Users\jonas\AppData\Local\Temp\.tmpjT6tRY\built-wheels-v3\pypi\pybullet\3.2.6`
DEBUG No cache entry for: https://files.pythonhosted.org/packages/39/a6/6d6a8c535b82460527edc04b5fbf0374541d041668515e35822e53d7f66f/pybullet-3.2.6.tar.gz
DEBUG Downloading source distribution: pybullet==3.2.6
DEBUG Building: pybullet==3.2.6
DEBUG Ignoring empty directory
DEBUG Resolving build requirements
DEBUG Solving with installed Python version: 3.9.12
DEBUG Solving with target Python version: >=3.9.12
DEBUG Adding direct dependency: setuptools>=40.8.0
DEBUG No cache entry for: https://pypi.org/simple/setuptools/
DEBUG Searching for a compatible version of setuptools (>=40.8.0)
DEBUG Selecting: setuptools==74.1.2 [compatible] (setuptools-74.1.2-py3-none-any.whl)
DEBUG No cache entry for: https://files.pythonhosted.org/packages/cb/9c/9ad11ac06b97e55ada655f8a6bea9d1d3f06e120b178cd578d80e558191d/setuptools-74.1.2-py3-none-any.whl.metadata
DEBUG Tried 1 versions: setuptools 1
DEBUG Split specific environment resolution took 0.042s
DEBUG Installing in setuptools==74.1.2 in C:\Users\jonas\AppData\Local\Temp\.tmpjT6tRY\builds-v0\.tmpZrdjuY
DEBUG Identified uncached requirement: setuptools==74.1.2
DEBUG Downloading and building requirement for build: setuptools==74.1.2
DEBUG No cache entry for: https://files.pythonhosted.org/packages/cb/9c/9ad11ac06b97e55ada655f8a6bea9d1d3f06e120b178cd578d80e558191d/setuptools-74.1.2-py3-none-any.whl
DEBUG Installing build requirement: setuptools==74.1.2
DEBUG Creating PEP 517 build environment
DEBUG Calling `setuptools.build_meta:__legacy__.get_requires_for_build_wheel()`
.
.  (lost of c++ compiler warnings)
.
DEBUG Generating code
DEBUG Finished generating code
DEBUG C:\Users\jonas\AppData\Local\Temp\.tmpjT6tRY\builds-v0\.tmpZrdjuY\lib\site-packages\setuptools\command\bdist_wheel.py:114: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
DEBUG   if get_flag("Py_DEBUG", hasattr(sys, "gettotalrefcount"), warn=(impl == "cp")):
DEBUG Finished building: pybullet==3.2.6
DEBUG Released lock at `C:\Users\jonas\AppData\Local\Temp\.tmpjT6tRY\built-wheels-v3\pypi\pybullet\3.2.6\.lock`
Prepared 1 package in 2m 55s
Installed 1 package in 1.07s
 + pybullet==3.2.6
DEBUG Released lock at `C:\Users\jonas\Documents\test\.venv\.lock`
DEBUG uv 0.4.9
DEBUG Found project root: `C:\Users\jonas\Documents\test`
DEBUG No workspace root found, using project root
DEBUG Reading requests from `C:\Users\jonas\Documents\test\.python-version`
DEBUG Searching for Python 3.9 in managed installations, system path, or `py` launcher
DEBUG Searching for managed installations at `C:\Users\jonas\AppData\Roaming\uv\python`
DEBUG Found `cpython-3.9.12-windows-x86_64-none` at `C:\Users\jonas\miniconda3\python.exe` (search path)
Using Python 3.9.12 interpreter at: C:\Users\jonas\miniconda3\python.exe
Creating virtualenv at: .venv
DEBUG Using request timeout of 30s
DEBUG Using request timeout of 30s
DEBUG Starting clean resolution
DEBUG Found static `pyproject.toml` for: test @ file:///C:/Users/jonas/Documents/test
DEBUG No workspace root found, using project root
DEBUG Solving with installed Python version: 3.9.12
DEBUG Solving with target Python version: >=3.9
DEBUG Adding direct dependency: test*
DEBUG Searching for a compatible version of test @ file:///C:/Users/jonas/Documents/test (*)
DEBUG Adding transitive dependency for test==0.1.0: pybullet*
DEBUG No cache entry for: https://pypi.org/simple/pybullet/
DEBUG Searching for a compatible version of pybullet (*)
DEBUG Selecting: pybullet==3.2.6 [compatible] (pybullet-3.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl)
DEBUG No cache entry for: https://files.pythonhosted.org/packages/e9/56/2a0a0b46cf65d2dd533a3f3a5647d63a1e4558646eab3a57a8e502b78c82/pybullet-3.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
DEBUG Tried 2 versions: pybullet 1, test 1
DEBUG Split universal resolution took 0.086s
Resolved 2 packages in 92ms
DEBUG Using request timeout of 30s
DEBUG Found static `pyproject.toml` for: test @ file:///C:/Users/jonas/Documents/test
DEBUG No workspace root found, using project root
DEBUG Ignoring existing lockfile due to mismatched `requires-dist` for: `test==0.1.0`
  Expected: {Requirement { name: PackageName("pybullet"), extras: [], marker: true, source: Registry { specifier: VersionSpecifiers([VersionSpecifier { operator: GreaterThanEqual, version: "3.2.6" }]), index: None }, origin: None }}
  Actual: {Requirement { name: PackageName("pybullet"), extras: [], marker: true, source: Registry { specifier: VersionSpecifiers([]), index: None }, origin: None }}
DEBUG Starting clean resolution
DEBUG Found static `pyproject.toml` for: test @ file:///C:/Users/jonas/Documents/test
DEBUG No workspace root found, using project root
DEBUG Solving with installed Python version: 3.9.12
DEBUG Solving with target Python version: >=3.9
DEBUG Adding direct dependency: test*
DEBUG Searching for a compatible version of test @ file:///C:/Users/jonas/Documents/test (*)
DEBUG Adding transitive dependency for test==0.1.0: pybullet>=3.2.6
DEBUG Found fresh response for: https://pypi.org/simple/pybullet/
DEBUG Searching for a compatible version of pybullet (>=3.2.6)
DEBUG Selecting: pybullet==3.2.6 [preference] (pybullet-3.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl)
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/e9/56/2a0a0b46cf65d2dd533a3f3a5647d63a1e4558646eab3a57a8e502b78c82/pybullet-3.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
DEBUG Tried 2 versions: pybullet 1, test 1
DEBUG Split universal resolution took 0.001s
DEBUG Using request timeout of 30s
DEBUG Identified uncached requirement: pybullet==3.2.6
DEBUG Acquired lock for `C:\Users\jonas\AppData\Local\Temp\.tmp8eZK2D\built-wheels-v3\index\b2a7eb67d4c26b82\pybullet\3.2.6`
DEBUG No cache entry for: https://files.pythonhosted.org/packages/39/a6/6d6a8c535b82460527edc04b5fbf0374541d041668515e35822e53d7f66f/pybullet-3.2.6.tar.gz
DEBUG Downloading source distribution: pybullet==3.2.6
DEBUG Building: pybullet==3.2.6
DEBUG Ignoring empty directory
DEBUG Resolving build requirements
DEBUG Solving with installed Python version: 3.9.12
DEBUG Solving with target Python version: >=3.9.12
DEBUG Adding direct dependency: setuptools>=40.8.0
DEBUG No cache entry for: https://pypi.org/simple/setuptools/
DEBUG Searching for a compatible version of setuptools (>=40.8.0)
DEBUG Selecting: setuptools==74.1.2 [compatible] (setuptools-74.1.2-py3-none-any.whl)
DEBUG No cache entry for: https://files.pythonhosted.org/packages/cb/9c/9ad11ac06b97e55ada655f8a6bea9d1d3f06e120b178cd578d80e558191d/setuptools-74.1.2-py3-none-any.whl.metadata
DEBUG Tried 1 versions: setuptools 1
DEBUG Split specific environment resolution took 0.066s
DEBUG Installing in setuptools==74.1.2 in C:\Users\jonas\AppData\Local\Temp\.tmp8eZK2D\builds-v0\.tmp3cJ0iX
DEBUG Identified uncached requirement: setuptools==74.1.2
DEBUG Downloading and building requirement for build: setuptools==74.1.2
DEBUG No cache entry for: https://files.pythonhosted.org/packages/cb/9c/9ad11ac06b97e55ada655f8a6bea9d1d3f06e120b178cd578d80e558191d/setuptools-74.1.2-py3-none-any.whl
DEBUG Installing build requirement: setuptools==74.1.2
DEBUG Creating PEP 517 build environment
DEBUG Calling `setuptools.build_meta:__legacy__.get_requires_for_build_wheel()`
.
.  (lost of c++ compiler warnings)
.
DEBUG C:\Users\jonas\AppData\Local\Temp\.tmp8eZK2D\built-wheels-v3\index\b2a7eb67d4c26b82\pybullet\3.2.6\NurYCsYSkVk6xBXgflFQA\pybullet-3.2.6.tar.gz\examples\SharedMemory\plugins\collisionFilterPlugin\collisionFilterPlugin.cpp : fatal error C1083: Cannot open compiler generated file: '': Invalid argument
DEBUG error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX86\\x64\\cl.exe' failed with exit code 1
DEBUG Released lock at `C:\Users\jonas\AppData\Local\Temp\.tmp8eZK2D\built-wheels-v3\index\b2a7eb67d4c26b82\pybullet\3.2.6\.lock`
error: Failed to prepare distributions
  Caused by: Failed to fetch wheel: pybullet==3.2.6
  Caused by: Build backend failed to build wheel through `build_wheel()` with exit code: 1

@charliermarsh
Copy link
Member

Does pip install --use-pep517 --no-cache pybullet work? Or does that fail too?

@cube1324
Copy link
Author

pip install --use-pep517 --no-cache pybullet works with no issues. Only uv add fails

@charliermarsh
Copy link
Member

My best guess is that you're hitting the file-length limit on Windows?

@charliermarsh
Copy link
Member

Can you try setting a short cache directory? #7078 (comment)

@cube1324
Copy link
Author

Setting a short cache directory fixes the issue 👍, thanks for the help. The only weird thing is that long path support is already enabled on my machine, so i am not sure why it doesent work with the longer path 🤔. I guess its just windows things....

@charliermarsh
Copy link
Member

That's interesting...

I do have a PR open to try and shorten the paths: #7240. It's hard for me to say off-hand whether it would've made a difference here, would need to do some character counting (or you're welcome to try it if you're eager to build from source)...

@charliermarsh charliermarsh added the windows Specific to the Windows platform label Sep 14, 2024
@charliermarsh
Copy link
Member

Annoyed because this actually worked for me on my Windows machine, even without long paths enabled.

@cube1324
Copy link
Author

I tried on 2 different Pc both running Windows 11 10.0.22631. On both it does not work with the default cache location. The long path settings has not impact. However if i move the cache location to C:\uv it works. I dont have time to investigate it further, for the time being i will just stick with our previous slow build pipeline 😢. Thanks for the help anyways!

@charliermarsh
Copy link
Member

Is moving the cache location a problem?

@cube1324
Copy link
Author

After some more consideration i agree with you, moving the cache location is not a big issue. Thanks again 👍

@bmarroquin
Copy link

Sadly, not everything in windows respects the long path setting. In this case, the executable that is raising the error does not. See this stack overflow question.. The safer bet is always trying to shorten the paths.

Since there is a user specific part in the path (username), the error may or may not be present depending on the length of the user's username. This may explain why it works for @charliermarsh without any changes.

@zanieb zanieb closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2024
charliermarsh added a commit that referenced this issue Nov 8, 2024
## Summary

In the example outlined in #8884,
this removes an unnecessary `jupyter_contrib_nbextensions-0.7.0.tar.gz`
segment (replacing it with `src`), thereby saving 39 characters and
getting that build working on my Windows machine.

This should _not_ require a version bump because we already have logic
in place to "heal" partial cache entries that lack an unzipped
distribution.

Closes #8884.

Closes #7376.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support windows Specific to the Windows platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants