Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{pkgs ? import <nixpkgs>{}, python37Packages, tensorflow }:
with pkgs;
with pkgs.python37.pkgs;
let
includes_joined = symlinkJoin {
name = "tensorflow-metadata-deps";
paths = [ protobuf ];
};
tensorflow-metadata-bazel =
pkgs.buildBazelPackage rec {
name = "tensorflow_metadata-0.22.0";
bazelTarget = "//tensorflow_metadata:build_pip_package";
fetchAttrs = {
sha256 = "sha256-+mfR+7ShMWLm/wtvYVIO6nZmxHM9XvUdEAWpGmCZiZs=";
};
INCLUDEDIR = "${includes_joined}/include";
TF_IGNORE_MAX_BAZEL_VERSION = true;
TF_SYSTEM_LIBS=lib.concatStringsSep "," [
"com_google_protobuf"
];
buildAttrs = {
buildInputs = [ protobuf3_11];
outputs = ["out" ];
preBuild = ''
patchShebangs .
'';
installPhase = ''
ls -alh
mkdir -p "$PWD/dist"
export BUILD_WORKSPACE_DIRECTORY="/build/source"
export PYTHON_BIN_PATH="${pkgs.python37}/bin/python"
pushd bazel-bin
export SOURCE_DATE_EPOCH=$(date +%s -d "2000/01/01")
tensorflow_metadata/build_pip_package
popd
export python=$out/lib/python3.7/site-packages
mkdir -p "$python"
ls -alh
cp -Lr "$PWD/build/lib/tensorflow_metadata" "$python/tensorflow_metadata"
cp -Lr dist/* "$python"
find bazel-bin/*
find dist/
'';
doCheck = false;
postBuild = ''
ls -alh
ls .. -alh
'';
};
version = "0.22.0";
propagatedBuildInputs = [
setuptools wheel grpcio
googleapis_common_protos protobuf3_11]; #wrapt dill attrs protobuf_3_11 tensorflow_2];
src = pkgs.fetchFromGitHub {
owner = "tensorflow";
repo = "metadata";
rev = "6c4ad4c870d5537365e38a1a6d215c5fc1d20f7d";
sha256 = "sha256:1bsmx3j6xslxfjw3xsndd7b5dvdxrf4gjgpbx0m8hcgcx3ziy7dl";
};
bazel = pkgs.bazel_0_26;
bazelBuildFlags = [
#"--incompatible_package_name_is_a_function=false"
"--incompatible_no_support_tools_in_action_inputs=false"
"--incompatible_string_join_requires_strings=false"
"-k" "--define=INCLUDEDIR=${protobuf3_11}/include"];
};
tensorflow-metadata = buildPythonPackage {
pname = "tensorflow_metadata";
version = "0.22.0";
src = tensorflow-metadata-bazel;
buildPhase = ''
echo not building
'';
doCheck = false;
installPhase = ''
mkdir -p $out/lib/python3.7/site-packages
#cp -r $src/* $out/.
#chmod +w -R $out
wheel unpack --dest $out/lib/python3.7/site-packages $src/lib/p*/s*/*.whl
mv $out/lib/python3.7/site-packages/ten*/* $out/lib/python3.7/site-packages/.
'';
};
tensorflow-datasets = pkgs.python3.pkgs.buildPythonPackage rec {
pname = "tensorflow-datasets";
version = "3.1.0";
propagatedBuildInputs = [
wrapt dill tqdm promise
requests termcolor future numpy absl-py
tensorflow googleapis_common_protos
attrs protobuf tensorflow-metadata tqdm];
doCheck = false;
src = pkgs.python37.pkgs.fetchPypi {
inherit pname version;
sha256 = "sha256:1iyx8ap8ga1am6p78mj0jyrrv0xc5qblh3wlbaxck9h7cc5s1775";
};
};
in
tensorflow-datasets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment