randomGeek4
randomGeek4

Reputation: 181

Unable to import tensorflow_addons

I did a pip install for the tensorflow_addons module. Then when I execute import tensorflow_addons, I'm getting the error below. How to fix this? tf.version prints this'1.13.1'. but when I checked the versions through anaconda prompt conda list -n base I found these

tensorboard 2.1.1 pypi_0 pypi tensorflow 2.1.0 pypi_0 pypi tensorflow-addons 0.9.1 pypi_0 pypi tensorflow-datasets 3.0.0 pypi_0 pypi tensorflow-estimator 2.1.0 pypi_0 pypi tensorflow-gpu 1.13.1 h0d30ee6_0 anaconda tensorflow-metadata 0.21.2 pypi_0 pypi

I tried this on both Windows and Ubuntu systems. same error on both systems. pip install output

Error image

Upvotes: 6

Views: 31485

Answers (6)

M E S A B O
M E S A B O

Reputation: 953

In in Jupyter Notebook (this works well for me):

!conda install -q -U tensorflow_addons

or

!pip install -q -U tensorflow_addons

OR

In your terminal:

pip install -q -U tensorflow_addons

https://blog.finxter.com/fixed-modulenotfounderror-no-module-named-tensorflow-addons/

For more information, please visit the official website here: tensorflow optimizers cyclical learningrate

Upvotes: 0

Anirudh Jayant
Anirudh Jayant

Reputation: 46

Before installing tensorflow-addons, please check the compatible version of tensorflow-addons with your TF & Python version.

You can refer this for compatibility match:

enter image description here

Source: https://github.com/tensorflow/addons

For checking TF version

tf.__version__

For checking Python version

!python --version

Let say you got TF version: 2.9.2 & Python version: 3.8.16. From the compatibility sheet, the latest version you can install is 'tensorflow-addons-0.19.0'

To install tensorflow-addons:

!pip install tensorflow-addons==0.19.0

Now, we can import tensorflow addons like this

import tensorflow_addons as tfa

Upvotes: 2

Grace U. Nneji
Grace U. Nneji

Reputation: 381

On your conda environment

pip install tensorflow-addons

Upvotes: 0

BestDogeStackoverflow
BestDogeStackoverflow

Reputation: 1117

I was having the same problem today on google colaboratory, but both solution did not work for me, maybe it's a problem with the current versions in 2022.

To solve the problem i had to tweak the two versions of tf and tf addons. So if in the future you have the same problem try to change the number of the 2 versions.

In the end i manage to solve without reinstalling tf like this:

!pip install tensorflow-addons==0.16.1
import tensorflow_addons as tfa

This is enough right now.

Upvotes: 7

Victor
Victor

Reputation: 514

Google Colab

!pip install tensorflow-addons==0.8.3
!pip install tensorflow==2.2.0-rc3

And after that

import tensorflow_addons as tfa

Upvotes: 5

randomGeek4
randomGeek4

Reputation: 181

I found the answer for this problem. There is some bug in the above versions of tensorflow and tensorflow-addons modules. All you have to do is pip install the below mentioned versions and it will work.

pip install --user tensorflow-addons==0.8.3
pip install --user tensorflow==2.2.0-rc3

now you can import tensorflow_addons. I simply checked the versions installed in google colab link given in the official tensor flow addons page and changed my versions to that.

The screen shot of google colab code

Upvotes: 3

Related Questions