Closed
Description
🐞 bug report
Affected Rule
pip_install
Is this a regression?
No
Description
pip_install
with the single requirement numba
fails. It complains that it cannot find a dependent package numpy
. It makes this complaint just after stating that it successfully installed numpy
. It is very confused.
🔬 Minimal Reproduction
Setup on Mac OS X
$ brew install llvm openssl pyenv
$ pyenv install 3.7.9
$ pyenv shell 3.7.9
.bazelrc
:
build --action_env=CPPFLAGS="-I/usr/local/opt/llvm@9/include -I/usr/local/opt/openssl@1.1/include"
build --action_env=LDFLAGS="-L/usr/local/opt/llvm@9/lib -L/usr/local/opt/openssl@1.1/lib"
build --action_env=LLVM_CONFIG=/usr/local/opt/llvm@9/bin/llvm-config
WORKSPACE
:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz",
sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0",
)
register_toolchains("//:py_toolchain")
load("@rules_python//python:pip.bzl", "pip_install")
pip_install(
name = "pip",
requirements = "//:requirements.txt",
timeout=1800
)
BUILD
:
load("@pip//:requirements.bzl", "requirement")
load("@rules_python//python:defs.bzl", "py_runtime_pair")
py_runtime(
name = "py_runtime",
interpreter_path = "/Users/topher/.pyenv/versions/3.7.9/bin/python",
python_version = "PY3"
)
py_runtime_pair(
name = "py_runtime_pair",
py2_runtime = None,
py3_runtime = ":py_runtime",
)
toolchain(
name = "py_toolchain",
toolchain = ":py_runtime_pair",
toolchain_type = "@bazel_tools//tools/python:toolchain_type",
)
py_binary(
name = "hello",
srcs = ["hello.py"],
deps = [requirement("numba")]
)
requirements.txt
:
numba
hello.py
:
print('Hello World')
🔥 Exception or Error
$ bazel build //:hello
Starting local Bazel server and connecting to it...
INFO: Repository pip instantiated at:
...
ERROR: An error occurred during the fetch of repository 'pip':
...
Successfully built llvmlite numpy
Failed to build numba
...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/_b/rtklv78d3bgc6dx41t6l8jn00000gn/T/pip-wheel-eu4o_wgj/numba/setup.py", line 413, in <module>
metadata['ext_modules'] = get_ext_modules()
File "/private/var/folders/_b/rtklv78d3bgc6dx41t6l8jn00000gn/T/pip-wheel-eu4o_wgj/numba/setup.py", line 148, in get_ext_modules
import numpy.distutils.misc_util as np_misc
ModuleNotFoundError: No module named 'numpy'
...
🌍 Your Environment
Operating System:
macOS BigSur
11.2.1
Output of bazel version
:
bazel 4.0.0-homebrew
Rules_python version:
0.1.0
Anything else relevant?
I can do plain old pip install at the command line fine:
$ python3 -m pip install -r requirements.txt
...all goodness...
I see --isolated wheel
in extract_wheels here. If I do that at the command line, I get errors like above:
$ python3 -m pip --isolated wheel -r requirements.txt
...
Building wheels for collected packages: numba, llvmlite
Using legacy setup.py install for numba, since package 'wheel' is not installed.
Building wheel for numba (setup.py) ... error
ERROR: Command errored out with exit status 1:
...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/_b/rtklv78d3bgc6dx41t6l8jn00000gn/T/pip-wheel-88k4h1wd/numba/setup.py", line 413, in <module>
metadata['ext_modules'] = get_ext_modules()
File "/private/var/folders/_b/rtklv78d3bgc6dx41t6l8jn00000gn/T/pip-wheel-88k4h1wd/numba/setup.py", line 148, in get_ext_modules
import numpy.distutils.misc_util as np_misc
ModuleNotFoundError: No module named 'numpy'
This is at the edge of my knowledge about Python and PIP.
I tried this with the system's python3 rather than setting up a toolchain. Oh god, THAT was a mess.
Metadata
Metadata
Assignees
Labels
No labels