GCS Python - cannot get started due to Import Error

53 views
Skip to first unread message

Numeric Lee

unread,
Dec 8, 2017, 12:19:24 PM12/8/17
to Google App Engine
running python3 script from the cloud shell using 
python3 directory/folder.py

the scipt always throws an exception when I attempt to import numpy  or pandas (it will import csv and regex)

the code works locally. 
by all appearances numpy and pandas are properly installed .  I have even reinstalled them multiple times.


ALSO, if I go to the python3 text editor and install "import numpy" at the prompt it also tells me that the module is not found. See Attached. The pip installs to python2.7 but I can see numpy is also installed for python3.4


Perhaps  there an environmental variable I am missing

I have seen people ask the same question on Stack Overflow.
for example
but the answers are not pertinent.


While it shouldnt be necessary, I even tried inserting the red lines in my script  as a workaround without success

from __future__ import print_function, division

import sys,os
sys.path.append('/usr/lib/python3.4/dist-packages')

os.system("sudo apt-get install python-pandas -y")
os.system("sudo apt-get install python-numpy -y")
os.system("sudo apt-get install python-scipy -y")


import  csv, time, re
import pandas as pd
import numpy as np 
 
I dont see this addressed anywhere in your documentation


 
gcs_screenshot.png

Kenworth (Google Cloud Platform)

unread,
Dec 10, 2017, 4:17:39 PM12/10/17
to Google App Engine
First install pip3 on Python 3:

sudp apt-get update
sudo apt-get -y install python3-pip

Then install the library using pip3:

pip3 install numpy

Verify installation:

pip3 list


Reply all
Reply to author
Forward
0 new messages