'Pycharm Error: Could not find valid SPARK_HOME while searching

First day with Spark. My environment is Oracle VM, Guest Ubuntu OS. I installed Python3, Spark etc and it's working on the terminal. The first code I tried on terminal is enter image description here

and it's working. Now if I try to run the same code on pycharm, it throws an error

/home/daisy57/PycharmProjects/meteor/venv/bin/python /home/daisy57/PycharmProjects/meteor/main.py
Could not find valid SPARK_HOME while searching ['/home/daisy57/PycharmProjects', '/opt/spark/python/lib/pyspark.zip/pyspark/spark-distribution', '/opt/spark/python/lib/pyspark.zip/pyspark', '/opt/spark/python/lib/pyspark.zip/pyspark/spark-distribution', '/opt/spark/python/lib/pyspark.zip/pyspark', '/opt/spark/python/lib']

Process finished with exit code 255

My pycharm code: enter image description here

I added the two path in the content root also: enter image description here

but its still showing the error. Please help this noob out! Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source