No module name pysp...
 
Share:
Notifications
Clear all

No module name pyspark error


Neha
 Neha
(@asha)
Member Admin
Joined: 10 months ago
Posts: 8
Topic starter  
ImportError Traceback (most recent call last)

<ipython-input-1-c6e1bed850ab> in <module>()
1 from pyspark import SparkContext
2 sc = SparkContext('local', 'Exam_3')
3
4 from pyspark.sql import SQLContext
5 sqlContext = SQLContext(sc)

ImportError: No module named pyspark

Please help me to resolve this issue 🙄 


Quote
Topic Tags
myTechMint
(@mytechmint)
Active Member
Joined: 11 months ago
Posts: 6
 

You don't have pyspark installed in a place available to the python installation you're using. To confirm this enter your terminal (python) and type import pyspark

$ python
Python 3.5.0 (default, Dec 3 2015, 09:58:14)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyspark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'pyspark'

Now here you see the No module name 'pyspark' ImportError you need to install that library. Quit the python terminal by using exit() and just type below PySpark installation command

pip install pyspark

Then re-enter the python terminal to confirm it works as shown below.

$ python
Python 3.5.0 (default, Dec 3 2015, 09:58:14)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyspark
>>>

 


Neha liked
ReplyQuote