3
votes

Getting a weird import error when running the following code.

    ! pip install --user --upgrade git+https://github.com/broadinstitute/keras-resnet
    import keras
    import keras_resnet
    

Basically, I'm trying to install keras_resnet for keras_retinanet on Google colab however I'm getting a not found error. Output is below. The installation completes but then the import fails. Tested it locally and it works only fails on Google Colaboratory.

  Running setup.py install for keras-resnet ... - \ done
Successfully installed keras-resnet-0.0.8
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-25-4521fd3221d7> in <module>()
      2 #os.chdir('keras-retinanet')
      3 import keras
----> 4 import keras_resnet
      5 #from keras-retinanet.keras_retinanet.models.resnet import custom_objects
      6 #model = keras.models.load_model('/path/to/model.h5', custom_objects=custom_objects)

ModuleNotFoundError: No module named 'keras_resnet'
1

1 Answers

1
votes

Try dropping the --user? This worked for me:

!pip install --upgrade git+https://github.com/broadinstitute/keras-resnet
import keras
import keras_resnet