python - ImportError: No module named numpy - Google Cloud Dataproc when using Jupyter Notebook -


when starting jupyter notebook on google dataproc, importing modules fails. have tried install modules using different commands. examples:

import os os.sytem("sudo apt-get install python-numpy") os.system("sudo pip install numpy") #after having installed pip os.system("sudo pip install python-numpy") #after having installed pip  import numpy 

none of above examples work , return import error:

enter image description here

when using command line able install modules, still import error remains. guess installing modules in wrong location.

any thoughts?

i found solution.

import sys  sys.path.append('/usr/lib/python2.7/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") os.system("sudo apt-get install python-sklearn -y")  import pandas import numpy import scipy import sklearn 

if 1 has more elegant solution, please let me know.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -