Error installing tensorflow 2.2 on Colab as well as Anaconda

@Osama_Saad_Farouk, try installing tensorflowjs before the tensorflow modifications;

  1. conda create -n tf210 tensorflow=2.1.0 python=3.7
  2. conda activate tf210
  3. pip install tensorflowjs==2.0.0
  4. pip install tensorflow-intel==0.0.1
  5. pip install tensorflow-cpu==2.1.0
  6. pip install tensorflow-estimator==2.1.0rc0
  7. pip install tensorflow==2.2.0

Then remember to install matplotlib as well, and open jupyter lab. I would recommend installing jupyter lab through the anaconda prompt. Here, you select tf210 from the environemnt dropdown list in the main page and you should be able to see a jupyter lab icon with the option to install. It does take a little bit to install so don’t worry about the wait time. Once jupyter lab downloads, you’re able to launch it from there (the install button should change to launch or open button).

2 Likes

hi @Jan_Danel
I already follow this step, but end up with error ‘no module named tensorflow’ when importing tensorflow as tf. do you have similar error too?

@Richie_Alexander No, I did not have this error. Make sure you open jupyter lab in the same tf210 environment. Assuming you are using anaconda, I think the default environment is named basic. So, you have to select the tf210 environment and then launch jupyter lab. You may be required to install jupyter lab in tf210.

oh thanks for your help, finally I can solve this

Finally solved it.

install anaconda
use conda prompt for the following:

  1. navigate to your assignment folder
  2. conda create -n tf210 tensorflow=2.1.0 python=3.7
  3. conda activate tf210
  4. pip install tensorflowjs==2.0.0
  5. pip install tensorflow-intel==0.0.1
  6. pip install tensorflow-cpu==2.1.0
  7. pip install tensorflow-estimator==2.1.0rc0
  8. pip install tensorflow==2.2.0
  9. pip install jupyter notebook
  10. pip install matplotlib
  11. jupyter notebook

once the notebook is up

!pip install tensorflow==2.2 (comment this)

!pip install tensorflowjs (and this)

import tensorflowjs as tfjs (run this)
import tensorflow as tf (and this)

print(‘\u2022 Using TensorFlow Version:’, tf.version)

returns “• Using TensorFlow Version: 2.2.0”

run all

at the final code cell when using tensorflowjs_converter you will get a warning: (this doesn’t matter)

2023-04-14 21:45:55.710045: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library ‘cudart64_101.dll’; dlerror: cudart64_101.dll not found
2023-04-14 21:45:55.710065: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

go to your assignment folder and you will see 10 bin shards and your model.json
zip then submit

6 Likes

I am having a problem following those steps. I successfully created the conda environment with the given args, but it fails when trying to install tensorflow with the following error message:

ERROR: Could not find a version that satisfies the requirement tensorflow==2.2.0 (from versions: 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0, 2.11.1, 2.12.0rc0, 2.12.0rc1, 2.12.0)
ERROR: No matching distribution found for tensorflow==2.2.0

I verified that the python version in the environment is 3.7.16, and that it is 64bit. I also tried upgrading pip.

Any ideas?

======================================================================

EDIT: I fixed this by adding both the anaconda3 and anaconda3/Scripts dirs to the PATH (using Windows10). I deleted the environment, restarted all steps and everything went fine.

I’ve tried this and this is work for me. I got the 2.2 version. but, after I ran some code, I got an error when I want to train my model.
The error message is ImportError: Could not import PIL.Image. The use of load_img requires PIL.
I’ve tried install the PIL with from PIL import Image and it still get the same error.
Any idea what’s wrong with my code?
Anw, I just ran the code that already written by the author and I didn’t change anything on that code.
Thanks in advance

I got a similar issue with installing TensorFlow 2.2 on my Mac.

Here’s what I did:

conda create -n tf210 python=3.7

Then I activate the env:

conda activate tf210

And then, I tried to install TensorFlow v2.1.0 with the following command:

conda install tensorflow=2.1.0

But, it returns the following error:

PackagesNotFoundError: The following packages are not available from current channels:

  - tensorflow=2.1.0

Anyone has solved this issue?

I’ve tried this but still does not work

I got same issue, any idea for fix this?

Hello,

Did you try this command: conda install pillow?

To solve this problem, the best way is to create a virtual environment with python version 3.8.16 through “Anaconda Navigator”, open it in a new terminal, then execute these commands:

pip install tensorflow==2.2.0
pip install tensorflowjs==2.8.5
pip install tensorflow-estimator==2.2.0
pip install protobuf==3.12.2
pip uninstall numpy
pip install numpy==1.19.3
pip install matplotlib==3.4.2
conda install jupyter notebook

Now, you have to restart the Anaconda Navigator in order to let it update the installed packages of the created virtual environment.

You can then open the jupyter notebook of the virtual environment through Anaconda Navigator, or through terminal with the following command:

jupyter notebook