buildozer - C compiler cannot create executables - buildozer

When I run
buildozer -v android debug
It ends with this error
[INFO]: -> running configure --host=arm-linux-androideabi --prefix=/home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/...(and 94 more)
working: See `config.log' for more details Exception in thread background thread for pid 14805:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 1633, in wrap
fn(*rgs, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 2557, in background_thread
handle_exit_code(exit_code)
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 2261, in fn
return self.command.handle_command_exit_code(exit_code)
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 861, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_77:
RAN: /home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/configure --host=arm-linux-androideabi --prefix=/home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi --disable-builddir --enable-shared
STDOUT:
checking build system type... i686-pc-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking target system type... arm-unknown-linux-androideabi
checking for gsed... sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-androideabi-strip... arm-linux-androideabi-strip --strip-unneeded
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make -j4 sets $(MAKE)... yes
checking whether make -j4 supports nested variables... yes
checking for arm-linux-androideabi-gcc... /usr/bin/ccache /home/astrilaa/.buildozer/android/platform/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC
checking whether the C compiler works... no
configure: error: in `/home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi':
configure: error: C compiler cannot create executables
See `config.log' for more details
STDERR:
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1260, in <module>
main()
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
ToolchainCL()
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 709, in __init__
getattr(self, command)(args)
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 154, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 213, in build_dist_from_args
build_recipes(build_order, python_modules, ctx,
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 577, in build_recipes
recipe.build_arch(arch)
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/recipes/libffi/__init__.py", line 42, in build_arch
shprint(sh.Command('./configure'),
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 167, in shprint
for line in output:
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 907, in next
self.wait()
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 837, in wait
self.handle_command_exit_code(exit_code)
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 861, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_77:
RAN: /home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/configure --host=arm-linux-androideabi --prefix=/home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi --disable-builddir --enable-shared
STDOUT:
checking build system type... i686-pc-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking target system type... arm-unknown-linux-androideabi
checking for gsed... sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-androideabi-strip... arm-linux-androideabi-strip --strip-unneeded
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make -j4 sets $(MAKE)... yes
checking whether make -j4 supports nested variables... yes
checking for arm-linux-androideabi-gcc... /usr/bin/ccache /home/astrilaa/.buildozer/android/platform/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC
checking whether the C compiler works... no
configure: error: in `/home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi':
configure: error: C compiler cannot create executables
See `config.log' for more details
STDERR:
# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21 --ignore-setup-py
# ENVIRONMENT:
# LC_ALL = 'en_US.UTF-8'
# LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
# LESSCLOSE = '/usr/bin/lesspipe %s %s'
# LANG = 'en_US.UTF-8'
# DISPLAY = ':0'
# OLDPWD = '/home/astrilaa/kivycalc/.buildozer'
# INVOCATION_ID = 'cab34536ffa845888abc885580633b58'
# COLORTERM = 'truecolor'
# XDG_VTNR = '7'
# SSH_AUTH_SOCK = '/tmp/ssh-gVp07qexptPM/agent.3275'
# MANDATORY_PATH = '/usr/share/gconf/i3.mandatory.path'
# CLASSPATH = ':/home/astrilaa/.s/java/classes/swt.jar'
# XDG_SESSION_ID = '4'
# USER = 'astrilaa'
# DESKTOP_SESSION = 'i3'
# DEFAULTS_PATH = '/usr/share/gconf/i3.default.path'
# PWD = '/home/astrilaa/kivycalc'
# HOME = '/home/astrilaa'
# LC_CTYPE = 'en_US.UTF-8'
# JOURNAL_STREAM = '9:21013'
# aimages = '/home/astrilaa/Anki/ast/collection.media'
# SSH_AGENT_PID = '3337'
# XDG_DATA_DIRS = '/usr/share/i3:/usr/local/share/:/usr/share/'
# SHELL = '/bin/bash'
# VTE_VERSION = '5202'
# TERM = 'xterm-256color'
# XDG_CURRENT_DESKTOP = 'i3'
# GPG_AGENT_INFO = '/run/user/1000/gnupg/S.gpg-agent:0:1'
# PYTHONSTARTUP = '/home/astrilaa/.pythonrc'
# SHLVL = '1'
# XDG_SEAT = 'seat0'
# LOGNAME = 'astrilaa'
# DBUS_SESSION_BUS_ADDRESS = 'unix:abstract=/tmp/dbus-BWRyA4OC8j,guid=838c372083700fa9dddc18065f7f826d'
# XDG_RUNTIME_DIR = '/run/user/1000'
# XAUTHORITY = '/home/astrilaa/.Xauthority'
# XDG_CONFIG_DIRS = '/etc/xdg/xdg-i3:/etc/xdg'
# PATH = ('/home/astrilaa/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/astrilaa/bin:/home/astrilaa/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/astrilaa/.s/daetd:/home/astrilaa/.s/daetd/scripts:/home/astrilaa/.s/daetd/bkstree:/home/astrilaa/.s/daetd/rone:usr/local/bin/adt-bundle-linux-x86-20130219/sdk/platform-tools:/home/astrilaa/.wine/drive_c/Program '
'Files/VW/VT/Paul/M16-SAPI5/lib/:/home/astrilaa/android-sdks/tools:/home/astrilaa/android-sdks/platform-tools:/home/astrilaa/android-sdks/tools/bin')
# PS1 = '[\\u#\\h \\W]$(git_branch)$ '
# LESSOPEN = '| /usr/bin/lesspipe %s'
# _ = '/usr/local/bin/buildozer'
# PACKAGES_PATH = '/home/astrilaa/.buildozer/android/packages'
# ANDROIDSDK = '/home/astrilaa/.buildozer/android/platform/android-sdk'
# ANDROIDNDK = '/home/astrilaa/.buildozer/android/platform/android-ndk-r19c'
# ANDROIDAPI = '27'
# ANDROIDMINAPI = '21'
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
I ended in this state after I overcame this problem.
My buildozer wasn't able to download NDK (it wanted r19c), so I downloaded this one. I tried it on Python3.6, Python3.7 and Python3.8
on Ubuntu 18.04 32 bit (i686) architecture.

I believe the problem is you are running command on 32bit operating system. As mentioned in the BUG #1007
Thanks, I saw the logs.. But The Problem was that I was using a 32 bit
linux system. So the drivers could not work. Then when I tried the
same thing in a 64 bit linux system. Installed on virtual machine it
worked fine. Thanks for your help.

This is a simple and obvious fix(others told me)
you need to
chmod +x -R ~/Android/android-ndk-r25b
where your android ndk is

Related

"No CMAKE_CXX_COMPILER could be found" errror while deploying flask app on gcloud

I have a flask application that I'm deploying on google cloud run. The app using a library 'face_recognition' that requires Cmake. I'm installing the CMake by running a command in DockerFile but getting an error. I don't know what it mean.
Here is my Dockerfile
# Use the official lightweight Python image.
# https://hub.docker.com/_/python
FROM python:3.9-slim
# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True
# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
# Install production dependencies.
RUN apt-get update && apt-get install -y cmake
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install gunicorn
# Run the web service on container startup. Here we use the gunicorn
# webserver, with one worker process and 8 threads.
# For environments with multiple CPU cores, increase the number of workers
# to be equal to the cores available.
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
Here is the error
CMake Error at CMakeLists.txt:14 (project):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-2m1peq73/dlib_d6f82528b68745578021b2f234f89d7c/build/temp.linux-x86_64-3.9/CMakeFiles/CMakeOutput.log".
See also "/tmp/pip-install-2m1peq73/dlib_d6f82528b68745578021b2f234f89d7c/build/temp.linux-x86_64-3.9/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-2m1peq73/dlib_d6f82528b68745578021b2f234f89d7c/setup.py", line 222, in <module>
setup(
File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.9/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/local/lib/python3.9/distutils/command/install.py", line 546, in run
self.run_command('build')
File "/usr/local/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.9/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/local/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-2m1peq73/dlib_d6f82528b68745578021b2f234f89d7c/setup.py", line 134, in run
self.build_extension(ext)
File "/tmp/pip-install-2m1peq73/dlib_d6f82528b68745578021b2f234f89d7c/setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "/usr/local/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
The container base python:3.9-slim is very stripped down. If your application requires CMake which often implies the gcc compiler as well,
you have at least two options:
Use a more feature rich base container such as debian:buster
Choose a container with those tools already configured.
Example Dockerfile to build a base container:
FROM debian:buster
RUN apt update && apt install -y gcc clang clang-tools cmake python3
You can then use that container as the base for future containers or modify the Dockerfile to include your application.
Docker debian:buster

Troubles with bazel and building tensorflow on ubuntu

I'm trying to build tensorflow on ubuntu using bazel, I failed using bazelisk and bazel. There is some silly bug with the installer. I'm really having hard time because of the awful documentation of building tensorflow from source found here
wget https://github.com/bazelbuild/bazel/releases/download/0.27.1/bazel-0.27.1-installer-linux-x86_64.sh
chmod +x bazel-0.27.1-installer-linux-x86_64.sh
./bazel-0.27.1-installer-linux-x86_64.sh --user
export PATH="$PATH:$HOME/bin"
git clone https://github.com/tensorflow/tensorflow
cd tensorflow
./configure
Out:
INFO: Options provided by the client:
Inherited 'common' options: --isatty=1 --terminal_columns=80
INFO: Reading rc options for 'version' from /home/emadboctor/tensorflow/.bazelrc:
Inherited 'common' options: --experimental_repo_remote_exec
ERROR: Unrecognized option: --experimental_repo_remote_exec
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
Traceback (most recent call last):
File "./configure.py", line 1553, in <module>
main()
File "./configure.py", line 1370, in main
_TF_MAX_BAZEL_VERSION)
File "./configure.py", line 485, in check_bazel_version
['bazel', '--batch', '--bazelrc=/dev/null', 'version'])
File "./configure.py", line 161, in run_shell
output = subprocess.check_output(cmd, stderr=stderr)
File "/usr/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['bazel', '--batch', '--bazelrc=/dev/null', 'version']' returned non-zero exit status 2
And this keeps happening with version 0.25.1 and 0.19.1
and when I try this version of installation:
sudo apt install curl
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
sudo apt update && sudo apt install bazel
sudo apt update && sudo apt full-upgrade
sudo apt install bazel-1.0.0
cd tensorflow
./configure
This issue comes up:
Traceback (most recent call last):
File "./configure.py", line 1553, in <module>
main()
File "./configure.py", line 1370, in main
_TF_MAX_BAZEL_VERSION)
File "./configure.py", line 485, in check_bazel_version
['bazel', '--batch', '--bazelrc=/dev/null', 'version'])
File "./configure.py", line 161, in run_shell
output = subprocess.check_output(cmd, stderr=stderr)
File "/usr/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['bazel', '--batch', '--bazelrc=/dev/null', 'version']' returned non-zero exit status 1
So I try following the guide found here
sudo apt update
sudo apt dist-upgrade
sudo apt install git openjdk-8-jdk curl
sudo apt install python3-dev python3-pip python3-numpy
sudo apt install pkg-config zip g++ zlib1g-dev unzip
wget https://github.com/bazelbuild/bazel/releases/download/0.19.2/bazel-0.19.2-installer-linux-x86_64.sh
chmod +x bazel-0.19.2-installer-linux-x86_64.sh
sudo ./bazel-0.19.2-installer-linux-x86_64.sh
sudo swapoff /swapfile
sudo fallocate -l 16G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git checkout r2.1
Same error as before:
Extracting Bazel installation...
INFO: Options provided by the client:
Inherited 'common' options: --isatty=1 --terminal_columns=80
INFO: Reading rc options for 'version' from /home/emadboctor/tensorflow/.bazelrc:
Inherited 'common' options: --experimental_repo_remote_exec
ERROR: Unrecognized option: --experimental_repo_remote_exec
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
Traceback (most recent call last):
File "./configure.py", line 1553, in <module>
main()
File "./configure.py", line 1370, in main
_TF_MAX_BAZEL_VERSION)
File "./configure.py", line 485, in check_bazel_version
['bazel', '--batch', '--bazelrc=/dev/null', 'version'])
File "./configure.py", line 161, in run_shell
output = subprocess.check_output(cmd, stderr=stderr)
File "/usr/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['bazel', '--batch', '--bazelrc=/dev/null', 'version']' returned non-zero exit status 2
so I try bazelisk(and this is supposed to install the correct version of bazel):
Here are the exact steps:
sudo apt-get update && sudo apt-get upgrade
sudo apt install python-dev python-pip # or python3-dev python3-pip
pip install -U --user pip six numpy wheel setuptools mock 'future>=0.17.1'
pip install -U --user keras_applications --no-deps
pip install -U --user keras_preprocessing --no-deps
then I install go using this
cd /tmp
wget https://dl.google.com/go/go1.11.linux-amd64.tar.gz
sudo tar -xvf go1.11.linux-amd64.tar.gz
sudo mv go /usr/local
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
source ~/.profile
Then I install bazelisk using this
go get github.com/bazelbuild/bazelisk
export PATH=$PATH:$(go env GOPATH)/bin
then I try to configure again:
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
./configure
Out:
Extracting Bazel installation...
INFO: Options provided by the client:
Inherited 'common' options: --isatty=1 --terminal_columns=80
INFO: Reading rc options for 'version' from /tmp/tensorflow/.bazelrc:
Inherited 'common' options: --experimental_repo_remote_exec
ERROR: Unrecognized option: --experimental_repo_remote_exec
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
Traceback (most recent call last):
File "./configure.py", line 1553, in <module>
main()
File "./configure.py", line 1370, in main
_TF_MAX_BAZEL_VERSION)
File "./configure.py", line 485, in check_bazel_version
['bazel', '--batch', '--bazelrc=/dev/null', 'version'])
File "./configure.py", line 161, in run_shell
output = subprocess.check_output(cmd, stderr=stderr)
File "/usr/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['bazel', '--batch', '--bazelrc=/dev/null', 'version']' returned non-zero exit status 2
Then I retry this, I get new error:
Extracting Bazel installation...
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 0.19.2 installed.
Please upgrade your bazel installation to version 0.27.1 or higher to build TensorFlow!
So I install 0.27.1 in the following way:
wget https://github.com/bazelbuild/bazel/releases/download/0.27.1/bazel-0.27.1-installer-linux-x86_64.sh
chmod +x bazel-0.27.1-installer-linux-x86_64.sh
./bazel-0.27.1-installer-linux-x86_64.sh --user
export PATH="$PATH:$HOME/bin"
cd tensorflow
./configure
I get the same error even after installing the required version
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 0.19.2 installed.
Please upgrade your bazel installation to version 0.27.1 or higher to build TensorFlow!
and this is the output of bazel version:
Starting local Bazel server and connecting to it...
Build label: 0.19.2
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Nov 19 16:25:09 2018 (1542644709)
Build timestamp: 1542644709
Build timestamp as int: 1542644709
Your checkout of the Tensorflow source code requires Bazel 2.0.0, because of the use of the --experimental_repo_remote_exec flag.
Also see https://github.com/tensorflow/tensorflow/issues/37474
You almost got it right with bazelisk. go get github.com/bazelbuild/bazelisk installs bazelisk as bazelisk. Instead, download bazelisk, and create a symlink at ~/bin/bazel to point to bazelisk. This way, TensorFlow's configure script can successfully pick up bazelisk as bazel.
go get github.com/bazelbuild/bazelisk
mkdir -p ~/bin
ln -s $(go env GOPATH)/bin/bazelisk ~/bin/bazel
export PATH=$HOME/bin:$PATH

CuPy installatioin fails on Mac OS X 10.13.6 using pip

On MacOS HighSierra 10.13.6 with Python 3.5.7 and Cuda 10.1
Both
pip3.5 install cupy-cuda101
and
pip3.5 install cupy
fail, with different issues.
First attempt:
pip3.5 install cupy-cuda101 -vvvv
Collecting cupy-cuda101
1 location(s) to search for versions of cupy-cuda101:
* https://pypi.org/simple/cupy-cuda101/
Getting page https://pypi.org/simple/cupy-cuda101/
Looking up "https://pypi.org/simple/cupy-cuda101/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/cupy-cuda101/ HTTP/1.1" 304 0
Analyzing links from page https://pypi.org/simple/cupy-cuda101/
Skipping link https://files.pythonhosted.org/packages/7c/cb/94b7aafd2344daf41c13bd152db14ed7eb2928be62575bc1421d94fbb490/cupy_cuda101-5.4.0-cp27-cp27mu-manylinux1_x86_64.whl#sha256=c422b46fc22232578d82168d73d2fd45d4ae303adad9e9e2bb6a60f6984e0438 (from https://pypi.org/simple/cupy-cuda101/); it is not compatible with this Python
[last line repeated for all ...]
ERROR: Could not find a version that satisfies the requirement cupy-cuda101 (from versions: none)
Cleaning up...
Removed build tracker '/private/var/folders/bz/cv2cs9y14qx6s5qf4hkz08s00000gn/T/pip-req-tracker-gfr00q13'
ERROR: No matching distribution found for cupy-cuda101
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/pip/_internal/cli/base_command.py", line 178, in main
status = self.run(options, args)
File "/usr/local/lib/python3.5/site-packages/pip/_internal/commands/install.py", line 352, in run
resolver.resolve(requirement_set)
File "/usr/local/lib/python3.5/site-packages/pip/_internal/resolve.py", line 131, in resolve
self._resolve_one(requirement_set, req)
File "/usr/local/lib/python3.5/site-packages/pip/_internal/resolve.py", line 294, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/local/lib/python3.5/site-packages/pip/_internal/resolve.py", line 242, in _get_abstract_dist_for
self.require_hashes
File "/usr/local/lib/python3.5/site-packages/pip/_internal/operations/prepare.py", line 282, in prepare_linked_requirement
req.populate_link(finder, upgrade_allowed, require_hashes)
File "/usr/local/lib/python3.5/site-packages/pip/_internal/req/req_install.py", line 198, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/local/lib/python3.5/site-packages/pip/_internal/index.py", line 792, in find_requirement
'No matching distribution found for %s' % req
pip._internal.exceptions.DistributionNotFound: No matching distribution found for cupy-cuda101
2nd attempt:
pip3.5 install cupy -vvvv
[...]
************************************************************
* CuPy Configuration Summary *
************************************************************
Build Environment:
Include directories: ['/usr/local/cuda/include']
Library directories: ['/usr/local/cuda/lib', '/usr/local/cuda/lib']
nvcc command : ['/usr/local/cuda/bin/nvcc']
Environment Variables:
CFLAGS : (none)
LDFLAGS : (none)
LIBRARY_PATH : (none)
CUDA_PATH : (none)
NVTOOLSEXT_PATH : (none)
NVCC : (none)
Modules:
cuda : Yes (version 10010)
cudnn : No
-> Include files not found: ['cudnn.h']
-> Check your CFLAGS environment variable.
nccl : No
-> Include files not found: ['nccl.h']
-> Check your CFLAGS environment variable.
cusolver : Yes
nvtx : Yes
thrust : Yes
WARNING: Some modules could not be configured.
CuPy will be installed without these modules.
Please refer to the Installation Guide for details:
https://docs-cupy.chainer.org/en/stable/install.html
************************************************************
[...]
copying cupy/cuda/cupy_thrust.cu -> build/lib.macosx-10.13-x86_64-3.5/cupy/cuda
running build_ext
building 'cupy.core._dtype' extension
creating build/temp.macosx-10.13-x86_64-3.5
creating build/temp.macosx-10.13-x86_64-3.5/cupy
creating build/temp.macosx-10.13-x86_64-3.5/cupy/core
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -D_FORCE_INLINES=1 -I/usr/local/cuda/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python35/3.5.7_1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c cupy/core/_dtype.cpp -o build/temp.macosx-10.13-x86_64-3.5/cupy/core/_dtype.o
cupy/core/_dtype.cpp:3068:52: warning: code will never be executed [-Wunreachable-code]
} else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
^~~~
cupy/core/_dtype.cpp:3068:38: note: silence by adding parentheses to mark code as explicitly dead
} else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
^
/* DISABLES CODE */ ( )
1 warning generated.
clang++ -bundle -undefined dynamic_lookup -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk build/temp.macosx-10.13-x86_64-3.5/cupy/core/_dtype.o -L/usr/local/cuda/lib -L/usr/local/cuda/lib -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -L/usr/local/cuda/lib -L/usr/local/cuda/lib -lcublas -lcuda -lcudart -lcufft -lcurand -lcusparse -lnvrtc -o build/lib.macosx-10.13-x86_64-3.5/cupy/core/_dtype.cpython-35m-darwin.so -Wl,-rpath,/usr/local/cuda/lib,-rpath,/usr/local/cuda/lib -mmacosx-version-min=10.5
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang++' failed with exit status 1
error
ERROR: Failed building wheel for cupy
[...]
Any ideas what I'm doing wrong?
Update: Removed the Homebrew version of python 3.5 and installed the latest python 3.7 version using a conda installer and
pip install cupy
was successful.

Tensorflow build error : Cannot find cudnn.h under ~

I am trying to build tensorflow r1.12 using bazel 0.15 on Redhat 7.5 ppc64le.
I am stuck with the following error.
[u0017649#sys-97184 tensorflow]$ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
...
ERROR: error loading package 'tensorflow/tools/pip_package': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package
'#local_config_cuda//cuda': Traceback (most recent call last):
File
"/home/u0017649/files/tensorflow/third_party/gpus/cuda_configure.bzl", line 1447
_create_local_cuda_repository(repository_ctx)
File
"/home/u0017649/files/tensorflow/third_party/gpus/cuda_configure.bzl", line 1187, in _create_local_cuda_repository
_get_cuda_config(repository_ctx)
File
"/home/u0017649/files/tensorflow/third_party/gpus/cuda_configure.bzl", line 911, in _get_cuda_config
_cudnn_version(repository_ctx, cudnn_install_base..., ...)
File
"/home/u0017649/files/tensorflow/third_party/gpus/cuda_configure.bzl", line 582, in _cudnn_version
_find_cudnn_header_dir(repository_ctx, cudnn_install_base...)
File
"/home/u0017649/files/tensorflow/third_party/gpus/cuda_configure.bzl", line 869, in _find_cudnn_header_dir
auto_configure_fail(("Cannot find cudnn.h under %s" ...))
File
"/home/u0017649/files/tensorflow/third_party/gpus/cuda_configure.bzl", line 317, in auto_configure_fail
fail(("\n%sCuda Configuration Error:%...)))
Cuda Configuration Error: Cannot find cudnn.h under /usr/local/cuda-9.2/targets/ppc64le-linux/lib
I do have a soft link for cudnn.h under /usr/local/cuda-9.2/targets/ppc64le-linux/lib as below.
[u0017649#sys-97184 tensorflow]$ ls -l /usr/local/cuda-9.2/targets/ppc64le-linux/lib/cudnn.h
lrwxrwxrwx. 1 root root 57 Feb 20 10:15 /usr/local/cuda-9.2/targets/ppc64le-linux/lib/cudnn.h -> /usr/local/cuda-9.2/targets/ppc64le-linux/include/cudnn.h
Any comments, pls ?
After reading tensorflow/third_party/gpus/cuda_configure.bzl, I could solve this by the following.
$ sudo ln -sf /usr/local/cuda-9.2/targets/ppc64le-linux/include/cudnn.h /usr/include/cudnn.h

TensorFlow Tutorial on Sequence-to-Sequence Models: Running translate.py return CRC check failure

I am trying to run tutorial for sequence-to-sequence model, but running the following command
bazel run -c opt <...>/models/rnn/translate/translate.py --data_dir [your_data_directory]
ends with the following error
for line in gz_file:
File "/usr/lib/python2.7/gzip.py", line 462, in readline
c = self.read(readsize)
File "/usr/lib/python2.7/gzip.py", line 268, in read
self._read(readsize)
File "/usr/lib/python2.7/gzip.py", line 315, in _read
self._read_eof()
File "/usr/lib/python2.7/gzip.py", line 354, in _read_eof
hex(self.crc)))
IOError: CRC check failed 0xb94c52ed != 0xc6088f89L
ERROR: Non-zero return code '1' from command: Process exited with status 1.
Did I do something wrong, or is there (another) error in the tutorial?
Try to remove files in dir /tmp:
training-giga-fren.tar
giga-fren.release2.en.gz
giga-fren.release2.fr.gz
And then rerun
bazel run -c opt <...>/models/rnn/translate/translate.py --data_dir [your_data_directory]