Downgrading TensorFlow from 1.15 to 1.14 not working - tensorflow

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.

Related

Difficulty updating keras/tensorflow on mac

I am working on a jupyter notebook script which I used last year to train a neural network.
When I try to import the keras tokenizer:
from keras.preprocessing.text import Tokenizer
I receive this error
I have seen other posts which suggest that I need to update tensorflow. My anaconda environment tells me I have 1.13.1 installed. But when I try to update tensorflow-base to 1.15 in the anaconda navigator, I receive this error:
I can update tensorflow from my command line using:
conda install tensorflow=1.15.0
But this doesn't update tensorflow in my anaconda environment and the error persists in my notebook.
Any help would be much appreciated! As you can probably tell, I am a novice python user.
The error says some packages needed to update Tensorflow/Andaconda requires Python 3.11 or newer. Since not all of the error log can be seen however, I would upgrade to python 3.7 to be safe. You can download this from the official page: https://www.python.org/downloads/
If the problem persists, try using pip to update the packages(In bash) :
pip install tensorflow
pip install conda
If you get an error while using pip, try:
pip3 install tensorflow
pip3 install conda
This same method can be used to update keras:
pip install keras
or if that does not work:
pip3 install keras
If pip is not recognized at a command, Python 3.7 is not added to path. I do not have experience with macOS, but this article should go into enough depth.
https://realpython.com/add-python-to-path/#how-to-add-python-to-path-on-linux-and-macos

ModuleNotFoundError: No module named 'bert' even after pip install bert-tensorflow and pip install bert-for-tf2

I have tensorflow 1.9.0 and after successful installation of bert using !pip install bert-tensorflow, I cannot import bert in Jupyter notebook. I even ran !pip install bert-for-tf2. Still no success.
It turns out I did not have tensorflow in my environment. Fixed after installing tensorflow.

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

How to use Tensorflow-gpu when both Tensorflow and Tensorflow-gpu are installed?

I have both TF and TF-GPU installed in the same virtual environment. when I test it in iPython terminal, it shows that TensorFlow, not TensorFlow-GPU is used. However, I want the GPU version to be used.
How to do that? Shouldn't I installed both in the same environment? Thanks.
I can recommend this:
pip uninstall tensorflow
pip uninstall tensorflow-gpu
pip install tensorflow
pip install tensorflow-gpu
Wish I knew a better answer

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