While trying to install Tensorflow on my Raspberry Pi 3B as part of the g2p-seq2seq program I've run into a bit of an issue.
Using the guide here, I run into an error when executing the command:
bazel build -c opt --copt="-mfpu=neon" --local_resources 1024,1.0,1.0 --verbose_failures tensorflow/tools/pip_package:build_pip_package
I get the following error:
WARNING: Sandboxed execution is not supported on your system and thus hermeticity of actions cannot be guaranteed. See http://bazel.io/docs/bazel-user-manual.html#sandboxing for more information. You can turn off this warning via --ignore_unsupported_sandboxing.
ERROR: /home/pi/makevoicedemo/tf/tensorflow/tensorflow/tensorflow.bzl:571:26: Traceback (most recent call last):
File "/home/pi/makevoicedemo/tf/tensorflow/tensorflow/tensorflow.bzl", line 565
rule(attrs = {"srcs": attr.label_list..."), <3 more arguments>)}, <2 more arguments>)
File "/home/pi/makevoicedemo/tf/tensorflow/tensorflow/tensorflow.bzl", line 571, in rule
attr.label_list(cfg = "data", allow_files = True)
expected ConfigurationTransition or NoneType for 'cfg' while calling label_list but got string instead: data.
ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package '': Extension file 'tensorflow/tensorflow.bzl' has errors.
INFO: Elapsed time: 0.337s
I know the Warning notice is not that big of an issue, however I don't know how to fix the two Errors following that. The documentation I found for Tensorflow on Raspberry Pi regarding this issue is difficult to follow. If anyone has any advice I would appreciate it.
Sorry you're hitting problems! The errors looks like a bug, so could you file this over at https://github.com/tensorflow/tensorflow/issues?
Related
I just installed Snakemake (with sudo) on a shared system, and when I run it, even snakemake --version, I get the strange error:
murray#alina:~$ snakemake --version
/usr/local/lib/python3.7/site-packages/pulp/apis/gurobi_api.py:297: UserWarning: GUROBI error:
ERROR 10009: No Gurobi license found (user murray, host alina, hostid da781c18, cores 64)
.
warnings.warn('GUROBI error: {}.'.format(out))
5.31.1
I understand that this error is related to licensing issues with the Gurobi solver (or at least its API), that is installed on the system, however, why should running Snakemake elicit this error? Fixing this, or even just squelching the error (and the resulting gurobi.log file which gets created in the directory where the snakemake --version command is run) would be much appreciated.
I am new to tensorflow. I am studying the project deepspeechhttps://github.com/mozilla/DeepSpeech, but when I run evauate.py, I get the error:
ValueError: Scorer initialization failed with error code 1
the details as follows. Can anybody can help me resolve this issue, thanks!
Stack information:
File "/home/zhangp/Desktop/sr/DeepSpeech-master/evaluate.py", line 49, in evaluate
FLAGS.scorer_path, Config.alphabet)
File "/home/zhangp/.local/lib/python3.6/site-packages/ds_ctcdecoder/__init__.py", line 41, in __init__
raise ValueError('Scorer initialization failed with error code {}'.format(err))
ValueError: Scorer initialization failed with error code 1
Im not the most python / deepspeech expert out there but from their mozilla discourse and after facing the same issue. This is whats happening and its fix:
"It means the scorer hasn’t been installed You need to install git-lfs and do git lfs pull to download it.".
On MacOS git-lfs is installed via brew or apt-get install on linux, and then run "git lfs pull".
When building Chromium or libwebrtc with gn on macOS (Catalina 10.15), I get errors from the Python build scripts about bytes and str. For example:
src [heads/master●] % gn gen out/ios_64 --args='target_os="ios" target_cpu="arm64"'
ERROR at //build/config/ios/ios_sdk.gni:109:21: Script returned non-zero exit code.
_ios_sdk_result = exec_script(script_name, ios_sdk_info_args, "scope")
^----------
Current dir: /Users/lynn/code/webrtc_ios/src/out/ios_64/
Command: python /Users/lynn/code/webrtc_ios/src/build/config/mac/sdk_info.py --get_sdk_info iphoneos
Returned 1.
stderr:
Traceback (most recent call last):
File "/Users/lynn/code/webrtc_ios/src/build/config/mac/sdk_info.py", line 107, in <module>
FillXcodeVersion(settings, args.developer_dir)
File "/Users/lynn/code/webrtc_ios/src/build/config/mac/sdk_info.py", line 59, in FillXcodeVersion
settings['xcode_version'] = FormatVersion(lines[0].split()[-1])
File "/Users/lynn/code/webrtc_ios/src/build/config/mac/sdk_info.py", line 43, in FormatVersion
major, minor, patch = SplitVersion(version)
File "/Users/lynn/code/webrtc_ios/src/build/config/mac/sdk_info.py", line 30, in SplitVersion
version = version.split('.')
TypeError: a bytes-like object is required, not 'str'
See //build/config/sysroot.gni:67:3: whence it was imported.
import("//build/config/ios/ios_sdk.gni")
^--------------------------------------
See //build/config/linux/pkg_config.gni:5:1: whence it was imported.
import("//build/config/sysroot.gni")
^----------------------------------
See //BUILD.gn:15:1: whence it was imported.
import("//build/config/linux/pkg_config.gni")
^-------------------------------------------
When I edit the offending Python script to print(sys.version), it shows that it is running Python 3, even though the scripts are supposed to running with the bundled virtual Python 2.7 environment defined in .vpython.
How do I configure gn to run these scripts with the appropriate Python version?
It seems exec_script is running these scripts with the machine Python version. gn help exec_script says:
The default script interpreter is Python ("python" on POSIX, "python.exe" or
"python.bat" on Windows). This can be configured by the script_executable
variable, see "gn help dotfile".
For me, python points to Python 3. So I had to add this line to the end of the .gn dotfile:
script_executable = "vpython"
Now the build uses the virtual Python defined in .vpython, which is Python 2.7.
(The vpython executable is provided by Chromium depot_tools, just like gn.)
Trying to compile TF 2.0 with Bazel, ends up in a failure.
I am struggling this issue for quite a while, looked it up online, but haven't found any solution to the exact problem. Several running configuration (with or w/o Cuda, with or w/o creating zip file, etc) eventually leading to the same failure.
System information:
OS Platform and Distribution (Windows 10)
TensorFlow installed from (source)
TensorFlow version: 2.0 (master branch on 07 Nov 2019, to be exact)
Python version: 3.7
Installed using virtualenv? pip? conda?: No
Bazel version (if compiling from source): 0.29.1
GCC/Compiler version (if compiling from source): 8.1.0
CUDA/cuDNN version: 10.0/7
GPU model and memory: GeForce GTX 1050 15.88 GB RAM
My actions:
1. git checkout master (in the TF git repo)
2. bazel clean
3. configure (all defaults except for python path and Cuda)
4. bazel build --config=cuda --define=no_tensorflow_py_deps=true tensorflow:tensorflow_cc.dll
Failure message:
ERROR: C:/users/shahar/git/tensorflow/tensorflow/core/BUILD:2537:1:
Executing genrule //tensorflow/core:version_info_gen failed (Exit 5)
LAUNCHER ERROR: Cannot launch process: "C:/Program
Files/WindowsApps/PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0/python.exe"
C:\users\shahar_bazel_shahar\duchsbgv\execroot\org_tensorflow\bazel-out\x64_windows-opt\bin\tensorflow\tools\git\gen_git_source.zip
--generate external/local_config_git/gen/spec.json external/local_config_git/gen/head
external/local_config_git/gen/branch_ref
bazel-out/x64_windows-opt/bin/tensorflow/core/util/version_info.cc
--git_tag_override= Reason: (error: 5): Access is denied.
What am i doing wrong?
Edit:
added a junction with #László advice:
mklink /j c:\python "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0"
and used it when "configure" asked me to, for both python.exe and the libs, yet the error remains. details:
ERROR: C:/users/shahar/git/tensorflow/tensorflow/core/BUILD:2537:1:
Executing genrule //tensorflow/core:version_info_gen failed (Exit 5)
LAUNCHER ERROR: Cannot launch process: "C:/python/python.exe"
C:\users\shahar_bazel_shahar\duchsbgv\execroot\org_tensorflow\bazel-out\x64_windows-opt\bin\tensorflow\tools\git\gen_git_source.zip
--generate external/local_config_git/gen/spec.json external/local_config_git/gen/head
external/local_config_git/gen/branch_ref
bazel-out/x64_windows-opt/bin/tensorflow/core/util/version_info.cc
--git_tag_override= Reason: (error: 5): Access is denied.
Edit_2:
Again with #László help:
I ran:
bazel info execution_root
got a path, cd into it.
From there i ran:
c:\python\python.exe c:\users\shahar\_bazel_shahar\duchsbgv\execroot\org_tensorflow\bazel-out\x64_windows-opt\bin\tensorflow\tools\git\gen_git_source.zip --generate external/local_config_git/gen/spec.json external/local_config_git/gen/head external/local_config_git/gen/branch_ref c:\tmp\foo.cc --git_tag_override=
and got the following error message:
Traceback (most recent call last): File
"\?\C:\Users\Shahar\AppData\Local\Temp\Bazel.runfiles_ltu2ig_a\runfiles\org_tensorflow\tensorflow\tools\git\gen_git_source.py",
line 340, in
generate(args.generate, args.git_tag_override) File "\?\C:\Users\Shahar\AppData\Local\Temp\Bazel.runfiles_ltu2ig_a\runfiles\org_tensorflow\tensorflow\tools\git\gen_git_source.py",
line 273, in generate
write_version_info(dest_file, git_version) File "\?\C:\Users\Shahar\AppData\Local\Temp\Bazel.runfiles_ltu2ig_a\runfiles\org_tensorflow\tensorflow\tools\git\gen_git_source.py",
line 228, in write_version_info
open(filename, "w").write(contents) FileNotFoundError: [Errno 2] No such file or directory: 'c:\tmp\foo.cc'
I suspect the space in the Python path.
Try this:
open cmd.exe
create a junction c:\python pointing to the real Python directory:
mklink /j c:\python "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0"
You can use any other path than c:\python, just make sure there's no space or special characters in it.
run ./configure.py again, use c:\python
I am getting this error while running the sample file given with TensorFlow, in the imagenet model,
File "classify_image.py", line 154, in run_inference_on_image
if not tf.gfile.Exists(image):
AttributeError: 'module' object has no attribute 'gfile'
I have tried installing using both, from pip as well as source, on virtualserver as well, still I get this error.
There are two ways to go about solving this problem:
Option 1
This is an expansion on Yaroslav's comment above, and is easier than option 2.
Modify classify_image.py as follows:
Replace all instances of tf.gfile.Exists to os.path.exists, and
replace all instances of tf.gfile.GFile and tf.gfile.FastGFile to open
Then run the modified classify_image.py, and it should work.
Option 2
Update tensorflow to the latest version that includes gfile as described here
However, after you do that, you might encounter the following error when you try to run classify_image.py:
$ python classify_image.py
>> Downloading inception-2015-12-05.tgz 100.0%
Succesfully downloaded inception-2015-12-05.tgz 88931400 bytes.
[libprotobuf ERROR google/protobuf/src/google/protobuf/io/coded_stream.cc:207] A protocol message was rejected because it was too big (more than 67108864 bytes). To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
Traceback (most recent call last):
File "classify_image.py", line 213, in <module>
tf.app.run()
File "/Users/USERNAME/.virtualenvs/mlnd/lib/python2.7/site-packages/tensorflow/python/platform/default/_app.py", line 30, in run
sys.exit(main(sys.argv))
File "classify_image.py", line 209, in main
run_inference_on_image(image)
File "classify_image.py", line 159, in run_inference_on_image
create_graph()
File "classify_image.py", line 141, in create_graph
graph_def.ParseFromString(f.read())
google.protobuf.message.DecodeError: Error parsing message
To fix this, you can change a line in the source code as described here and then recompile tensorflow on your machine.
Option 2 might be a bit of work, especially if you're on a Mac.
The following steps helped me resolve the issue
update tensorflow as described here https://www.tensorflow.org/versions/r0.7/get_started/os_setup.html
2.For me this resulted in protobuf error. To resolve I ran
$sudo pip uninstall protobuf
$sudo pip install --upgrade
https://storage.googleapis.com/tensorflow/mac/tensorflow-0.7.1-cp27-none-any.whl