I have added functionality to tensorflow/tensorflow/python/ops/image_ops_impl.py and corresponding unit tests in tensorflow/tensorflow/python/ops/image_ops_test.py
I originally forked tensorflow from the master branch, made these changes on my local machine, rebased and commit.
Then I created and activated a virtualenv.
When running bazel test //tensorflow/python..., as recommended in the contribution guide I am recieving:
ERROR: /Users/isaacsultan/Code/tensorflow/third_party/python_runtime/BUILD:5:1: no such package '#local_config_python//': Traceback (most recent call last):
File "/Users/isaacsultan/Code/tensorflow/third_party/py/python_configure.bzl", line 308
_create_local_python_repository(repository_ctx)
File "/Users/isaacsultan/Code/tensorflow/third_party/py/python_configure.bzl", line 270, in _create_local_python_repository
_check_python_lib(repository_ctx, python_lib)
File "/Users/isaacsultan/Code/tensorflow/third_party/py/python_configure.bzl", line 213, in _check_python_lib
_fail(("Invalid python library path: %...))
File "/Users/isaacsultan/Code/tensorflow/third_party/py/python_configure.bzl", line 28, in _fail
fail(("%sPython Configuration Error:%...)))
Python Configuration Error: Invalid python library path: /usr/local/lib/python2.7/dist-packages
and referenced by '//third_party/python_runtime:headers'
ERROR: Analysis of target '//tensorflow/python:control_flow_util' failed; build aborted: Analysis failed
INFO: Elapsed time: 4.603s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (8 packages loaded)
FAILED: Build did NOT complete successfully (8 packages loaded)
currently loading: tensorflow/core ... (2 packages)
What could the source of my issue be please?
Since I am only changing the python functionality, there is no need to rebuild.
EDIT: After re-running ./configure:
(tensorflow) Isaacs-MacBook:tensorflow isaacsultan$ bazel clean --expunge
INFO: Starting clean.
(tensorflow) Isaacs-MacBook:tensorflow isaacsultan$ bazel test //tensorflow/python/...
Starting local Bazel server and connecting to it...
........................
ERROR: /private/var/tmp/_bazel_isaacsultan/0e2667ab20883652d759a6a805575b2d/external/local_config_cc/BUILD:50:5: in apple_cc_toolchain rule #local_config_cc//:cc-compiler-darwin_x86_64: Xcode version must be specified to use an Apple CROSSTOOL. If your Xcode version has changed recently, try: "bazel clean --expunge" to re-run Xcode configuration
ERROR: Analysis of target '//tensorflow/python/eager:core' failed; build aborted: Analysis of target '#local_config_cc//:cc-compiler-darwin_x86_64' failed; build aborted
INFO: Elapsed time: 15.184s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (93 packages loaded)
FAILED: Build did NOT complete successfully (93 packages loaded)
currently loading: tensorflow/core ... (2 packages)
EDIT 2:
After running bazel clean --expunge then ./configure:
Isaacs-MacBook:Tensorflow isaacsultan$ bazel test //tensorflow/python/...
Starting local Bazel server and connecting to it...
...................
ERROR: /private/var/tmp/_bazel_isaacsultan/0e2667ab20883652d759a6a805575b2d/external/local_config_cc/BUILD:50:5: in apple_cc_toolchain rule #local_config_cc//:cc-compiler-darwin_x86_64: Xcode version must be specified to use an Apple CROSSTOOL. If your Xcode version has changed recently, try: "bazel clean --expunge" to re-run Xcode configuration
ERROR: Analysis of target '//tensorflow/python:pywrap_tensorflow_import_lib_file' failed; build aborted: Analysis of target '#local_config_cc//:cc-compiler-darwin_x86_64' failed; build aborted
INFO: Elapsed time: 14.969s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (88 packages loaded)
FAILED: Build did NOT complete successfully (88 packages loaded)
currently loading: tensorflow/core ... (5 packages)
EDIT 3:
After following these steps:
Xcode version must be specified to use an Apple CROSSTOOL
4 warnings generated.
ERROR: /Users/isaacsultan/Code/tensorflow/tensorflow/BUILD:576:1: Executing genrule //tensorflow:tensorflow_python_api_gen failed (Exit 1)
/anaconda/lib/python2.7/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
Traceback (most recent call last):
File "/private/var/tmp/_bazel_isaacsultan/0e2667ab20883652d759a6a805575b2d/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/create_tensorflow.python_api.runfiles/org_tensorflow/tensorflow/python/tools/api/generator/create_python_api.py", line 27, in <module>
from tensorflow.python.tools.api.generator import doc_srcs
File "/private/var/tmp/_bazel_isaacsultan/0e2667ab20883652d759a6a805575b2d/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/create_tensorflow.python_api.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 81, in <module>
from tensorflow.python import keras
File "/private/var/tmp/_bazel_isaacsultan/0e2667ab20883652d759a6a805575b2d/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/create_tensorflow.python_api.runfiles/org_tensorflow/tensorflow/python/keras/__init__.py", line 25, in <module>
from tensorflow.python.keras import applications
File "/private/var/tmp/_bazel_isaacsultan/0e2667ab20883652d759a6a805575b2d/execroot/org_tensorflow/bazel-out/host/bin/tensorflow/create_tensorflow.python_api.runfiles/org_tensorflow/tensorflow/python/keras/applications/__init__.py", line 21, in <module>
import keras_applications
ImportError: No module named keras_applications
INFO: Elapsed time: 57510.356s, Critical Path: 492.10s
INFO: 6867 processes: 6867 local.
FAILED: Build did NOT complete successfully
Is it possible you forgot to run ./configure before building?
Related
During the installation I followed the https://github.com/superuser789/MediaPipe-on-RaspberryPi guide on my Raspberry Pi 4b+ 4gb and running Raspberry Pi OS 32bit. All my packages are up to date.
I ran python3 setup.py gen_protos && python3 setup.py bdist_wheel and got this result:
ERROR: Traceback (most recent call last):
File "/home/diegos-pi/.cache/bazel/_bazel_diegos-pi/7f3a9a61ae329ba025208f264fd9a815/external/rules_cc/cc/private/rules_impl/compiler_flag.bzl", line 17, column 76, in <toplevel>
load("#bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
Error: file '#bazel_tools//tools/cpp:toolchain_utils.bzl' does not contain symbol 'use_cpp_toolchain' (did you mean 'find_cpp_toolchain'?)
ERROR: While resolving toolchains for target //mediapipe/modules/face_detection:face_detection_short_range_cpu: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package '#bazel_tools//tools/cpp': in /home/diegos-pi/.cache/bazel/_bazel_diegos-pi/7f3a9a61ae329ba025208f264fd9a815/external/rules_cc/cc/defs.bzl: Extension file 'cc/private/rules_impl/compiler_flag.bzl' has errors
ERROR: Analysis of target '//mediapipe/modules/face_detection:face_detection_short_range_cpu' failed; build aborted: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package '#bazel_tools//tools/cpp': in /home/diegos-pi/.cache/bazel/_bazel_diegos-pi/7f3a9a61ae329ba025208f264fd9a815/external/rules_cc/cc/defs.bzl: Extension file 'cc/private/rules_impl/compiler_flag.bzl' has errors
INFO: Elapsed time: 16.113s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (2 packages loaded, 0 targets conf\
igured)
I am installing Tensorflow. I encountered the following problem:
I was installing Tensorflow from Source and I am following the Tensorflow website (https://www.tensorflow.org/install/source)
I had earlier installed Bazel 3.0.0 (the latest version) but got a similar error. Upon looking at other answers I figured out this error has something to do with the version of Bazel. Hence I uninstalled Bazel 3.0.0 and installed Bazel 0.27.1. But upon typing the following command(bazel build //tensorflow/tools/pip_package:build_pip_package) in the terminal, I am getting the following error:
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
/home/aviraj/tensorflow/tools/bazel.rc
Starting local Bazel server and connecting to it...
ERROR: /home/aviraj/tensorflow/WORKSPACE:3:1: name 'http_archive' is not defined
ERROR: Error evaluating WORKSPACE file
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '#io_bazel_rules_closure//closure': error loading package 'external': Could not load //external package
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '#io_bazel_rules_closure//closure': error loading package 'external': Could not load //external package
INFO: Elapsed time: 2.023s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
Any help would be much appreciated. Thanks
Starting with version 0.20.0, http_archive native rule has been deprecated, it has to be loaded from: #bazel_tools//tools/build_defs/repo:http.bzl. I.e. you need to add the following (unless you have a customized version) in WORKSPACE or bzl files using it:
load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Currently attempting to run Google's Pixel Level Domain Adaptation Model. We were able to run MNIST to MNIST-M training and testing. Added the USPS tfrecords in the datasets folder and we recreated the MNIST_M.py file into a USPS.py file. Imported the filed like they import it for MNIST. Somehow when we run training, the architecture isn't able to find the USPS file.
Google's Original Model: Google's Model
Command being run:
bazel run domain_daptation/pixel_domain_adaptation:pixeldatrain -- --dataset_dir $DSN_DATA_DIR --source_dataset mnist --target_dataset usps
Location of usps.py file:
/home/.../models/domain_adaptation/datasets:usps
Original Stack Trace:
INFO: Analysed target //domain_adaptation/pixel_domain_adaptation:pixelda_train (2 packages loaded).
INFO: Found 1 target...
Target //domain_adaptation/pixel_domain_adaptation:pixelda_train up-to-date:
bazel-bin/domain_adaptation/pixel_domain_adaptation/pixelda_train
INFO: Elapsed time: 0.575s, Critical Path: 0.12s
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/domain_adaptation/pixel_domain_adaptation/pixelda_train --dataset_dir /home/gabe/models/domain_adaptation/datasets --source_dataset mnist --target_dataset usps
Traceback (most recent call last):
File "/home/.../.cache/bazel/_bazel_root/b15fa6ac5bc49187f8190f3d0425c8db/execroot/__main__/bazel-out/k8-fastbuild/bin/domain_adaptation/pixel_domain_adaptation/pixelda_train.runfiles/__main__/domain_adaptation/pixel_domain_adaptation/pixelda_train.py", line 24, in <module>
from domain_adaptation.datasets import dataset_factory
File "/home/.../.cache/bazel/_bazel_root/b15fa6ac5bc49187f8190f3d0425c8db/execroot/__main__/bazel-out/k8-fastbuild/bin/domain_adaptation/pixel_domain_adaptation/pixelda_train.runfiles/__main__/domain_adaptation/datasets/dataset_factory.py", line 26, in <module>
from domain_adaptation.datasets import usps
ImportError: cannot import name usps
ERROR: Non-zero return code '1' from command: Process exited with status 1
After following one of the users advice of adding location to the domain_adaptation/datasets/build. I ran the same command again.
py_library(
name = "dataset_factory",
srcs = ["dataset_factory.py"],
deps = [
":usps",
"//slim:mnist",
],
)
New Stack Trace:
ERROR: /home/.../models/domain_adaptation/datasets/BUILD:23:12: in deps attribute of py_library rule //domain_adaptation/datasets:dataset_factory: rule '//domain_adaptation/datasets:usps' does not exist
ERROR: Analysis of target '//domain_adaptation/pixel_domain_adaptation:pixelda_train' failed; build aborted: Analysis of target '//domain_adaptation/datasets:dataset_factory' failed; build aborted
INFO: Elapsed time: 0.219s
FAILED: Build did NOT complete successfully (0 packages loaded)
ERROR: Build failed. Not running target
I'm installing the h5py according to the tutorial at http://docs.h5py.org/en/latest/build.html
The installation is sucessfull. However, the test failed,
python setup.py test
I got this:
running test
running build_py
running build_ext
Summary of the h5py configuration
Path to HDF5: '/opt/cray/hdf5-parallel/1.8.13/cray/83/'
HDF5 Version: '1.8.13'
MPI Enabled: True
Rebuild Required: False
Executing cythonize()
Traceback (most recent call last):
File "setup.py", line 140, in <module>
cmdclass = CMDCLASS,
File "/python/2.7.9/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/python/2.7.9/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/python/2.7.9/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 68, in run
import h5py
File "/h5py-2.5.0/build/lib.linux-x86_64-2.7/h5py/__init__.py", line 13, in <module>
from . import _errors
**ImportError:** /opt/cray/lib64/libmpichf90_cray.so.3: undefined symbol: iso_c_binding_
looks like cython cant not find the shared library, how can I attach that? Thanks.
(Edited for parallel build)
I got this to work on a Cray XC30 (ARCHER: http://www.archer.ac.uk) using the following:
module swap PrgEnv-cray PrgEnv-gnu
module load cray-hdf5-parallel
export CRAYPE_LINK_TYPE=dynamic
export CC=cc
ARCHER has specific modules for the Python enviroment on the compute nodes that link to performant versions of numpy etc. (see: http://www.archer.ac.uk/documentation/user-guide/python.php) so I also loaded these (this may not apply on your Cray system, in ARCHER's case mpi4py is already inlcuded in the python-compute install):
module load python-compute
module load pc-numpy
Finally, I added the custom install location I will use for h5py to PYTHONPATH
export PYTHONPATH=/path/to/h5py/install/lib/python2.7/site-packages:$PYTHONPATH
Now I can build:
python setup.py configure --mpi
python setup.py install --prefix=/path/to/h5py/install
...lots of output...
Now, running the tests on the frontend node fail but with the error message I would expect to see on a Cray XC if you try to launch MPI code on a login/service node (failed to initialize communication channel, the login/service nodes are not connected to the high performance network so cannot run MPI code). This suggests to me that the test would probably work if it was running on the compute nodes.
> python setup.py test
running test
running build_py
running build_ext
Autodetected HDF5 1.8.13
********************************************************************************
Summary of the h5py configuration
Path to HDF5: '/opt/cray/hdf5-parallel/1.8.13/GNU/49'
HDF5 Version: '1.8.13'
MPI Enabled: True
Rebuild Required: False
********************************************************************************
Executing cythonize()
[Thu Oct 22 19:53:01 2015] [unknown] Fatal error in PMPI_Init_thread: Other MPI error, error stack:
MPIR_Init_thread(547):
MPID_Init(203).......: channel initialization failed
MPID_Init(579).......: PMI2 init failed: 1
Aborted
To test properly you would have to submit a job that launched a parallel Python script on the compute nodes using aprun. I do not think the built in test framework will work easily as it probably expects the MPI launcher to be called mpiexec (as on a standard cluster) so you may need to write your own tests. The other option would be to coerce setup.py to use aprun instead somehow.
I have a set of python scripts that use PyXML. The scripts used to work fine but now I get error.
How can I best repair this?
$ script.py
Traceback (most recent call last):
File "/cygdrive/c/mypath/script.py", line 16, in <module>
from xml import xpath
File "/cygdrive/c/data/code/xml/PyXML-0.8.4/xml/xpath/__init__.py", line 105, in <module>
import Context
File "/cygdrive/c/data/code/xml/PyXML-0.8.4/xml/xpath/Context.py", line 15, in <module>
import CoreFunctions
File "/cygdrive/c/data/code/xml/PyXML-0.8.4/xml/xpath/CoreFunctions.py", line 20, in <module>
from xml.xpath import Util, Conversions
File "/cygdrive/c/data/code/xml/PyXML-0.8.4/xml/xpath/Conversions.py", line 22, in <module>
from xml.utils import boolean
ImportError: cannot import name boolean
Then I tried to re-install PyXML.. This fails.
$ easy_install PyXML
Searching for PyXML
Reading http://pypi.python.org/simple/PyXML/
Reading http://www.python.org/sigs/xml-sig/
Best match: PyXML 0.8.4
Downloading http://downloads.sourceforge.net/pyxml/PyXML-0.8.4.tar.gz?modtime=1101741917&big_mirror=0
Processing PyXML-0.8.4.tar.gz
Running PyXML-0.8.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ZIX2LS/PyXML-0.8.4/egg-dist-tmp-5x8fiU
warning: no files found matching '*.html' under directory 'extensions/expat'
warning: no files found matching '*Makefile' under directory 'extensions/expat'
warning: no files found matching '*.dsp' under directory 'extensions/expat'
warning: no previously-included files matching '*/CVS/*' found anywhere in distribution
69 [main] python 3116 C:\cygwin\bin\python.exe: *** fatal error - unable to remap C:\cygwin\bin\cygcrypto-0.9.8.dll to same address as parent: 0x600000 != 0x910000
Stack trace:
Frame Function Args
00285F18 6102749B (00285F18, 00000000, 00000000, 00000000)
00286208 6102749B (61177B80, 00008000, 00000000, 61179977)
00287238 61004AFB (611A136C, 6124060C, 00600000, 00910000)
End of stack trace
2 [main] python 6800 fork: child 3116 - died waiting for dll loading, errno 11
error: Setup script exited with error: Resource temporarily unavailable
I don't know if this will solve your problem specifically but I had a simillar problem which I googled and turned me here.
For whoever comes from google, The problem was with the pip install and the fix for that was:
you need to install it, You should find the file PyXML-0.8.4.tar.gz on the web and then run:
pip install the PyXML tarball
Although I gave another solution it looks like you are using an unstable cygwin, I think the real problem is there and not in the PyXML package.
Try to reinstall cygwin OR:
Try installing Pyxml with windows installer from here