Using tflearn, getting ModuleNotFoundError: No module named 'tensorflow.contrib' - tensorflow

I'm working with tensorflow==2.2.0rc1 and tflearn==0.3.2 and I keep getting the same error when importing:
ModuleNotFoundError: No module named 'tensorflow.contrib'
Although I import the packages:
import tflearn
import tensorflow

From TFLearn's documentation and your error, it's probably only compatible with Tensorflow < 2, so reinstall tensorflow of version 1.x.
tensorflow.contrib was deprecated in Tensorflow 2.

Related

Tensorflow.compat not found

I am trying
import tensorflow.compat.v1 as tf
and getting an error
ModuleNotFoundError: No module named 'tensorflow.compat'.
I've installed tensorflow=2.8.0, tensorflow-estimator=2.1, tensorflow-gpu=2.8.0 and the python version is 3.9.9. What could be the issue?

How to overcome "No module named 'keras'" while importing tensoflow_hub

I am using Anaconda and Jupyter Notebook. I need a tensorflow_hub to import the ResNet model, however, I get the error No module named Keras. I've installed keras and tensorflow_hub in Anaconda. I have no issues when I am using keras.
This "AlreadyExistsError: Another metric with the same name already exists." error shows up when you have a mismatch version of TensorFlow and Keras installed in your system.
To verify this, please run below code in jupyter notebook:
import tensorflow as tf
print(tf.__version__)
import keras
print(keras.__version__)
You can resolve this error by upgrading the TensorFlow to the latest version as this error has been resolved in the latest TF releases - 2.7, 2.8:
!pip install --upgrade tensorflow
and import Keras from TensorFlow like this:
from tensorflow import keras
Now you can install and import tensorflow_hub using the below code without any error:
!pip install tensorflow_hub
import tensorflow_hub

How to solve ImportError even Rasa_nlu and tensorflow are installed successfully

I faced the following error after installing Rasa_nlu and Tensorflow.
ImportError: Failed to import `tensorflow`. Please install `tensorflow`. For example with `pip install tensorflow`.
Before getting the above error message, I have successfully import the following packages as shown below.
from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUModelConfig
from rasa_nlu.model import Trainer
from rasa_nlu import config
import tensorflow as tf
The following is the version of Anaconda3, Tensorflow, Rasa_nlu and python.
Anaconda-client: 1.6.14,
Anaconda-navigator: 1.8.7,
Anaconda-project: 0.8.2,
Python: 3.6,
Tensorflow: 1.8.0,
Could someone help me about me? Thank you so much.

Unable to import distributions module from Tensorflow (Dockerized)

I'm running the official TF docker repo using the Jupyter UI on localhost. It seems that TF is working in general, as I am able to import it, but when trying to import the distributions module I get an error:
print tf.__version__
import tf.distributions as dist
1.8.0
ImportErrorTraceback (most recent call last)
<ipython-input-3-4d440943cb46> in <module>()
1 print tf.__version__
----> 2 import tf.distributions as dist
ImportError: No module named tf.distributions
Try this
import tensorflow as tf
from tensorflow import distributions as dist
I don't think you can use import aliases for other import statements in python. I'm not too sure about this, but I think that's the problem.
FYI, I tested this on Python 3.5.2 and Tensorflow 1.8.0

ImportError: No module named 'tensorflow.contrib.data'

My tensorflow version is 1.1.0
I try to import some file:
strong textfrom tensorflow.contrib.data import Dataset, Iterator
and got error :
ImportError: No module named 'tensorflow.contrib.data'
So, what is solution of this?
tf.contrib.data has been deprecated and been removed (Check here). So, in order to import "Dataset" and "iterator", follow the following steps:
You need to upgrade the tensorflow version using:
sudo pip3 install --upgrade tensorflow.
Check the installation guide here
Open the python terminal and type
import tensorflow as tf
dataset = tf.data.Dataset
Hope it will help.