Topic starter 03/06/2021 12:56 am
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 🙄Â
myTechMint liked
03/06/2021 1:04 am
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, 0914) [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, 0914) [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