Running in a fresh python:3.9 docker image.
pip install tensorflow==2.8.0
import tensorflow
I get the error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/site-packages/tensorflow/__init__.py", line 37, in <module>
from tensorflow.python.tools import module_util as _module_util
File "/usr/local/lib/python3.9/site-packages/tensorflow/python/__init__.py", line 37, in <module>
from tensorflow.python.eager import context
File "/usr/local/lib/python3.9/site-packages/tensorflow/python/eager/context.py", line 29, in <module>
from tensorflow.core.framework import function_pb2
File "/usr/local/lib/python3.9/site-packages/tensorflow/core/framework/function_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/python3.9/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 "/usr/local/lib/python3.9/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
File "/usr/local/lib/python3.9/site-packages/tensorflow/core/framework/resource_handle_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/python3.9/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 36, in <module>
_descriptor.FieldDescriptor(
File "/usr/local/lib/python3.9/site-packages/google/protobuf/descriptor.py", line 560, in __new__
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower)
Why is that? It does not occur in Windows.
I had a similar issue with ubuntu:20.04 image and Tensorflow 2.3.0. As suggested, I downgraded to protobuf 3.19.0 (added protobuf==3.19.0 to requirements.txt file) and the issue went away
Related
Whenever I run a command related to pip, or pip itself, it just returns an exception and it doesn't install anything
Here's the exception info:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/configuration.py", line 27, in <module>
from pip._internal.utils.misc import ensure_dir, enum
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 38, in <module>
from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_vendor/tenacity/__init__.py", line 522, in <module>
from pip._vendor.tenacity._asyncio import AsyncRetrying
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_vendor/tenacity/_asyncio.py", line 19, in <module>
from asyncio import sleep
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/__init__.py", line 21, in <module>
from .base_events import *
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/base_events.py", line 296
future = tasks.async(future, loop=self)
I was running pip commands to install libraries on replit (because upm doesn't work well), but after uninstalling discord.py, it doesn't seem to work properly anymore
from my experience it is much better to use the pip module instead of the executable.
python3 -m pip install --upgrade pip # upgrade pip
python3 -m pip install replit # install the desired module
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
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 had implemented a neural net architecture in keras using tensor flow as a backend.
Which is working fine in last month but when I tried to run the code again it gives a series of errors. I tried to uninstall my packages installed and reinstall it but it never worked for me. I also tried the same combination with theano as a backend but it still gives me error.
I am attaching the traceback of the hope I could get a better solution for my question.
Using TensorFlow backend.
Traceback (most recent call last):
File "DeepNeuralNetwork.py", line 9, in <module>
from keras.models import Sequential
File "/usr/local/lib/python2.7/dist-packages/keras/__init__.py", line 2, in <module>
from . import backend
File "/usr/local/lib/python2.7/dist-packages/keras/backend/__init__.py", line 69, in <module>
from .tensorflow_backend import *
File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 1, 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 65, in <module>
import tensorflow.contrib as contrib
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/__init__.py", line 28, in <module>
from tensorflow.contrib import learn
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/__init__.py", line 72, in <module>
from tensorflow.contrib.learn.python.learn import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/__init__.py", line 23, in <module>
from tensorflow.contrib.learn.python.learn import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/__init__.py", line 25, in <module>
from tensorflow.contrib.learn.python.learn import estimators
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/__init__.py", line 23, in <module>
from tensorflow.contrib.learn.python.learn.estimators.autoencoder import TensorFlowDNNAutoencoder
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/autoencoder.py", line 25, in <module>
from tensorflow.contrib.learn.python.learn.estimators.base import TensorFlowBaseTransformer
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/base.py", line 34, in <module>
from tensorflow.contrib.learn.python.learn.estimators import estimator
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 38, in <module>
from tensorflow.contrib.learn.python.learn.io import data_feeder
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/io/__init__.py", line 22, in <module>
from tensorflow.contrib.learn.python.learn.io.dask_io import extract_dask_data
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/io/dask_io.py", line 26, in <module>
import dask.dataframe as dd
File "/usr/local/lib/python2.7/dist-packages/dask/dataframe/__init__.py", line 5, in <module>
from .io import (from_array, from_pandas, from_bcolz,
File "/usr/local/lib/python2.7/dist-packages/dask/dataframe/io/__init__.py", line 6, in <module>
from .csv import read_csv, to_csv, read_table
File "/usr/local/lib/python2.7/dist-packages/dask/dataframe/io/csv.py", line 147, in <module>
CPU_COUNT = psutil.cpu_count()
AttributeError: 'module' object has no attribute 'cpu_count'
As you can see from the last lines of the backtrace:
File "/usr/local/lib/python2.7/dist-packages/dask/dataframe/io/csv.py", line 147, in <module>
CPU_COUNT = psutil.cpu_count()
AttributeError: 'module' object has no attribute 'cpu_count'
the error is due to dask trying to call the attribute cpu_count of the module psutil.
This is probably due to some wrong version of psutil installed, and should be solved by simply upgrading or reinstalling it.
I have default and anaconda python, theano is installed in conda moreover it was also part of anaconda for keras. I am trying to exec a python file from another folder as python ---- and everything is ok except from theano.tensor.fft import ifft where it says no module named theano.tensor.fft I have added PYTHONPATH I have separately added theano in site-package but i can not figure out why it can not import module, please note that I can import theano.tensor I am trying to run MarcBS/keras caffe2keras.py
this is what I got when trying to install theano
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 11, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/local/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 22, in <module>
from pip._vendor import requests, six
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 53, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py", line 70, in <module>
ssl.PROTOCOL_SSLv3: OpenSSL.SSL.SSLv3_METHOD,
AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'