tensorflow: fix python2 build
Avoid using PYTHONPATH, switch to python envs instead.
This commit is contained in:
parent
ea3bae4f4d
commit
e0795aa5e8
@ -58,8 +58,23 @@ let
|
|||||||
variant = if cudaSupport then "-gpu" else "";
|
variant = if cudaSupport then "-gpu" else "";
|
||||||
pname = "tensorflow${variant}";
|
pname = "tensorflow${variant}";
|
||||||
|
|
||||||
# TODO: remove after there's support for setupPyDistFlags
|
pythonEnv = python.withPackages (_:
|
||||||
setuppy = ../../../development/interpreters/python/run_setup.py;
|
[ # python deps needed during wheel build time
|
||||||
|
numpy
|
||||||
|
keras-preprocessing
|
||||||
|
protobuf
|
||||||
|
wrapt
|
||||||
|
gast
|
||||||
|
astor
|
||||||
|
absl-py
|
||||||
|
termcolor
|
||||||
|
keras-applications
|
||||||
|
setuptools
|
||||||
|
wheel
|
||||||
|
] ++ lib.optionals (!isPy3k)
|
||||||
|
[ future
|
||||||
|
mock
|
||||||
|
]);
|
||||||
|
|
||||||
bazel-build = buildBazelPackage rec {
|
bazel-build = buildBazelPackage rec {
|
||||||
name = "${pname}-${version}";
|
name = "${pname}-${version}";
|
||||||
@ -96,27 +111,15 @@ let
|
|||||||
# https://gitweb.gentoo.org/repo/gentoo.git/tree/sci-libs/tensorflow
|
# https://gitweb.gentoo.org/repo/gentoo.git/tree/sci-libs/tensorflow
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
swig which cython
|
swig which pythonEnv
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
python
|
|
||||||
jemalloc
|
jemalloc
|
||||||
openmpi
|
openmpi
|
||||||
glibcLocales
|
glibcLocales
|
||||||
git
|
git
|
||||||
|
|
||||||
# python deps needed during wheel build time
|
|
||||||
numpy
|
|
||||||
keras-preprocessing
|
|
||||||
protobuf
|
|
||||||
wrapt
|
|
||||||
gast
|
|
||||||
astor
|
|
||||||
absl-py
|
|
||||||
termcolor
|
|
||||||
keras-applications
|
|
||||||
|
|
||||||
# libs taken from system through the TF_SYS_LIBS mechanism
|
# libs taken from system through the TF_SYS_LIBS mechanism
|
||||||
# grpc
|
# grpc
|
||||||
sqlite
|
sqlite
|
||||||
@ -133,20 +136,12 @@ let
|
|||||||
giflib
|
giflib
|
||||||
re2
|
re2
|
||||||
pkgs.lmdb
|
pkgs.lmdb
|
||||||
|
|
||||||
# for building the wheel
|
|
||||||
setuptools
|
|
||||||
wheel
|
|
||||||
] ++ lib.optionals (!isPy3k) [
|
|
||||||
future
|
|
||||||
mock
|
|
||||||
] ++ lib.optionals cudaSupport [
|
] ++ lib.optionals cudaSupport [
|
||||||
cudatoolkit
|
cudatoolkit
|
||||||
cudnn
|
cudnn
|
||||||
nvidia_x11
|
nvidia_x11
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
# arbitrarily set to the current latest bazel version, overly careful
|
# arbitrarily set to the current latest bazel version, overly careful
|
||||||
TF_IGNORE_MAX_BAZEL_VERSION = true;
|
TF_IGNORE_MAX_BAZEL_VERSION = true;
|
||||||
|
|
||||||
@ -194,7 +189,7 @@ let
|
|||||||
|
|
||||||
INCLUDEDIR = "${includes_joined}/include";
|
INCLUDEDIR = "${includes_joined}/include";
|
||||||
|
|
||||||
PYTHON_BIN_PATH = python.interpreter;
|
PYTHON_BIN_PATH = pythonEnv.interpreter;
|
||||||
|
|
||||||
TF_NEED_GCP = true;
|
TF_NEED_GCP = true;
|
||||||
TF_NEED_HDFS = true;
|
TF_NEED_HDFS = true;
|
||||||
@ -237,6 +232,9 @@ let
|
|||||||
export PYTHON_LIB_PATH="$NIX_BUILD_TOP/site-packages"
|
export PYTHON_LIB_PATH="$NIX_BUILD_TOP/site-packages"
|
||||||
export CC_OPT_FLAGS="${lib.concatStringsSep " " opt_flags}"
|
export CC_OPT_FLAGS="${lib.concatStringsSep " " opt_flags}"
|
||||||
mkdir -p "$PYTHON_LIB_PATH"
|
mkdir -p "$PYTHON_LIB_PATH"
|
||||||
|
|
||||||
|
# To avoid mixing Python 2 and Python 3
|
||||||
|
unset PYTHONPATH
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
@ -313,13 +311,7 @@ in buildPythonPackage rec {
|
|||||||
rm $out/bin/tensorboard
|
rm $out/bin/tensorboard
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# TODO: remove after there's support for setupPyDistFlags
|
setupPyGlobalFlags = [ "--project_name ${pname}" ];
|
||||||
buildPhase = ''
|
|
||||||
runHook preBuild
|
|
||||||
cp ${setuppy} nix_run_setup
|
|
||||||
${python.interpreter} nix_run_setup --project_name ${pname} bdist_wheel
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
|
||||||
|
|
||||||
# tensorflow/tools/pip_package/setup.py
|
# tensorflow/tools/pip_package/setup.py
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
|
Loading…
Reference in New Issue
Block a user