theAIGuysCode/yolov4-deepsort

!pip install tensorflow==2.3.0 is not working on Colab

tpootai opened this issue · 4 comments

Previously, the following command was utilized to install Tensorflow 2.3.0 in order to convert Darknet weights to a Tensorflow model within save_model.py:

!pip install tensorflow==2.3.0

However, currently Tensorflow 2.3.0 is not available, and the following error is persistently occurring:

Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
ERROR: Could not find a version that satisfies the requirement tensorflow==2.3.0 (from versions: 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 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.7.4, 2.8.0rc0, 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.12.0rc0, 2.12.0rc1)
ERROR: No matching distribution found for tensorflow==2.3.0

I attempted to upgrade to TensorFlow 2.5.0 or the most recent version offered by Colab.

However, the issue remains that only the initial frame is being tracked, and the subsequent frames are not being tracked, yielding a zero track.

As a beginner, I would appreciate any assistance, and thank you in advance for your help.

P.S. I have done research on some issues and here are the references

  1. #155
  2. #153
  3. #159
  4. #156
  5. #132

@tpootai
Change to python 3.8 by running:
!sudo update-alternatives --config python3
!sudo apt install python3-pip

run:
! pip install tensorflow==2.3.0

if you get some errors try to run this as well:
!pip install protobuf==3.19.6
!pip install certifi==2022.12.7
!pip install idna==2.10
!pip install tensorboard==2.9.1
!pip install tensorboard_data_server==0.6.1
!pip install requests==2.25.1

Then you should be all good!

Hi @mikalbre
Thank you for your clear and precise answer!

I tried what you proposed and got a few more errors. However, I managed to fix it through the method I mentioned below.
Please note that I am implementing this object_tracker.py code from this repo on Google Colab.

First, I change to python 3.8 and install libraries as @mikalbre said:

!sudo update-alternatives --config python3
!sudo apt install python3-pip

! pip install tensorflow==2.3.0`
! pip install protobuf==3.19.6
! pip install certifi==2022.12.7
! pip install idna==2.10
! pip install tensorboard==2.9.1
! pip install tensorboard_data_server==0.6.1
! pip install requests==2.25.1

I also install gdown to download video from my Google Drive to the runtime.

!pip install gdown
!pip install --upgrade gdown

Then before running ! python save_model.py --model yolov4 you must install 2 more libraries

!pip install opencv-python
!pip install easydict

After that, install 3 more libraries before running
! python object_tracker.py --video input_video.mp4 --output ./outputs/output_video.mp4 --model yolov4 --dont_show --count --info

!pip install Pillow
!pip install matplotlib
!pip install numpy==1.20

object_tracker.py should work fine if you do this by exact order

P.S. I think the main problem comes from library dependencies. If anyone reading this thread has a better method or the method I proposed also works fine with you, comments would be much appreciated!

I've tried this, but when I import tensorflow as tf, I found it still import tensorflow 2.12.0(from path /usr/local/lib/python3.9/dist-packages/tensorflow-2.12.0), tensoflow 2.3 was installed in path /usr/local/lib/python3.8/dist-packages, then I tried to insert this path in sys(sys.path.insert(0, '/usr/local/lib/python3.8/dist-packages/')), it mentioned Python version mismatch: module was compiled for Python 3.8, but the interpreter version is 3.9.2

PLEASE HELPP!!
This also doesnt work. UPUPUP!!!