How to Install tensorflow addons via conda - tensorflow

I cannot find it out. Does Conda support it?
conda install tensorflow-addons
cannot find out the package

You can find information related to TensorFlow Addons here. Currently, it looks like Conda does not support Tensorflow Addons yet. You will have to wait for it to be implemented in the future. Otherwise, you can use pip install tensorflow-addons.

You can use pip in your Anaconda environment to install tensorflow-addons.
pip install tensorflow-addons
then to use:
import tensorflow_addons as tfa
I was able to successfully import it and use InstanceNormalization

conda install -c esri tensorflow-addons
or
conda install -c esri/label/prerelease tensorflow-addons
https://anaconda.org/esri/tensorflow-addons

To install the latest version of addons, run the following:
pip install tensorflow-addons
To use addons:
import tensorflow as tf
import tensorflow_addons as tfa
For more information please refer the below link
Tensorflow-addons

Related

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
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.
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
Google Colab
!pip install tensorflow-addons==0.8.3
!pip install tensorflow==2.2.0-rc3
And after that
import tensorflow_addons as tfa
On your conda environment
pip install tensorflow-addons
Before installing tensorflow-addons, please check the compatible version of tensorflow-addons with your TF & Python version.
You can refer this for compatibility match:
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

Downgrading TensorFlow from 1.15 to 1.14 not working

I have a colab notebook which was running tf1.15.0. I need to downgrade it to 1.14.0. In a cell, it run the following:
!pip uninstall tensorflow==1.15.0
!pip install tensorflow==1.14.0
import tensorflow as tf
print(tf.__version__)
However, it outputs:
> 1.15.0
What am I doing wrong please?
CS
IF you have import tensorflow cell before uninstall, you may need to restart notebook to make it effective.
IF you have not, make sure you are running the correct pip in the same python environment as the notebook, such as:
import sys
!{sys.executable} -m pip install xx
Do you have TensorFlow-GPU installed in the system? Because this is the same issue I was facing earlier, so try downgrading TensorFlow-GPU.
pip install tensorflow-gpu==1.14
or any other version of tensorflow-gpu.

Import Error in installation: Error installing Horovod and Tensorflow

I am trying to install Tensorflow and Horovod
pip install tensorflow
HOROVOD_WITH_TENSORFLOW=1 pip install horovod
Then I ran a sample code
import tensorflow as tf
import horovod.tensorflow as hvd
When I run this code, I get the error
ImportError: Extension horovod.tensorflow has not been built. If this is not expected, reinstall Horovod with HOROVOD_WITH_TENSORFLOW=1 to debug the build error.
If you need to install tensorflow and horovod , you can use the following steps:
1)Create a conda environment to avoid the mismatch of package versions.
conda create -n test_hvd -c intel python=3.6
2)Activate the environment
source activate test_hvd
(You can use any name instead of test_hvd, which is an environment name.)
3)Install tensorflow in the activated environment:
pip install https://storage.googleapis.com/intel-optimized-tensorflow/tensorflow-1.10.0-cp36-cp36m-linux_x86_64.whl
4)Finally install horovod
pip install --no-cache-dir horovod
Note: 1. Kindly confirm if you are using the latest versions of GCC (gcc (GCC) 6.4.0 works fine).
These steps are tested on Linux OS
Hope this helps!

Uninstalling TensorFlow from Anaconda environment

Does anyone know how to uninstall TensorFlow from Anaconda environment? I want to upgrade the TensorFlow to the latest version which is ver.1.4, but not working well. So I want to uninstall it and then install the newest version.
You can remove a package with the conda remove command. So for TensorFlow this would be conda remove tensorflow.
If you have installed using pip then use:
pip uninstall tensorflow
The following helped me to completely remove Tensorflow after I used conda remove tensorflow and pip uninstall tensorflow
python3 -m pip uninstall protobuf
python3 -m pip uninstall tensorflow
python3 -m pip uninstall tensorflow-gpu
How to remove packages from Anaconda environment
Step 1:open anaconda navigator and select environment from which package you want to uninstall
Step 2:left click on the rectangular box and select mark for removal and finally click apply button
It can be easily uninstall by
conda uninstall tensorflow
from Anaconda

I am not able to update tensorflow installed with anaconda

I have been trying to update tensorflow from 1.2.1 to 1.3.
I did the following on my terminal:
pip3 install tensorflow --upgrade
After this, I tried checking the version
python3 -c 'import tensorflow as tf; print(tf.__version__)'
This outputs 1.2.1 but not 1.3.0
All this had been done in an anaconda environment.
Operating system: macOS Sierra
I would like to know how one can perform this update.
Thank you
The solution that I found was to install pip inside the conda environment and use that instance of pip to install the packages. Please refer here
The reason I got the above error was that the python3 and pip3 paths were different.
This became evident when I ran the below commands inside the conda environment.
which python3
/Users/SMBP/anaconda/envs/tensorflow/bin/python3
which pip3
/usr/local/bin/pip3
Also, I think it is better to use virtualenv and virtualenvwrapper if you wish to work with tensorflow as it is the recommended way.