I've tried to install bunch of python packages in Google Cloud Platform Console. However, the disk space was not enough and installation failed. Interestingly, at some point, the network connection was lost and I should reconnect it.
And then I've checked some packages which had been already installed before I tried to install other bunch of python packages.
Expecting
$ python
Python 2.7.9 (default, Mar 1 2015, 12:57:24)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>>
But numpy was not found. This is the actual result.
$ python
Python 2.7.9 (default, Mar 1 2015, 12:57:24)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>>
Is this a known issue? How can I prevent happening it again?
Repro steps
- Click "Activate Google Cloud Shell" icon on the top bar
- I have two projects and one of the projects is selected.
Install python-numpy package like this :
Welcome to Cloud Shell! For help, visit https://cloud.google.com/cloud-shell/help. $ sudo apt-get install python-numpy
Try to import numpy on python prompt --> it is successfully imported.
Close the tab of the browser or just close the shell tab
A few hours later (maybe 2 hours later), reopen the Cloud Shell.
Try to import numpy on python prompt --> "No module named numpy" error.
You mean in Cloud Shell? Cloud Shell connects to a persistent disk and whatever you install on this disk should be saved. If you see otherwise consistently, let us know the repo steps.
This is a known limitation of Google Cloud Shell - after about an hour of inactivity, any modifications outside of $HOME are lost, including installed packages. See Custom installed software packages and persistence.
Also note this quote regarding Usage limits: