Error building tensorflow using bazel in a docker container - windows

I installed docker toolbox in windows, and I also pulled images for tensorflow and bazel.
When i run bazel in docker as follows:
docker run -it insready/bazel:latest bash
the bazel runs, but no tensorflow in workplace, as I "git clone tensorflow", i can run as:
bazel build tensorflow/python/tools:optimize_for_inference
erros occured that the protobuf file not download!
How can i optimize the tensorflow model (.pb file) with bazel tools in order to build the app in a android envionment?
root#8f43a8b6c598:/usr/src/app/tensorflow# bazel build tensorflow/python/tools:o
ptimize_for_inference
Extracting Bazel installation...
..............................
ERROR: /usr/src/app/tensorflow/tensorflow/python/tools/BUILD:147:1: error loadin
g package 'tensorflow/core': Encountered error while reading extension file 'pro
tobuf.bzl': no such package '#protobuf//': Traceback (most recent call last):
File "/u_apply_patch(repo_ctx, repo_ctx.attr.patch_file) line 119
File "/u_execute_and_check_ret_code(repo_ctx, cmd).bzl", line 110, in _a
pply_patFile "/usr/src/app/tensorflow/tensorflow/workspace.bzl", line 94, in _ex
ecute_and_check_fail("Non-zero return code({1}) when ..., <2 more arguments>))
Non-zero return code(256) when executing 'patch -p1 -d /root/.cache/bazel/_bazel
_root/fcc55b35a14d93d1b456fb4b036f6add/external/protobuf -i /usr/src/app/tensorf
low/third_party/protobuf/add_noinlines.patch':
Stdout:
Stderr: java.io.IOException: Cannot run program "patch" (in directory "/root/.ca
che/bazel/_bazel_root/fcc55b35a14d93d1b456fb4b036f6add/external/protobuf"): erro
r=2, No such file or directory and referenced by '//tensorflow/python/tools:opti
mize_for_inference'.
ERROR: Analysis of target '//tensorflow/python/tools:optimize_for_inference' fai
led; build aborted.

Based on your error message:
Cannot run program "patch"
Maybe patch is not installed, try apt-get install patch ?

Related

Heroku deployment failed of missing mariadb-config or MariaDB connector from remote DB

Wanted to make run my Python Flask project via Heroku (it's the first time I am using it). The case is, that I connect to a remote MariaDB on a Ubuntu VM.
When I try to push from local git I get an error to be related to the MariaDB. Is there an idea how I can solve this problem?
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
/bin/sh: 1: mariadb_config: not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-2j753bw3/mariadb_0c456c224d01457ab040c19f32e1f9ee/setup.py", line 26, in <module>
cfg = get_config(options)
File "/tmp/pip-install-2j753bw3/mariadb_0c456c224d01457ab040c19f32e1f9ee/mariadb_posix.py", line 63, in get_config
cc_version = mariadb_config(config_prg, "cc_version")
File "/tmp/pip-install-2j753bw3/mariadb_0c456c224d01457ab040c19f32e1f9ee/mariadb_posix.py", line 28, in mariadb_config
raise EnvironmentError(
OSError: mariadb_config not found.
This error typically indicates that MariaDB Connector/C, a dependency which must be preinstalled,
is not found.
If MariaDB Connector/C is not installed, see installation instructions
at: https://github.com/mariadb-corporation/mariadb-connector-c/wiki/install.md.
If MariaDB Connector/C is installed, either set the environment variable MARIADB_CONFIG or edit
the configuration file 'site.cfg' to set the 'mariadb_config' option to the file location of the
mariadb_config utility.
[end of output]
It looks like you need the mariadb_config utility at compile time. This is likely because whatever Python driver you are using requires it.
mariadb_config is available in the libmariadb-dev Ubuntu package. You'll need to install that using the Apt buildpack.
Add the buildpack:
heroku buildpacks:add --index 1 heroku-community/apt
That buildpack doesn't do dependency resolution, so you'll have to list all transitive dependencies.
Create a new file called Aptfile (no extension) that lists the dependencies you wish to install:
mysql-common
mariadb-common
libmariadb3
libmariadb-dev
Commit your Aptfile and redeploy.

Getting error while running mediapipe on macOS; Building C++ command-line example apps

I am trying to use mediapipe for a university project and have installed it, even successfully ran the Hello World! in C++ example app but when I am trying to build the C++ command-line example, it is giving me errors.
I ran this:
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu
and the result I got is this:
DEBUG: /private/var/tmp/_bazel_kanzashaikh/c191ae13e9137350b50f6a19ce94bf21/external/rules_foreign_cc/workspace_definitions.bzl:15:10: WARNING: This branch is deprecated and no longer recieving updates. Please update to main or choose a specific commit to pin in your workspace.
INFO: Build option --compilation_mode has changed, discarding analysis cache.
ERROR: Error fetching repository: java.io.IOException: The repository's path is "/usr/local/opt/opencv#3" (absolute: "/usr/local/opt/opencv#3") but this directory does not exist.
ERROR: /Users/kanzashaikh/development/mediapipe/third_party/BUILD:178:6: //third_party:opencv_binary depends on #macos_opencv//:opencv in repository #macos_opencv which failed to fetch. no such package '#macos_opencv//': The repository's path is "/usr/local/opt/opencv#3" (absolute: "/usr/local/opt/opencv#3") but this directory does not exist.
ERROR: Analysis of target '//mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.194s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 237 targets co
nfigured)
How do I solve it?
before building desktop examples, you should setup opencv. also for android examples you should setup android sdk and ndk.
there is a builtin script for setting up opencv and you can execute it.
for setting up opencv:
bash setup_opencv.sh
and for android sdk and ndk:
bash setup_android_sdk_and_ndk.sh
I am assuming you are running a M1 machine, as Homebrew is now installing Intel binaries under /usr/local and ARM ones under /opt/homebrew.
In your case, when building, bazel is looking for opencv#3 package at /usr/local/opt/opencv#3 and immediately throws an error as the package is located at /opt/homebrew/opt/opencv#3.
Thus, you have two choices:
Open WORKSPACE file from your bazel project and modify the path for each package accordingly
Make a symbolic link to /opt/homebrew/opt in /usr/local by running: sudo ln -s /opt/homebrew/opt opt

How can I fix the following Google Cloud Platform deployment error? [Error 2]

I'm trying to deploy my web-app to Google Cloud Platform, and I got an error while deploying. I understand that last package (go-sqlite3) needs gcc compiler, and Google Cloud WM has it:
$which gcc
/usr/bin/gcc
but it won't work
Step 3 : RUN go-wrapper install -tags appenginevm
---> Running in b0f03024342d
+ exec go install -v -tags appenginevm
github.com/mattn/go-colorable
github.com/mattn/go-isatty
github.com/labstack/gommon/color
github.com/valyala/fasttemplate/vendor/github.com/valyala/bytebufferpool
github.com/valyala/fasttemplate
github.com/labstack/gommon/log
golang.org/x/crypto/acme
golang.org/x/crypto/acme/autocert
github.com/labstack/echo
golang.org/x/net/context
github.com/mattn/go-sqlite3
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in $PATH
The command '/bin/sh -c go-wrapper install -tags appenginevm' returned a non-zero code: 2
ERROR
ERROR: build step "gcr.io/cloud-builders/docker#sha256:926dc1a14e6f7eb5b3462b5c1d491aa6c73090291167ac2bf181c026b05f19da" failed: exit status 2
You have to make your path correct by following command on your shell.
PATH=/usr/bin:$PATH

Error while installing sentry `unable to execute 'clang': No such file or directory`

I am trying to install sentry by following the instruction from the link:
However when I try to execute command pip install -U sentry, I receive the error InstallationError: Command python setup.py egg_info failed with error code 1 in /webapps/sentry/env/build/symsynd
Here is the detail from log file:
self.run_setup(setup_script, setup_base, args)
File "/webapps/sentry/env/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1003, in run_setup
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with 1
Complete output from command python setup.py egg_info:
unable to execute 'clang': No such file or directory
unable to execute 'clang': No such file or directory
No working compiler found, or bogus compiler options
passed to the compiler from Python's distutils module.
See the error messages above.
It would be nice if someone can figure out what am I doing wrong.
Thank you,
Vady
You need a C compiler to build the symsynd dependency.
If you are on a Debian based distribution (Ubuntu, etc.) just do :
sudo apt-get install clang
It seems that specifying a C compiler will be ok, but not. In some packages clang is hard-coded. The only way is to install clang.

How to build a shared library for TensorFlow on Travis-CI

I'm assisting in building a Ruby-wrapper for TensorFlow. Obviously. we'd want to setup automatic test of the project and so I'm currently trying struggling to configure Travis-CI to build the project and run tests like I can on my own machine (OSX El Capitan).
My question is: What is the magic that needs to go in the .travis.yml-file to properly bazel build a shared lib (tensorflow.so) for TensorFlow?
As far as I can tell, I've successfully installed TensorFlow's dependencies, including Google's build tool Bazel, but Travis-CI still can't build. As of this writing the bazel build command fails with the message:
...
...
INFO: Building...
[1 / 13] Writing file external/gif_archive/libgif.so-2.params
[3 / 13] Compiling external/gif_archive/giflib-5.1.4/lib/egif_lib.c
ERROR: /home/travis/.cache/bazel/_bazel_travis/1a58902034d650eeef2a9da5b1248179/external/gif_archive/BUILD:14:1: C++ compilation of rule '#gif_archive//:gif' failed: namespace-sandbox failed: error executing command
(cd /home/travis/.cache/bazel/_bazel_travis/1a58902034d650eeef2a9da5b1248179/execroot/tensorflow && \
exec env - \
...
...
The command "bazel build --verbose_failures=1 #gif_archive//:gif" failed and exited with 1 during .
https://travis-ci.org/chrhansen/tensorflow.rb/builds/145716589
Note: I've noticed that the guys over at github.com/node-tensorflow/node-tensorflow successfully made this happen: https://travis-ci.org/node-tensorflow/node-tensorflow/builds
UPDATE: https://github.com/tensorflow/tensorflow/issues/3374
The issue has been solved (https://github.com/tensorflow/tensorflow/issues/3374), you should be able to build tensorflow with sandbox enabled.

Resources