Built tensorflow 0.7 from source on Ubuntu 15.10, Cuda 7.5, cudnn 4.0, python 2.7. Bazel build and pip package generation OK. pip install ok. Python script "import tensorflow" fails:
Traceback (most recent call last):
File "/home/keith/Desktop/tf1.py", line 8, in <module>
import tensorflow as tf
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 35, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-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(\tB/\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01\x62\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'
Any thoughts?
Thanks
This does look like a protobuf library versioning error. There's a long thread on similar issues here:
https://github.com/tensorflow/tensorflow/issues/11
Towards the end there are some suggested solutions that might help.
I succeed in running TensorFlow 0.7 on a manjaro linux laptop using cuda acceleration by running python with optirun:
$optirun python
However, I had problem with protobuf and I had to uninstall/reinstall previous version of protobuf and tensorflow with pip. http://bit.ly/1RHApU5
This is because of protobuf version conflict:
for me i had python-protobuf v2.6.1 installed from apt-get package manager
and while installing tensorflow it installed protobuf v3.3.0 from pip manager
so i uninstalled both:
sudo pip uninstall protobuf
sudo apt-get remove python-protobuf
Reinstalled using pip and it solved the issue!!!
sudo pip install protobuf
Hope this helps..
Related
I successfully installed Spacy using pip install spacy and alternatively through Pycharms virtual env, but when I import spacy in my program it's giving me the following error;
home/pi/.virtualenvs/cv/bin/python /home/pi/PycharmProjects/testSpeech/main.py
Traceback (most recent call last):
File "/home/pi/PycharmProjects/testSpeech/main.py", line 2, in <module>
import spacy
File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/spacy/__init__.py", line 10, in <module>
from thinc.neural.util import prefer_gpu, require_gpu
File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/thinc/neural/__init__.py", line 4, in <module>
from ._classes.model import Model # noqa: F401
File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/thinc/neural/_classes/model.py", line 11, in <module>
from ..train import Trainer
File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/thinc/neural/train.py", line 7, in <module>
from .optimizers import Adam, linear_decay
File "thinc/neural/optimizers.pyx", line 14, in init thinc.neural.optimizers
File "thinc/neural/ops.pyx", line 36, in init thinc.neural.ops
File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/blis/__init__.py", line 3, in <module>
from .cy import init
ImportError: /home/pi/.virtualenvs/cv/lib/python3.7/site-packages/blis/cy.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_load_8
Process finished with exit code 1
Any idea what's happening?
You probably have a 32-bit OS? Instead, you will need a 64-bit OS with 64-bit python for spaCy v2, e.g.: https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2020-08-24/
As of spacy v2.3.5 you should be able to install spacy in a venv for linux aarch64 with:
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip setuptools
pip install spacy
Alternatively, there are binary linux aarch64 packages on conda-forge. There's a linux aarch64 miniforge installer and the install command would be conda install spacy. If you're not using the miniforge installer, then you need to add -c conda-forge or otherwise add the conda-forge channel.
See: https://github.com/explosion/spaCy/issues/6638
There was some problem while loading some library which was some prerequisite for spacy.
The problem was solved by calling the file via terminal with the following command;
LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0 python3 main.py
I installed Pycharm for Windows 10
pip install tensorflow went fine without errors
When trying to run a simple project
# Import `tensorflow`
import tensorflow as tf
# Initialize two constants
x1 = tf.constant([1,2,3,4])
x2 = tf.constant([5,6,7,8])
# Multiply
result = tf.multiply(x1, x2)
# Print the result
print(result)
I get the error message
Traceback (most recent call last):
File "C:/Users//PycharmProjects/RiffRam/RiffRam.py", line 2, in <module>
import tensorflow as tf
File "C:\Users\\PycharmProjects\RiffRam\venv\lib\site-packages\tensorflow\__init__.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\\PycharmProjects\RiffRam\venv\lib\site-packages\tensorflow\python\__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "C:\Users\\PycharmProjects\RiffRam\venv\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 7, in <module>
from google.protobuf import descriptor as _descriptor
File "C:\Users\\PycharmProjects\RiffRam\venv\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.
Can somebody please tell me how I can get a working installation of Tensorflow, it seems that all the versions are mismatched and pip makes no attempt to install correct versions of each package. I don't care if its outdated.
What commands do I need to type in to get a working stable version from a clean installation of Pycharm so that the code above would run?
Thank you
I got it
pip install --upgrade --force-reinstall setuptools==39.1.0
pip install --upgrade --force-reinstall protobuf==3.6.0
pip install --upgrade --force-reinstall tensorflow==1.11
I have python 3.5 installed on my Linux Mint (Ubuntu 16.04 Xenial)
I also had installed protobuf installed using pip3 install protobuf
I installed tensorflow using pip3 install tensorflow
Then I tried to import tensorflow in python 3 it failed with error presented below:
Traceback (most recent call last):
File "/home/abdullah/face_recognition/tensorflow_test.py", line 1, in <module>
import tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 83, in <module>
from tensorflow.python.estimator import estimator_lib as estimator
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/estimator_lib.py", line 35, in <module>
from tensorflow.python.estimator.inputs import inputs
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/inputs/inputs.py", line 22, in <module>
from tensorflow.python.estimator.inputs.numpy_io import numpy_input_fn
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/inputs/numpy_io.py", line 22, in <module>
from tensorflow.python.estimator.inputs.queues import feeding_functions
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/inputs/queues/feeding_functions.py", line 40, in <module>
import pandas as pd
File "/usr/local/lib/python3.5/dist-packages/pandas/__init__.py", line 23, in <module>
from pandas.compat.numpy import *
File "/usr/local/lib/python3.5/dist-packages/pandas/compat/__init__.py", line 361, in <module>
from dateutil import parser as _date_parser
File "/usr/local/lib/python3.5/dist-packages/dateutil/parser.py", line 158
l.append("%s=%s" % (attr, `value`))
^
SyntaxError: invalid syntax
Consulting through many questions posted on SO and other forums, I tried uninstalling protobuf then I encountered following error.
Traceback (most recent call last):
File "/home/abdullah/face_recognition/tensorflow_test.py", line 1, in <module>
import tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/core/framework/graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
ImportError: No module named 'google.protobuf'
At the moment I'm just a beginner for all of this. I don't why protobuf is required why do all this hassle? I just wanted to get tensorflow installed on my system and try to learn something.
I was also facing the same problem. The problem I think is this is using pandas from system(apt-get) repository which is not compatible with other libraries. Updating pandas do the trick.
pip3 install --upgrade pandas
Also in your case, if only doing above fails, you can also try to reinstall tensorflow and protobuf with upgrade option.
pip3 install --upgrade protobuf
pip3 install --upgrade tensorflow
I just installed TensorFlow on my system today (Ubuntu 16.04 LTS) using VirtualEnv.
Did you run$ sudo apt-get install python3-pip python3-dev
If so, then try $ pip3 install -upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp35-cp35m-linux_x86_64.whl
Worst comes to worse, you could simply uninstall TensorFlow using $ sudo pip3 uninstall tensorflow and then try reinstalling to see if it corrects any errors.
I am trying to install gensim on a google cloud instance using:
pip3 install gensim
and this is the stacktrace when I am trying to import gensim:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/gensim/__init__.py", line 6, in <module>
from gensim import parsing, matutils, interfaces, corpora, models, similarities, summarization
File "/usr/local/lib/python3.4/dist-packages/gensim/models/__init__.py", line 7, in <module>
from .coherencemodel import CoherenceModel
File "/usr/local/lib/python3.4/dist-packages/gensim/models/coherencemodel.py", line 30, in <module>
from gensim.models.wrappers import LdaVowpalWabbit, LdaMallet
File "/usr/local/lib/python3.4/dist-packages/gensim/models/wrappers/__init__.py", line 5, in <module>
from .ldamallet import LdaMallet
File "/usr/local/lib/python3.4/dist-packages/gensim/models/wrappers/ldamallet.py", line 43, in <module>
from smart_open import smart_open
File "/usr/local/lib/python3.4/dist-packages/smart_open/__init__.py", line 1, in <module>
from .smart_open_lib import *
File "/usr/local/lib/python3.4/dist-packages/smart_open/smart_open_lib.py", line 36, in <module>
import boto.s3.key
File "/usr/local/lib/python3.4/dist-packages/boto/s3/key.py", line 33, in <module>
import boto.utils
File "/usr/local/lib/python3.4/dist-packages/boto/__init__.py", line 1216, in <module>
boto.plugin.load_plugins(config)
AttributeError: 'module' object has no attribute 'plugin'
This is the linux version (output of lsb_release -a):
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie
and this is the output of
pip3 freeze
Cython==0.25.1
Flask==0.11.1
Jinja2==2.8
MarkupSafe==0.23
Pillow==2.6.1
Werkzeug==0.11.11
beautifulsoup4==4.3.2
boto==2.43.0
bz2file==0.98
chardet==2.3.0
click==6.6
colorama==0.3.2
decorator==3.4.0
gensim==0.13.3
html5lib==0.999
itsdangerous==0.24
lxml==3.4.0
matplotlib==1.4.2
nltk==3.2.1
nose==1.3.4
numexpr==2.4
numpy==1.11.2
pandas==0.14.1
pyparsing==2.0.3
python-apt==0.9.3.12
python-dateutil==2.2
pytz==2012c
requests==2.4.3
scipy==0.14.0
six==1.8.0
smart-open==1.3.5
stop-words==2015.2.23.1
tables==3.1.1
unattended-upgrades==0.1
urllib3==1.9.1
wheel==0.24.0
Can anybody give me pointers! This is very frustrating.
had the same problem, in case anyone stumbles upon this: GCE is broken somehow
pip install google-compute-engine
from https://github.com/GoogleCloudPlatform/compute-image-packages/issues/262
works
Fixed it:
sudo pip3 uninstall boto
sudo pip3 install boto
It seemed to be a google compute cloud thing.
This Problem mainly occurs because of garbage present in boto plugin or config file.
So as suggested by #vJune, we need to uninstall the boto library then install it again.
I solved this problem by just removing the python-boto package only.
On Google Compute Engine:
Step1: Uninstall the python-boto package
sudo apt-get remove python-boto
Step2: Install the python-boto library
sudo apt-get install python-boto
I finally got pip install buildbot-slave to work on Win7 (thanks to another answer on this site), and now when I attempt to create a build slave via:
buildslave create-slave slavefolder blah.blah.com:9989 buildslave password
It kicks back the following error:
Traceback (most recent call last):
File "C:\Python27\Scripts\buildslave", line 3, in <module>
from buildslave.scripts import runner
File "C:\Python27\lib\site-packages\buildslave\scripts\runner.py", line 22, in <module>
from twisted.python import reflect
File "C:\Python27\lib\site-packages\twisted\__init__.py", line 53, in <module>
_checkRequirements()
File "C:\Python27\lib\site-packages\twisted\__init__.py", line 37, in _checkRequirements
raise ImportError(required + ": no module named zope.interface.")
ImportError: Twisted requires zope.interface 3.6.0 or later: no module named zope.interface.
I've got it all installed here is my pip freeze:
Twisted==14.0.0
argparse==1.2.1
buildbot-slave==0.8.9
stevedore==0.15
virtualenv==1.9.1
virtualenv-clone==0.2.5
virtualenvwrapper==4.3.1
virtualenvwrapper-win==1.1.5
zope.interface==4.1.1
Any recommendations would be greatly appreciated.
Try to uninstall zope.interface and reinstall the version 3.6.0 using the command
pip uninstall zope.interface
pip install zope.interface==3.6.0
Hope this helps.