ModuleNotFoundError: No module named 'keras_preprocessing'

31.7k Views Asked by At

I'm trying to implement YOLO3 object detection using tensorflow 2.0 on google colab : https://github.com/theAIGuysCode/Object-Detection-API

And for this particular line:

!python3 /content/Object-Detection-API/load_weights.py

I'm facing this error:

ModuleNotFoundError: No module named 'keras_preprocessing'

I tried installing 'keras_preprocessing' using this command:

!conda install keras_preprocessing

and then I'm facing this error:

Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

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

  - keras_preprocessing

Current channels:

  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

Please help me solve the same! Thank you!

3

There are 3 best solutions below

3
On BEST ANSWER

From the Anaconda repository of the Keras Preprocessing package, you can install it with

conda install -c conda-forge keras-preprocessing

that is, with an - instead of _ and with selecting the conda-forge channel.

1
On

Try this

pip install Keras-Preprocessing
1
On

Use from tensorflow.keras.preprocessing.image import ImageDataGenerator