-1

I wrote a line of code in watson studio As Rdd = sc.parallelized (range(100)) Output SC is not defined How to solve this please help some buddy

  • Can you be more specific about what the issue is? Have you done any debugging yourself? Please see [ask], [help/on-topic]. – AMC Apr 29 '20 at 01:44

2 Answers2

1

Watson Studio has multiple types of environments. There is likelihood that instead of using PySpark based runtime environment , you must have selected Python based runtime environment. Please make sure to check your runtime environment. enter image description here

For more details on runtimes:- https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/spark-envs.html

charles gomes
  • 2,145
  • 10
  • 15
0

SC is not defined looks like the result of a Python Traceback (error message). It means that sc references something that has not been created yet.

I suggest checking your spelling to see if maybe you declared sc under a different name. Also, Python is case-sensitive, so beware of that.

AwesomeCronk
  • 421
  • 6
  • 16
  • The spelling is correct. `sc` is the pre-defined Spark context, if code is being executed in a runtime with Spark. In runtimes without Spark, it is undefined. – Roland Weber Apr 29 '20 at 05:17