question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getting tensorflow to work on aarch64-linux

See original GitHub issue

I’m trying to get TensorFlow to work inside a Nix-based environment on an aarch64-linux system by using mach-nix.

I created a flake for this, which works fine on x86_64-linux but cannot resolve all of its dependencies on aarch64-linux. I’m not sure how to best deal with those missing dependencies and I was hoping someone can point me in the right direction.

The specific system I am trying this on is a Jetson Nano running Nvidia’s Ubuntu-based distro.

I have created a repo with a minimal testcase for running TensorFlow here: https://github.com/mschwaig/tensorflow-hello-world-nix-flake.

This works on x86_64-linux and builds properly runnable thing, but on aarch64-linux both nix build and nix develop fail like this:

mschwaig@mschwaig-lamb:~/tensorflow-hello-world-nix-flake$ nix build  
warning: unknown setting 'experimental-features'
builder for '/nix/store/vfrbnxpz9zwzllhrp96zjngz6681wlr9-python3.8-google-auth-1.24.0.drv' failed with exit code 1; last 10 log lines:
  installing
  Executing pipInstallPhase
  /build/google-auth-1.24.0/dist /build/google-auth-1.24.0
  Processing ./google_auth-1.24.0-py2.py3-none-any.whl
  Requirement already satisfied: rsa<5,>=3.1.4 in /nix/store/zfhs95j11lardkrmdnzdga2k804j0d7s-python3.8-rsa-4.6/lib/python3.8/site-packages (from google-auth==1.24.0) (4.6)
  Requirement already satisfied: setuptools>=40.3.0 in /nix/store/a3npn2p0l2xpmsmcc8lnihr3kaipzws9-python3.8-setuptools-50.3.1/lib/python3.8/site-packages (from google-auth==1.24.0) (50.3.1.post0)
  Requirement already satisfied: cachetools<5.0,>=2.0.0 in /nix/store/dridwi27k9r0wk89kxj9jw8ffm06lcpb-python3.8-cachetools-4.2.1/lib/python3.8/site-packages (from google-auth==1.24.0) (4.2.1)
  Requirement already satisfied: pyasn1-modules>=0.2.1 in /nix/store/dp3lp9c61qbnr11v1zwqq24sszxrbisi-python3.8-pyasn1-modules-0.2.8/lib/python3.8/site-packages (from google-auth==1.24.0) (0.2.8)
  ERROR: Could not find a version that satisfies the requirement six>=1.9.0 (from google-auth)
  ERROR: No matching distribution found for six>=1.9.0
cannot build derivation '/nix/store/a8dwz3kbczp5j0rfvkj9rmfc4km159xa-python3-3.8.7-env.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/rv7rlh52q4bz8k3p34jbr19ra12fy168-python3.8-google-auth-oauthlib-0.4.2.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/c97sk5wlzkxxagdhnvzk9vdrrsb250v5-python3.8-tensorflow-tensorboard-2.4.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/6x9pd7v6zxpwy2ahx7h1li2arxq5mgz3-tensorflow-2.4.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/jyk69capr5j8pn74d3jwgvdi598d7g7a-python3.8-tensorflow-2.4.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/li75irpidlfl9dml8f2j86z0r7gvdbk6-python3.8-tensorflow-hello-world-0.1.0.drv': 1 dependencies couldn't be built
error: --- Error ------------------------------------------------------------------------------------- nix
build of '/nix/store/li75irpidlfl9dml8f2j86z0r7gvdbk6-python3.8-tensorflow-hello-world-0.1.0.drv' failed
mschwaig@mschwaig-lamb:~/tensorflow-hello-world-nix-flake$

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
mschwaigcommented, Apr 18, 2021

Since https://github.com/NixOS/nixpkgs/pull/117004 was merged, to staging and then eventually to master, the test project in my repo is building now. It takes quite some time to build tensorflow for aarch64-linux though. I have not checked again if I can get a binary artifact from some provider.

I think this can be closed now so I’m doing that. Thanks for your help @DavHau.

1reaction
DavHaucommented, Feb 25, 2021

Hey, I’m not quite sure yet why the six dependency gets lost. (I will have a deeper look). But there is a simple workaround you can do. Just add six >= 1.9.0 to your requirements and add it as a dependency to google auth via override:

mach-nix.mkPython {
  ...
  _.google-auth.propagatedBuildInputs.mod = pySelf: _: oldVal: oldVal ++ [ pySelf.six ];
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Install Tensorflow in AARCH64 Framework - Medium
3. Set Configuration. use command: ./configure. then console will ask lots of question about your setting. (Just Check options ...
Read more >
Installation of Tensorflow on aarch64: Error: Could not find a ...
I found the issue on https://github.com/lhelontra/tensorflow-on-arm/issues/13 . In short, I was missing certain preliminaries under aarch64 ...
Read more >
Cross compilation TensorFlow Lite with CMake
This page describes how to build the TensorFlow Lite library for various ARM devices. The following instructions have been tested on Ubuntu ...
Read more >
TensorFlow ARM Setup - Guides - Codeplay Developer
For 64-bit ARM CPUs: · tar -xf ComputeCpp-CE-1.1. · wget https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/gcc-linaro-6.3.1- ...
Read more >
platerecognizer/l4t-tensorflow-protobuf-gstreamer:r32.6.1-tf1 ...
|4 HDF5_DIR=/usr/lib/aarch64-linux-gnu/hdf5/serial/ MAKEFLAGS=-j$(nproc) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found