-
Notifications
You must be signed in to change notification settings - Fork 74k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot build raspberry pi wheel for python 3.7 #35116
Comments
@fgervais Did you ever manage to build raspberry pi wheel for python 3.7? I am seeing the same behavior, builds for PI-PYTHON3 but not for PI-PYTHON37. I just booted up Ubuntu 19.10 armhf on my Raspberry Pi 4 device (which has python3.7 installed) and was hoping to give this a spin (I tried the arm64/aarch64 image as well, see below if you're interested). @petewarden Do you have any recommendations for getting TensorFlow running on RPI4? I noticed the Build from source for the Raspberry Pi instructions only cover armhf and not aarch64, kind of like Build TensorFlow Lite for Raspberry Pi covers RPI4 but only in the context of armhf (haven't tried this one just yet). I saw and tried the Build TensorFlow Lite for ARM64 boards instructions, but was unsuccessful at the time (sorry, I don't have the exact error at this moment). Anyways, any tips would be greatly appreciated. |
@settle I couldn't make it work, I changed my plan and built a docker image based on debian:stretch (which uses python 3.5) and added then tensorflow dependencies on top. See here: |
@fgervais Did you build a devel docker image that can build tensorflow inside it, or you just installed a tensorflow binary inside the docker image? If the former, could you share you Dockerfile? I've attempted to do that myself, but run into issues building bazel, see #37985. Btw, what would be your opinion of doing pip install vs. apt-get for the python packages in my Dockerfile. I ask because it's extremely slow to compile the python dependencies (specifically matplotlib and scipy) when using pip install and would be much faster installing the pre-built python packages and all their dependencies using apt-get. Some of the messages during pip install make me worried I still don't have all the dependencies. |
@settle I installed the tensorflow binary inside a docker image. I prefer to pip to install the dependencies to I get more control on the versions installed. It is slow, yes, but not too bad since I do it through docker |
@fgervais, you need to update CROSSTOOL_PYTHON_INCLUDE_PATH to point Python 3.7 header files. |
@terryheo I tried this today on r2.2 branch, but keep running into build errors related to memory consumption, see below. I don't know why since my build machine has 128 GB of RAM and I never see it coming near the limit in docker stats. ERROR: /workspace/tensorflow/compiler/mlir/lite/BUILD:547:1: C++ compilation of rule '//tensorflow/compiler/mlir/lite:flatbuffer_translate_lib' failed (Exit 1) |
@terryheo I've been rerunning the build script above to see if I can glean any more information and this time the error was more helpful, see below. Question is, how to increase the JRE memory size to this docker cross compilation build script flow? Or any other fix? ERROR: /workspace/tensorflow/core/kernels/BUILD:4101:1: C++ compilation of rule '//tensorflow/core/kernels:reduction_ops' failed (Exit 1) cc1plus: out of memory allocating 20521 bytes after a total of 1003520 bytes |
@settle interesting. I think you might want to check https://docs.bazel.build/versions/master/memory-saving-mode.html Just wondering, what's the output of following commands?
|
@terryheo I'm only familiar to using --local_ram_resources=2048 when building with bazel following the Build from source instructions. How exactly would I pass those memory saving mode like --host_jvm_args=-Xmx2g to this cross compilation flow? $ docker --version $ docker run tf_ci.pi-python37 cat /proc/meminfo |
You can have custom Bazel option with .bazelrc.user file. |
@terryheo Just to confirm and for reference, you mean try adding something like --memory=96g --memory-swap=4g to the docker run line in tensorflow/tools/ci_build/ci_build.sh? I just gave that a try, but noticed the following line printed so doesn't appear to have worked: "WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap." |
@terryheo Quick follow up, indeed the build continued to fail as before. After some searching I found how to modify my kernel with grub to allow the swap limit, see How to limit a docker container’s resources on ubuntu 18.04. After that I was able to successfully cross-compile build a whl, but it still shows the wrong python version, i.e., tensorflow-2.2.0-cp35-none-linux_armv7l.whl. Am I still doing something wrong?
If I try to change the CI_BUILD_PYTHON=python3 above to CI_BUILD_PYTHON=python3.7 then I get this error that didn't appear when I built the above whl file: ImportError: cannot import name 'multiarray' from 'numpy.core' (/usr/lib/python3/dist-packages/numpy/core/init.py) |
@settle Hello, I would like to build a wheel file for my Raspberry Pi 3B (Buster) with TensorFlow version 2.3.0rc0. However, the output I obtain is the wheel file for Python 3.5 like you... (tensorflow-2.3.0rc0-cp35-none-linux_armv7l.whl) |
I've also verified PI-PYTHON37 container doesn't work as expected. Please use Python 3.5 interpreter instead. |
I've found a solution. Let me prepare PR. |
In pi-python37 container, apt-get install doesn't install correct version. Update Dockerfile to use install_pip_packages_by_version.sh to install proper PIP packages for Python 3.7. This changes fixes issue #35116. Test: Use the following command to build RPI3 PIP wheel for Python 3.7. $ CI_DOCKER_EXTRA_PARAMS="-e CI_BUILD_PYTHON=python3.7 -e CROSSTOOL_PYTHON_INCLUDE_PATH=/usr/include/python3.7" \ tensorflow/tools/ci_build/ci_build.sh PI-PYTHON37 \ tensorflow/tools/ci_build/pi/build_raspberry_pi.sh PiperOrigin-RevId: 322486001 Change-Id: Ide83818522223dcbe43b16b971c3c5759d8c55ca
PR is merged. You can build RPI3 PIP wheel for Python 3.7 as following.
|
Please make sure that this is a build/installation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template
System information
I'm building using the docker image for a raspberry pi 3 build.
Describe the problem
I'm able to correctly build
tensorflow-2.1.0rc1-cp35-none-linux_armv7l.whl
using:I'm trying to do the same but with the python 3.7 docker images
PI-PYTHON37
(tensorflow/tools/ci_build/Dockerfile.pi-python37
) but it fails with:Provide the exact sequence of commands / steps that you executed before running into the problem
Any other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
The text was updated successfully, but these errors were encountered: