1

I need to load a model that I locally developed using Python ver. 3.10 to Google Colab. However, when I tried loading the model, it returns a ModuleNotFoundError: No module named 'scipy.sparse._csr'. I tried using this approach to upgrade the Python version on Colab to 3.10, but it still won't work. Below is my code:

#install python 3.10
!sudo apt-get update -y
!sudo apt-get install python3.10

#change alternatives
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2

#check python version
!python --version
# Python 3.10.6

Then I tried loading the model from my Google Drive:

NoPoverty_model = joblib.load(open("/content/drive/MyDrive/Colab Notebooks/Model/NoPoverty_model.sav", 'rb'))
# ModuleNotFoundError: No module named 'scipy.sparse._csr'

Does anyone knows how to solve this?

  • 1
    `from scipy import sparse` – hpaulj Aug 12 '22 at 22:07
  • Hi, I've tried both `import scipy` and `from scipy import sparse` but both of them returns the same error `ModuleNotFoundError: No module named 'scipy.sparse._csr'`. Any other ideas on how to solve this? – mhutagalung Aug 14 '22 at 18:45

0 Answers0