[FIXED] Jupyter Notebook doesn't detect Python 3.7


I am currently trying to install Tensorflow 1.15.0, but my current Python version is 3.8.10 which doesn’t support that version of Tensorflow. I installed Python3.7 using the following command:

sudo apt install python3.7

And used these commands from this post:

pip3 install ipykernel --upgrade
python3 -m ipykernel install --user

But when I run

!python3 --version

it still shows 3.8.10 and Tensorflow 1.15.0 fails to install with the following error:

ERROR: Could not find a version that satisfies the requirement tensorflow-gpu==1.15.0 (from versions: 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1)
ERROR: No matching distribution found for tensorflow-gpu==1.15.0

I am not willing to uninstall Python 3.8, because last time I did that it completely broke my OS and forced me to reinstall the entire thing. How do I solve this issue? I am on Ubuntu 20.04


You need not to uninstall Python 3.8 from your system. If you just simply follow the steps mentioned in this link, you can successfully install TensorFlow 1.15 with Python 3.7 in your system.

Or you can follow the steps below:

  1. Download and install Anaconda

(Please ignore this step if it is already installed in your system)

  1. Create a virtual environment with Python (python=3.7)
conda create --name tf python=3.7
conda deactivate    #to deactivate the tf environment
conda activate tf   #to activate the tf environment
  1. Install tensorflow

pip install tensorflow==1.15

  1. Open jupyter notebook in the same virtual environment (tf) and run below command:
import tensorflow as tf
tf.__version__     #to check installed tensorflow version
!python --version  #to check installed python version

You can also create a virtual environment and install python and TensorFlow through Anaconda Navigator.

For this, Please open Anaconda Navigator and go to:

Environments -> create -> Vir_env name -> select Python -> install and launch jupyter in the same Vir_env -> install required tensorflow version using code – !pip install tensorflow==<version>

Likewise, you can create multiple virtual environments and can install different compatible versions of python and tensorflow inside the same Anaconda Navigator.

Answered By – TFer2

Answer Checked By – Robin (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published