
16

ImportError: No module named numpy - Google Cloud Dataproc when using Jupyter No...
source link: https://www.codesd.com/item/importerror-no-module-named-numpy-google-cloud-dataproc-when-using-jupyter-notebook.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

ImportError: No module named numpy - Google Cloud Dataproc when using Jupyter Notebook
advertisements
When starting Jupyter Notebook on Google Dataproc, importing modules fails. I have tried to install the modules using different commands. Some 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 the above examples work and return an import error:
When using command line I am able to install modules, but still the import error remains. I guess I am installing modules in a wrong location.
Any thoughts?
I found a 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 any one has a more elegant solution, please let me know.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK