Skip to main content
Shankar
Gold ⭐️
Apr 18, 2020 1:13 AM UTC
Solved

Importerrir: cannot import name SparkSession

Hi,

 

I am using Cloudera Quickstart VM 5.13.0 to write code using pyspark.

 

Trying to import SparkSession using below command:

from pyspark.sql import SparkSession

 

It's throwing an error saying Importerrir: cannot import name SparkSession

 

I need help to fix this. Please suggest me if anything missed

Shankar
ShankarAnswer
Gold ⭐️
Apr 30, 2020 7:34 PM UTC

Hi All,

 

I have fixed this issue by updating spark to 2.4.5 as SparkSession has introduced from 2.0.

 

Earlier, spark 1.6 was installed and could not proceed to import SparkSession.

 

Thanks all...!!!

 

Regards,

Shankar.

3 replies

Shankar
ShankarAuthor
Gold ⭐️
Apr 18, 2020 4:06 PM UTC

 

Below is the screenshot of my code and error message.

Shankar_0-1587225969288.png

 

Translate
Shankar
ShankarAuthorAnswer
Gold ⭐️
Apr 30, 2020 7:34 PM UTC

Hi All,

 

I have fixed this issue by updating spark to 2.4.5 as SparkSession has introduced from 2.0.

 

Earlier, spark 1.6 was installed and could not proceed to import SparkSession.

 

Thanks all...!!!

 

Regards,

Shankar.

Translate
Lewi
Silver ⭐️
Feb 10, 2023 9:49 PM UTC

Hello Shankar,

 

Please did the portal request username and password before allowing you to download Spark 2.4.5 ?

I have the same issue , but it ask me for credentials when I try to download. How do I get this credential? I have tried by just setting up an account, but that did not work.

 

Thanks

Lewi. 

Translate