Skip to content

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

@amirh

Description

@amirh

🐞 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?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions