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

pip_install fails with: Invalid WHEEL file. Expected key 'Root-Is-Purelib' #435

Closed
amirh opened this issue Mar 12, 2021 · 4 comments
Closed
Assignees

Comments

@amirh
Copy link

amirh commented Mar 12, 2021

🐞 bug report

Affected Rule

The issue is caused by the rule: pip_install

Is this a regression?

No

Description

pip_install fails installing platlib dependencies (e.g catboost)

🔬 Minimal Reproduction

I staged a repository that reproduces the issue here: https://github.com/amirh/bazel_platlib_repro
to reproduce in that repository run bazel build repro:repro

🔥 Exception or Error


 (Traceback (most recent call last):
  File "/Users/amir/.pyenv/versions/3.7.6/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/amir/.pyenv/versions/3.7.6/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/private/var/tmp/_bazel_amir/85d4a1787a3dae9aaa9ef9ea1408d68e/external/rules_python/python/pip_install/extract_wheels/__main__.py", line 5, in 
    main()
  File "/private/var/tmp/_bazel_amir/85d4a1787a3dae9aaa9ef9ea1408d68e/external/rules_python/python/pip_install/extract_wheels/__init__.py", line 104, in main
    for whl in glob.glob("*.whl")
  File "/private/var/tmp/_bazel_amir/85d4a1787a3dae9aaa9ef9ea1408d68e/external/rules_python/python/pip_install/extract_wheels/__init__.py", line 104, in 
    for whl in glob.glob("*.whl")
  File "/private/var/tmp/_bazel_amir/85d4a1787a3dae9aaa9ef9ea1408d68e/external/rules_python/python/pip_install/extract_wheels/lib/bazel.py", line 172, in extract_wheel
    purelib.spread_purelib_into_root(directory)
  File "/private/var/tmp/_bazel_amir/85d4a1787a3dae9aaa9ef9ea1408d68e/external/rules_python/python/pip_install/extract_wheels/lib/purelib.py", line 21, in spread_purelib_into_root
    % wheel_metadata_file_path
ValueError: Invalid WHEEL file 'pypi__catboost/catboost-0.24.4.dist-info/WHEEL'. Expected key 'Root-Is-Purelib'.

🌍 Your Environment

Operating System:

  
macOS 11.2.3 
  

Output of bazel version:

  
Bazelisk version: development
Starting local Bazel server and connecting to it...
Build label: 4.0.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Jan 21 07:38:50 2021 (1611214730)
Build timestamp: 1611214730
Build timestamp as int: 1611214730

  

Rules_python version:

  
c37ba2215eccab53ae1da5f827a335281f81b9e1
  

Anything else relevant?

@thundergolfer
Copy link
Collaborator

Thanks for the issue report.

I presume catboost is not populating this field, but I haven't yet checked.

The pip_install implementation does explicitly check for Root-is-Purelib and raises the exception you see when it's not found:

"Invalid WHEEL file '%s'. Expected key 'Root-Is-Purelib'."

Checking the PEP for Wheels I cannot see it saying that the field must be set and have a boolean value, so I think we can take the absence of the field to mean false.

@thundergolfer
Copy link
Collaborator

This has now been fixed in the catboost package (see ref below) and should hit the next release of that package, but will leave this open as add Root-is-Purelib to catboost does fix the issue for future packages.

Ref: catboost/catboost#1695

@thundergolfer
Copy link
Collaborator

thundergolfer commented Jun 8, 2021

@amirh https://github.com/catboost/catboost/releases/tag/v0.26 (latest release) will work with rules_python 0.2.0.

@thundergolfer
Copy link
Collaborator

Closing as now fixed on main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants