16

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

 4 years ago
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.
neoserver,ios ssh client

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:

enter image description here

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK