Describe the bug
python37Packages.tensorflow.x86_64-darwin fails to build (reproducible on Hydra).
To Reproduce
Steps to reproduce the behavior:
nix-shell with the following shell.nix file: shell.nix
let
nixpkgsSrc = fetchTarball {
url = "https://github.com/NixOS/nixpkgs-channels/archive/c23427de0d501009b9c6d77ff8dda3763c6eb1b4.tar.gz";
};
pkgs = import nixpkgsSrc {
config = {
allowUnfree = true;
allowBroken = true;
};
};
in
pkgs.mkShell {
buildInputs = with pkgs.python37Packages; [
tensorflow
];
}
Error log
ERROR: An error occurred during the fetch of repository 'local_config_python':
Traceback (most recent call last):
File "/private/tmp/nix-build-tensorflow-1.15.2.drv-0/source/third_party/py/python_configure.bzl", line 344
_create_local_python_repository(repository_ctx)
File "/private/tmp/nix-build-tensorflow-1.15.2.drv-0/source/third_party/py/python_configure.bzl", line 295, in _create_local_python_repository
_get_python_include(repository_ctx, python_bin)
File "/private/tmp/nix-build-tensorflow-1.15.2.drv-0/source/third_party/py/python_configure.bzl", line 241, in _get_python_include
_execute(repository_ctx, [python_bin, "-c",...())"], <2 more arguments>)
File "/private/tmp/nix-build-tensorflow-1.15.2.drv-0/source/third_party/py/python_configure.bzl", line 56, in _execute
_fail("\n".join([error_msg.strip() if ... ""]))
File "/private/tmp/nix-build-tensorflow-1.15.2.drv-0/source/third_party/py/python_configure.bzl", line 27, in _fail
fail(("%sPython Configuration Error:%...)))
Python Configuration Error: Problem getting python include path.
/nix/store/7ygifkrn7sbirhi53rh1bpq9cym6mjy9-bash-4.4-p23/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.ISO-8859-1): No such file or directory
Is the Python binary path set up right? (See ./configure or PYTHON_BIN_PATH.) Is distutils installed?
Analyzing: 2 targets (160 packages loaded, 2784 targets configured)
currently loading: tensorflow/core/kernels ... (8 packages)
Fetching @local_config_cc; fetching
ERROR: /private/tmp/nix-build-tensorflow-1.15.2.drv-0/source/third_party/python_runtime/BUILD:5:1: no such package '@local_config_python//': Traceback (most recent call last):
File "/private/tmp/nix-build-tensorflow-1.15.2.drv-0/source/third_party/py/python_configure.bzl", line 344
_create_local_python_repository(repository_ctx)
File "/private/tmp/nix-build-tensorflow-1.15.2.drv-0/source/third_party/py/python_configure.bzl", line 295, in _create_local_python_repository
_get_python_include(repository_ctx, python_bin)
File "/private/tmp/nix-build-tensorflow-1.15.2.drv-0/source/third_party/py/python_configure.bzl", line 241, in _get_python_include
_execute(repository_ctx, [python_bin, "-c",...())"], <2 more arguments>)
File "/private/tmp/nix-build-tensorflow-1.15.2.drv-0/source/third_party/py/python_configure.bzl", line 56, in _execute
_fail("\n".join([error_msg.strip() if ... ""]))
File "/private/tmp/nix-build-tensorflow-1.15.2.drv-0/source/third_party/py/python_configure.bzl", line 27, in _fail
fail(("%sPython Configuration Error:%...)))
Python Configuration Error: Problem getting python include path.
/nix/store/7ygifkrn7sbirhi53rh1bpq9cym6mjy9-bash-4.4-p23/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.ISO-8859-1): No such file or directory
Is the Python binary path set up right? (See ./configure or PYTHON_BIN_PATH.) Is distutils installed?
and referenced by '//third_party/python_runtime:headers'
Analyzing: 2 targets (164 packages loaded, 2800 targets configured)
currently loading: tensorflow/core/kernels ... (5 packages)
Fetching @local_config_cc; fetching
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: Analysis failed
Analyzing: 2 targets (164 packages loaded, 2800 targets configured)
currently loading: tensorflow/core/kernels ... (5 packages)
Fetching @local_config_cc; fetching
INFO: Elapsed time: 9.721s
Analyzing: 2 targets (164 packages loaded, 2800 targets configured)
currently loading: tensorflow/core/kernels ... (5 packages)
Fetching @local_config_cc; fetching
INFO: 0 processes.
Analyzing: 2 targets (164 packages loaded, 2800 targets configured)
currently loading: tensorflow/core/kernels ... (5 packages)
Fetching @local_config_cc; fetching
FAILED: Build did NOT complete successfully (164 packages loaded, 2800 targets\
configured)
currently loading: tensorflow/core/kernels ... (5 packages)
Fetching @local_config_cc; fetching
FAILED: Build did NOT complete successfully (164 packages loaded, 2800 targets\
configured)
currently loading: tensorflow/core/kernels ... (5 packages)
Fetching @local_config_cc; fetching
builder for '/nix/store/v4dv2dld7xby9wwh7mdlpag9290r4r5w-tensorflow-1.15.2.drv' failed with exit code 1
cannot build derivation '/nix/store/fhjszm5isffp0ljl17lzcyy709vpqfn8-python3.7-tensorflow-1.15.2.drv': 1 dependencies couldn't be built
error: build of '/nix/store/fhjszm5isffp0ljl17lzcyy709vpqfn8-python3.7-tensorflow-1.15.2.drv' failed
Expected behavior
tensorflow should build successfully on macOS, or the package should be marked as broken.
Additional context
There seem to be some errors cropping up around a _specific_ locale modification:
cannot change locale (en_US.ISO-8859-1): No such file or directory
This appears to be coming from these lines in the v1.15.2 release.
The two errors that fail the build return with that ISO-8859-1 error, and there are two tests that exercise these locales upstream in tensorflow itself.
Notify maintainers
@jyp @abbradar
Metadata
nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-darwin"`
- host os: `Darwin 18.7.0, macOS 10.14.6`
- multi-user?: `yes`
- sandbox: `no`
- version: `nix-env (Nix) 2.3.2`
- channels(jkachmar): `"darwin, home-manager"`
- channels(root): `"nixpkgs-20.03pre209232.1979ac619f0"`
- nixpkgs: `/nix/store/b17bpar1ds5ix52jpw73fg36slm0lmnv-source`
Maintainer information:
# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
I can't seem to add labels here, but this is a macOS/darwin-specific bug.
When I asked on the IRC, @LnL7 said:
hmm, I think we only have en_US.UTF-8 available in the build
...which would certainly explain these sorts of failures, but I'm not really sure how to translate that into something actionable in a PR.
The _execute() function defined in the same file fails any execution that has something printed in their stderr.
I do not think this is the correct solution for this issue, but it looks like the bash shell that is used by this _execute() call is the one dumping this warning, so using a patch like this allowed me to build this package (which took ~2 hours):
diff --git a/third_party/py/python_configure.bzl b/third_party/py/python_configure.bzl
index d1b1e59492..c1cb37fbd5 100644
--- a/third_party/py/python_configure.bzl
+++ b/third_party/py/python_configure.bzl
@@ -52,7 +52,7 @@ def _execute(
the result of repository_ctx.execute(cmdline)
"""
result = repository_ctx.execute(cmdline)
- if result.stderr or not (empty_stdout_fine or result.stdout):
+ if result.return_code != 0:
_fail("\n".join([
error_msg.strip() if error_msg else "Repository command failed",
result.stderr.strip(),
I marked this as stale due to inactivity. → More info
Most helpful comment
I can't seem to add labels here, but this is a macOS/darwin-specific bug.
When I asked on the IRC, @LnL7 said:
...which would certainly explain these sorts of failures, but I'm not really sure how to translate that into something actionable in a PR.