I am testing out the TFLearn library for using TensorFlow but can't import it due to some config issue. I installed it as required in TFLearn tutorial though. Thankful for any help.
>>> import tflearn as tf
> import tflearn
File "//anaconda/lib/python2.7/site-packages/tflearn/__init__.py", line 4, in <module>
from . import config
ImportError: cannot import name config
This is caused due to incompatibilitiy of TFlearn and Tensorflow. They may be of different version. Hence, to resolve the issue, uninstall tensorflow and tflearn and reinstall them using the following code -
pip uninstall tflearn
pip uninstall tensorflow
pip install -I tensorflow==0.12.1
pip install -I tflearn==0.2.1
Related
I follow the instructions in the github that says to install Tensorflow Federated with Collab we need to install version 0.20.0 but I get this error when I try to run the toturials.
!pip install --quiet tensorflow-federated==0.20.0 # The latest version of tensorflow-federated is not working with the colab python version
!pip install --quiet --upgrade nest-asyncio
from __future__ import absolute_import, division, print_function
import collections
from six.moves import range
import numpy as np
import tensorflow as tf
# from tensorflow import compat
from tensorflow_federated import python as tff
np.random.seed(0)
tf.compat.v1.enable_v2_behavior()
tff.federated_computation(lambda: 'Hello, World!')()
Error:
module 'tensorflow_federated.python' has no attribute 'federated_computation'
What is the problem I don't understand? How can I install it on google colab. There is no resource for this problem.
Are you sure you need to import this
from tensorflow_federated import python as tff
instead of
import tensorflow_federated as tff
According to the Tensorflow docs, the federated_computation was under tensorflow_federated directly.
I am trying to use tensorflow_rankings, but cannot import it due to the above error. I am using tensorflow 2.8.0 and tensorflow_rankings 0.5.0, which seem to be the latest stable builds. They are what get automatically installed from
pip install tensorflow
pip install tensorflow_ranking
I am on Python 3.8.10, Windows 11.
The TF 2.8.0 docs show there is a Normalization layer in tf.keras.layers. The error seems to come from:
from tensorflow.python.keras.layers import normalization as keras_norm
in
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
Any advice?
Seems my installation of TF was corrupted. A full uninstall and reinstall fixed it.
Trying import of initial libraries related to tensorflow_quantum:
import tensorflow as tf
import tensorflow_quantum as tfq
import cirq
import sympy
import numpy as np
Getting error in 2nd line:
File "Path_to_anaconda_site_packages\tensorflow_core\python\framework\load_library.py", line 61, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
NotFoundError: Path_To_Tensorflow_Quantum\core\ops\_tfq_simulate_ops.so not found
This is the solution provided by the Tensorflow team, it worked for me.
!pip install tensorflow-gpu==2.1.0
!pip install cirq==0.7.0 pathos==0.2.5 tensorflow-quantum==0.2.0
Do following steps:
!pip uninstall tensorflow
!pip install tensorflow
then restart runtime to import the packages.It works.
This might be something that would be worth raising as an issue on the TensorFlow Quantum Github here (https://github.com/tensorflow/quantum/issues). Without much information on the platform your are using or even what python version you have it might be hard to diagnose the problem here, but a quick fix you could try might be that you have an older version of TensorFlow installed. TensorFlow Quantum requires tf == 2.1.0.
pip install --upgrade pip
pip install --upgrade tensorflow
If that doesn't do it, then it might be worth opening an issue on github and giving a few more details on there :)
I am working on pose estimation using OpenPose. For that I installed TensorFlow GPU and installed all the requirements including CUDA development kit.
While running the Python script:
C:\Users\abhi\Anaconda3\lib\site-packages\tensorflow\python\ops\resource_variable_ops.py, I encountered the following error:
ImportError: cannot import name '_pywrap_utils' from
'tensorflow.python'
(C:\Users\abhi\Anaconda3\lib\site-packages\tensorflow\python__init__.py)
I tried searching for _pywrap_utils file but there was no such file.
Try pip3 install pywrap and pip3 install tensorflow pywrap utils should be included with tensorflow. If it is not found, that means TF was not installed correctly.
then i type import tflearn i got the error below, i follow the guide here: https://www.youtube.com/watch?v=ViO56ASqeks
what can i use tflearn, or shall i use another code?
i got the error below.
import tflearn
File "/usr/local/lib/python3.5/dist-packages/tflearn/__init__.py", line 4, in <module>
from . import config
File "/usr/local/lib/python3.5/dist-packages/tflearn/config.py", line 5, in <module>
from .variables import variable
File "/usr/local/lib/python3.5/dist-packages/tflearn/variables.py", line 7, in <module>
from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope
ImportError: No module named 'tensorflow.contrib.framework
can someone help me ?
20/08-2019: Edit 20.35
pip list:
tensorflow 2.0.0rc0
I had a similar problem and I solved it by:-
1) upgrading python to 3.6
2) pip uninstall tflearn
3) pip install git+https://github.com/tflearn/tflearn.git
4) As suggested in another solution tensorflow 2.0.0 does not support tflearn so I installed tensorflow==1.14.0
I found the solution here:-
Issue Link/
If you use an conda environment (and not only, but I advise you to use it), then the solution will be to use a lower version of tensorflow pip uninstall tensorflow pip install tensorflow==1.14.0.
And it is possible to use the script to fix all errors(i used it before downgrade tf):
tf_upgrade_v2 \
--intree my_project/ \
--outtree my_project_v2/ \
--reportfile report.txt
It works for me
You need to have tensorflow installed before you can use tflearn.
From the tflearn github page:
TensorFlow Installation
TFLearn requires Tensorflow (version 1.0+) to be installed.
To install tensorflow:
pip install tensorflow
The tutorial that you are watching uses tensorflow version 0.9 or something, current version is 2.0. The tutorial is 3 years old. You should watch updated video.
However, you can try.
pip install tensorflow==1.0
pip install tflearn
if you're using a virtual environment, make sure you have activated it.
You can use keras instead of tflearn.
tensorflow.contrib is being removed in version 2.0, you therefore need version <= 1.14 to operate tflearn (see here).