简体   繁体   中英

Installed python module in google cloud shell but python import is giving ImportError

I have tried installing scipy in Google Cloud Shell. The package is installed, but a python import is giving "ImportError: No module named scipy". Screenshot

I have problem only with scipy. Tensorflow and numpy are all working fine.

This problem should be similar to Installed packages disappeared in Google Cloud Shell .

The problem here is that scipy has not been installed. The process got killed at 99%. This is caused by how pip tries to install the package. I suspect that you're using a small VM instance which has memory limitations when pip tries to load the whole file to memory before installing it.

The solution is to install scipy with this command:

pip --no-cache-dir install scipy

Here you ask pip not to cache the file which should do the trick to install scipy on your Google Cloud VM. After the successful installation you should be able to import the scipy module as intended.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM