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

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.

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

ROBOFLOW-tensorflow-object-detection-faster-rcnn_ cannot import name 'get_config' from 'tensorflow.python.eager.context'

I was trying to implement Fast RCNN model on my custom dataset using the google colab ROBOFLOW-tensorflow-object-detection-faster-rcnn.ipynb, but when I run the 'Install required packages' section ,Iam getting the error 'cannot import name 'get_config' from 'tensorflow.python.eager.context' . I tried to upgrade tensorflow and Keras , but not working
Tried Upgrade of tensorflow
Also trying to locally download the repository to try to import from tensorflow. Please help
Try to upgrade the tensorflow:
pip install --upgrade tensorflow
pip install --upgrade tensorflow-gpu
For me TF2.9 worked for the same ROBOFLOW colab notebook:
!yes|pip uninstall tensorflow
!pip install tensorflow==2.9

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.

Python cannot find Tensorflow module

With Python3.5, I try to use the 'tensorflow' module:
import tensorflow as tf
But.. it says No mudule named tensorflow
I just tried to download the module with pip3:
pip3 install --upgrade tensorflow-gpu
(I have all the requirements to run tensorflow with GPU support as described at tensorflow.org)
I've seen a similar question here ImportError: No module named tensorflow , here's a sum up of what's inside:
Make sure installation is correct via:
pip3 show tensorflow
You can optionally re-install it again using: pip install tensorflow==1.2.0 --ignore-installed
Make sure you're running the python code with Python 3.x, verify using: python --version
Make sure you install TF and run the script through the same user, avoid installing TF using sudo pip install... and running the code with python script.py

Cant import keras

I ran the following on my Anaconda command prompt for python 3.6:
pip install keras
Next, typing the following on Spyder:
import keras
The above gives me an error:
No module named 'tensorflow'
Tring to do pip install tensorflow on the Anaconda command prompt gives me the follwing error:
No matching distribution found for tensorflow
To install a module into anaconda, use
$ conda install tensorflow
The command that you ran
$ pip install tensorflow
will not install it inside the anaconda virtualenv for python.
If you try
$ python
>>> import keras
This will work after pip install tensorflow. However, use conda package manager to install modules to anaconda.