How to install tflearn, Anaconda Ubuntu 16.04 - python

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.

Related

tensorflow installation on python docker

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

ImportError: cannot import name 'export_saved_model' from 'tensorflow.python.keras.saving.saved_model'

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.

AttributeError: 'module' object has no attribute 'computation'

Im trying to use Keras (Sequential) but I get the following error when I try to import it:
File "kaggle_titanic_keras.py", line 3, in <module>
from keras.models import Sequential
File "/anaconda/lib/python2.7/site-packages/keras/__init__.py", line 4, in <module>
from . import applications
File "/anaconda/lib/python2.7/site-packages/keras/applications/__init__.py", line 1, in <module>
from .vgg16 import VGG16
File "/anaconda/lib/python2.7/site-packages/keras/applications/vgg16.py", line 14, in <module>
from ..models import Model
File "/anaconda/lib/python2.7/site-packages/keras/models.py", line 14, in <module>
from . import layers as layer_module
File "/anaconda/lib/python2.7/site-packages/keras/layers/__init__.py", line 4, in <module>
from ..engine import Layer
File "/anaconda/lib/python2.7/site-packages/keras/engine/__init__.py", line 8, in <module>
from .training import Model
File "/anaconda/lib/python2.7/site-packages/keras/engine/training.py", line 24, in <module>
from .. import callbacks as cbks
File "/anaconda/lib/python2.7/site-packages/keras/callbacks.py", line 25, in <module>
from tensorflow.contrib.tensorboard.plugins import projector
File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/__init__.py", line 30, in <module>
from tensorflow.contrib import factorization
File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/factorization/__init__.py", line 24, in <module>
from tensorflow.contrib.factorization.python.ops.gmm import *
File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/factorization/python/ops/gmm.py", line 27, in <module>
from tensorflow.contrib.learn.python.learn.estimators import estimator
File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/__init__.py", line 87, in <module>
from tensorflow.contrib.learn.python.learn import *
File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/__init__.py", line 23, in <module>
from tensorflow.contrib.learn.python.learn import *
File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/__init__.py", line 25, in <module>
from tensorflow.contrib.learn.python.learn import estimators
File "/anaconda/lib/python2.7/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 "/anaconda/lib/python2.7/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 "/anaconda/lib/python2.7/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 "/anaconda/lib/python2.7/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 "/anaconda/lib/python2.7/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 "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/learn_io/dask_io.py", line 26, in <module>
import dask.dataframe as dd
File "/anaconda/lib/python2.7/site-packages/dask/dataframe/__init__.py", line 3, in <module>
from .core import (DataFrame, Series, Index, _Frame, map_partitions,
File "/anaconda/lib/python2.7/site-packages/dask/dataframe/core.py", line 38, in <module>
pd.computation.expressions.set_use_numexpr(False)
AttributeError: 'module' object has no attribute 'computation'
Im running Python 2.7, TensorFlow 1.1 , Keras 2.0.3 and 'upgraded' to Pandas 0.20.1 yesterday which I suspect is causing the problem but the error message says nothing about it.
Update dask to 0.15.0 will solve the issue
update cmd: conda update dask
input pip show dask will show follow message
Name: dask
Version: 0.15.0
Summary: Parallel PyData with Task Scheduling
Home-page: http://github.com/dask/dask/
Author: Matthew Rocklin
Author-email: mrocklin#gmail.com
License: BSD
Location: c:\anaconda3\lib\site-packages
Requires:
dask-0.14.3 works and eliminates the import error
I reverted back to Pandas 0.19.2 and it resolved this problem.
The full command I use is
conda install pandas=0.19.2
and answer y to downgrade the pandas and it worked now.
I had installed below versions:
python 3.5
tensorflow 1.2.1
pandas 0.21
dask 0.15.3
and was getting the following error:
pd.core.computation.expressions.set_use_numexpr(False)
AttributeError: 'module' object has no attribute 'expressions'
I downgraded to pandas 0.19.2 and dask 0.15.0 and the python script worked fine!

Error in running keras for deep learning in ubuntu 14.04

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.

Python import error invalid ELF header

When I try to use this command line to run this python code:
~/Tools/find_differential_primers/utils python stitch_six_frame_stops.py seq.fa
Error code will be displayed as followed. could you help me solve this problem.
Traceback (most recent call last):
File "stitch_six_frame_stops.py", line 55, in <module>
import matplotlib
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-macosx-10.8 intel.egg/matplotlib/__init__.py", line 129, in <module>
from matplotlib.cbook import is_string_like
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/cbook.py", line 28, in <module>
import numpy as np
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/__init__.py", line 140, in <module>
from . import add_newdocs
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/lib/__init__.py", line 6, in <module>
from .type_check import *
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/core/__init__.py", line 6, in <module>
from . import multiarray
ImportError: /usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/core/multiarray.so: invalid ELF header
You are trying to use a .so file in Mac OSX! .so files work on Linux; Mac OSX works with .dynld files. You probably may want to verify your NumPy Installation.
Assuming you are using OSX Lion, please see here for how to install NumPy on the OSX.

Categories

Resources