I got an error when I wanted to use tensorflow.
I just installed tensorflow and I did
$ source activate tensorflow
command, terminal became tensorflow version like
(tensorflow) ~ master
But I wrote sample.py like
import tensorflow as tf
import multiprocessing as mp
core_num = mp.cpu_count()
config = tf.ConfigProto(
inter_op_parallelism_threads=core_num,
intra_op_parallelism_threads=core_num )
sess = tf.Session(config=config)
hello = tf.constant('hello, tensorflow!')
print sess.run(hello)
a = tf.constant(10)
b = tf.constant(32)
print sess.run(a+b)
and I run this script like python rote sample.py
so this error happen
Traceback (most recent call last):
File "test.py", line 1, in <module>
import tensorflow as tf
File "/Users/username/tensorflow/lib/python2.7/site-packages/tensorflow/__init__.py", line 4, in <module>
from tensorflow.python import *
File "/Users/username/tensorflow/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 13, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/Users/username/tensorflow/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 16, in <module>
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "/Users/username/tensorflow/lib/python2.7/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "/Users/username/tensorflow/lib/python2.7/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
File "/Users/username/tensorflow/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 22, in <module>
serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"d\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tb\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'
So I searched this error, and I found this solution.
https://github.com/tensorflow/tensorflow/issues/11
I wanna do
pip uninstall protobuf
pip uninstall tensorflow
brew uninstall protobuf
pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
commands, but only brew uninstall protobuf command could not be done.
So,I did 3 commands and I did python rote sample.py again, but almost same error happen.
Traceback (most recent call last):
File "test.py", line 1, in <module>
import tensorflow as tf
File "/Users/username/tensorflow/lib/python2.7/site-packages/tensorflow/__init__.py", line 4, in <module>
from tensorflow.python import *
File "/Users/username/tensorflow/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 13, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/Users/username/tensorflow/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 16, in <module>
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "/Users/username/tensorflow/lib/python2.7/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "/Users/username/tensorflow/lib/python2.7/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
File "/Users/username/tensorflow/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 22, in <module>
serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"d\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tb\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'
What should I do to fix this?
Furthermore,why this error happen?What is wrong?
i just upgraded protobuf to the latest version and it worked for me
pip install protobuf --upgrade
Related
Hello I want to use tensorboard but I cant start it.
I am using anaconda on ubunutu and installed it with pip install tensorboard.
I get this error when I try to start tensorboard with tensorboard --logdir . :
Traceback (most recent call last):
File "/home/myhome/anaconda3/bin/tensorboard", line 5, in <module>
from tensorboard.main import run_main
File "/home/myhome/anaconda3/lib/python3.7/site-packages/tensorboard/main.py", line 43, in <module>
from tensorboard import default
File "/home/myhome/anaconda3/lib/python3.7/site-packages/tensorboard/default.py", line 38, in <module>
from tensorboard.plugins.audio import audio_plugin
File "/home/myhome/anaconda3/lib/python3.7/site-packages/tensorboard/plugins/audio/audio_plugin.py", line 29, in <module>
from tensorboard.plugins.audio import metadata
File "/home/myhome/anaconda3/lib/python3.7/site-packages/tensorboard/plugins/audio/metadata.py", line 21, in <module>
from tensorboard.compat.proto import summary_pb2
File "/home/myhome/anaconda3/lib/python3.7/site-packages/tensorboard/compat/proto/summary_pb2.py", line 8, in <module>
from google.protobuf import descriptor as _descriptor
File "/home/myhome/anaconda3/lib/python3.7/site-packages/google/protobuf/descriptor.py", line 48, in <module>
from google.protobuf.pyext import _message
ImportError: libprotobuf.so.23: cannot open shared object file: No such file or directory
I tried out tensorboard version 2.2.0 and the latest version. But on both I get the same error.
conda-version: 4.9.1
While running yolo detection on webcam, I came across this error
ImportError: cannot import name 'export_saved_model' from 'tensorflow.python.keras.saving.saved_model'
and its indicated on this line
from yolov3_tf2.models import YoloV3, YoloV3Tiny
I saw this similar question but it is of no use for me.
I did tried this..
conda uninstall -y tensorflow
pip uninstall tensorflow
pip uninstall keras
and then
conda create -n tf tensorflow
conda activate tf
and still the error persists..
Here is the full traceback call..
Traceback (most recent call last):
File "d:/Github/cloned repo/Object-Detection-API/load_weights.py", line 4, in <module>
from yolov3_tf2.models import YoloV3, YoloV3Tiny
File "d:\Github\cloned repo\Object-Detection-API\yolov3_tf2\models.py", line 5, in <module>
from tensorflow.keras import Model
File "D:\Anaconda\lib\site-packages\tensorflow\keras\__init__.py", line 14, in <module>
from . import activations
File "D:\Anaconda\lib\site-packages\tensorflow\keras\activations\__init__.py", line 10, in <module>
from tensorflow.python.keras.activations import deserialize
File "D:\Anaconda\lib\site-packages\tensorflow\python\__init__.py", line 83, in <module>
from tensorflow.python import keras
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\__init__.py", line 24, in <module>
from tensorflow.python.keras import activations
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\activations.py", line 24, in <module>
from tensorflow.python.keras.utils.generic_utils import deserialize_keras_object
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\utils\__init__.py", line 39, in <module>
from tensorflow.python.keras.utils.multi_gpu_utils import multi_gpu_model
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\utils\multi_gpu_utils.py", line 22, in <module>
from tensorflow.python.keras.engine.training import Model
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\engine\training.py", line 43, in <module>
from tensorflow.python.keras.engine.network import Network
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\engine\network.py", line 40, in <module>
from tensorflow.python.keras.saving import hdf5_format
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\saving\__init__.py", line 31, in <module>
from tensorflow.python.keras.saving.saved_model import export_saved_model
ImportError: cannot import name 'export_saved_model' from 'tensorflow.python.keras.saving.saved_model' (D:\Anaconda\lib\site-packages\tensorflow\python\keras\saving\saved_model\__init__.py)
Help me solve this error..
Thanks in advance.
My project is in Python 3.7, anaconda Jupyter Notebook on windows 10.
When I try to import Tensorflow i get the following error message:
>>> import tensorflow as tf
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import tensorflow as tf
File "C:\Users\Guilherme\AppData\Roaming\Python\Python37\site-packages\tensorflow\__init__.py", line 98, in <module>
from tensorflow_core import *
File "C:\Users\Guilherme\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\__init__.py", line 42, in <module>
from . _api.v2 import audio
File "C:\Users\Guilherme\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\_api\v2\audio\__init__.py", line 10, in <module>
from tensorflow.python.ops.gen_audio_ops import decode_wav
File "C:\Users\Guilherme\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\ops\gen_audio_ops.py", line 7, in <module>
import six as _six
ModuleNotFoundError: No module named 'six'
>>>
I have tried to install this 'six', but it says "Requeriments already satisfied"
What should I do?
I am using Anaconda on ubuntu 16.04.
I try pip install tflearn on terminal and says ok.
But if I try to check the tflearn version, I receive this log.
I appreciate any hint to solve this issue.
Traceback (most recent call last):
File "/media/libardo/Datos/Proyectos/Libardo/2017/Proyectos/Kaggle/MBA/prueba_TF_Version.py", line 12, in <module>
import tflearn as tfl; print(tfl.__version__)
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tflearn/__init__.py", line 4, in <module>
from . import config
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tflearn/config.py", line 5, in <module>
from .variables import variable
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tflearn/variables.py", line 7, in <module>
from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/__init__.py", line 30, in <module>
from tensorflow.contrib import factorization
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/factorization/__init__.py", line 24, in <module>
from tensorflow.contrib.factorization.python.ops.gmm import *
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/factorization/python/ops/gmm.py", line 27, in <module>
from tensorflow.contrib.learn.python.learn.estimators import estimator
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/__init__.py", line 87, in <module>
from tensorflow.contrib.learn.python.learn import *
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/__init__.py", line 23, in <module>
from tensorflow.contrib.learn.python.learn import *
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/__init__.py", line 25, in <module>
from tensorflow.contrib.learn.python.learn import estimators
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/__init__.py", line 297, in <module>
from tensorflow.contrib.learn.python.learn.estimators.dnn import DNNClassifier
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn.py", line 29, in <module>
from tensorflow.contrib.learn.python.learn.estimators import dnn_linear_combined
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 31, in <module>
from tensorflow.contrib.learn.python.learn.estimators import estimator
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 49, in <module>
from tensorflow.contrib.learn.python.learn.learn_io import data_feeder
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/learn_io/__init__.py", line 21, in <module>
from tensorflow.contrib.learn.python.learn.learn_io.dask_io import extract_dask_data
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/learn_io/dask_io.py", line 26, in <module>
import dask.dataframe as dd
File "/home/libardo/anaconda3/lib/python3.6/site-packages/dask/dataframe/__init__.py", line 3, in <module>
from .core import (DataFrame, Series, Index, _Frame, map_partitions,
File "/home/libardo/anaconda3/lib/python3.6/site-packages/dask/dataframe/core.py", line 38, in <module>
pd.computation.expressions.set_use_numexpr(False)
AttributeError: module 'pandas' has no attribute 'computation'
Maybe the pandas version is old. Try follow the following steps:
https://www.scipy.org/install.html
Another reason for your problem can be due your version of Python, like too the version of your pip. Please, verify if your pip have that libraries with:
pip list
pip2 list
pip3 list
The use of this commands depends your Python and pip version.
I installed tensorflow using anaconda distribution and I am unable to use the same in python.
When I import tensorflow using import tensorflow I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 16, in <module>
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 22, in <module>
serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"z\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x12\x14\n\x0cunknown_rank\x18\x03 \x01(\x08\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tB2\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01\xf8\x01\x01\x62\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'
I tried reinstalling anaconda as well as uninstalling protobuf which I found as an answer somewhere in stackoverflow.
You should uninstall tensorflow as well, and make sure protobuf is uninstalled. You can try brew uninstall protobuf as well. Then reinstall protobuf, and tensorflow. Tensorflow requires protobuf version 3.x
pip install 'protobuf>=3.0.0a3'
You can test your protobuf version:
import google.protobuf
>>> print google.protobuf.__version__