skflow with Docker images gets learn.datasets not imported error - tensorflow

I set the docker image with Dockerfile below.
FROM gcr.io/tensorflow/tensorflow:latest-devel
RUN pip install --upgrade pip
RUN pip install scikit-learn
RUN pip install scipy
RUN pip install pandas
I am using Pycharm and set the remote Docker tf library.
The below file runs with an error which says ' AttributeError: 'module' object has no attribute 'datasets' '
https://github.com/tensorflow/tensorflow/blob/cc9bfbf8ef4a3dea6514ad939d238f7442188247/tensorflow/examples/skflow/text_classification_cnn.py
Do I have to compile some source codes before running the test code, or can I not run the code in Windows? Below is the error messages.
f58474f68f97:python -u /opt/project/examples/skflow/text_classification_cnn.py
Traceback (most recent call last):
File "/opt/project/examples/skflow/text_classification_cnn.py", line 30, in <module>
dbpedia = learn.datasets.load_dataset('dbpedia')
AttributeError: 'module' object has no attribute 'datasets'

Please update your TensorFlow to latest version. That docker image is probably outdated.

Related

Tensorflow protobuf incompatibility

I could not get the tensorflow Variables to work because of protobuf incompatibility. Appreciate if someone can suggest how to fix it.
The following is the error:
$ python a.py
Traceback (most recent call last):
File "a.py", line 20, in <module>
a = tf.Variable(tf.zeros(2))
File "/opt/miniconda3/lib/python3.8/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/opt/miniconda3/lib/python3.8/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 177, in _variable_handle_from_shape_and_dtype
handle_data.shape_and_type.append(
AttributeError: 'google.protobuf.pyext._message.RepeatedCompositeCo' object has no attribute 'append'
(base) kanduru#SJC-L-00060215:/mnt/c/Users/kanduru/Documents/Courses/MIT/skunk/Auto-Surprise$
and the code is
import tensorflow as tf
a = tf.Variable(tf.zeros(2))
$ pip list | grep tensorflow
tensorflow 2.7.0
tensorflow-estimator 2.7.0
$ pip list | grep protobuf
protobuf 4.21.1
There could be an issue with the TensorFlow installation or TensorFlow version compatibility with existing libraries. protobuf gets installed itself with its specific version compatible to Tensorflow version while installing TensorFlow.
Could you please try again by upgrading the TensorFlow version to the latest version using the code below:
pip install --upgrade pip
pip install --upgrade tensorflow #or
pip install tensorflow==2.10
Please have a look at this Tensorflow install guide for more details.
Let us know if the issue still persists. Thank you.

Jenkins : Pycharm : I keep getting a message to upgrade pip

Im trying to run automated test on jenkins cloud version : so i get this error :
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-0739wibs/cryptography/setup.py", line 14, in <module>
from setuptools_rust import RustExtension
ModuleNotFoundError: No module named 'setuptools_rust'
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-0739wibs/cryptography/
You are using pip version 9.0.3, however version 22.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Import chromedriver on the env variable.
Import python path on the env variable.
/tmp/jenkins3940904514869226010.sh: line 16: pytest: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I do `python3 -m pip install --upgrade pip
I get Requirement already satisfied: pip in ./venv/lib/python3.8/site-packages (22.0.3)
`
I have fixed it by adding this line on Execute shell
pip3 install --upgrade pip

rqt_graph pyqt binding of qt_gui_cpp library

I am using ROS-melodic in ubuntu 18.04 LTS. I am getting this error:
Could not import "pyqt" bindings of qt_gui_cpp library - so C++ plugins will not be available:
Traceback (most recent call last):
File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui_cpp/cpp_binding_helper.py", line 43, in <module>
from . import libqt_gui_cpp_sip
ImportError: dynamic module does not define module export function (PyInit_libqt_gui_cpp_sip)
however I have installed pyqt5 and pydot manually, rqt_graph shows up but with this warning. I want to know what can I do to get it right? Is this going to be problem in future? Now rqt_graph is loading but I don't know if this will mess up/create lacking in the graph?
Try uninstalling double packages if any using
pip3 uninstall PyQt5-sip PyQt5
Then try importing it in python3 to check if any other version is there.
If the import is successful then try running the command again
rosrun rqt_graph rqt_graph
if still some error exists install
pip3 install PyQt5==5.12

ModuleNotFoundError: No module named 'absl'

I followed instructions (https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html) to install the Tensorflow Object Detection API. I use Anaconda on ubuntu18.4 and all of the steps in the instructions seemed to complete OK.
When I train to train my model with the following command:
python model_main_tf2.py --model_dir=models/my_ssd_resnet50_v1_fpn --pipeline_config_path=models/my_ssd_resnet50_v1_fpn/pipeline.config
I get the following error:
Traceback (most recent call last):
File "model_main_tf2.py", line 31, in <module>
from absl import flags
ModuleNotFoundError: No module named 'absl'
I get the error mentioned in the headline. I would be very thankful if someone could help me with a code example to solve the problem.
You need the absl package; to install it, use either one of the following:
pip install absl-py
or if you are in a Conda environment:
conda install -c anaconda absl-py

numpy.test error in virtualenv with ERROR: test_multiarray.TestNewBufferProtocol.test_relaxed_strides

In my ubuntu system,i install numpy in virtualenv with python 2.7. After i install it, using the numpy.test:
python -c "import numpy; numpy.test()"
there are some errors like this:
ERROR: test_multiarray.TestNewBufferProtocol.test_relaxed_strides
Traceback (most recent call last):
File "/home/zjd/wangliangguo/theano-env/local/lib/python2.7/site- packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/zjd/wangliangguo/theano-env/local/lib/python2.7/site-packages/numpy/core/tests/test_multiarray.py", line 5366, in test_relaxed_strides fd.write(c.data)
TypeError: 'buffer' does not have the buffer interface
I had the same error with Python 2.7.3. Upgrading to Python 2.7.11 fixed it for me.
I'm on Ubuntu 12.04 LTS, and the default apt-get repositories didn't have Python 2.7.11, so I followed these instructions: https://superuser.com/a/942296