Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

605
Views
findspark.init () IndexError: índice de lista fuera de rango de error

Cuando ejecuto lo siguiente en un entorno Python 3.5 Jupyter, aparece el siguiente error. ¿Alguna idea sobre lo que lo está causando?

 import findspark findspark.init()

Error:

 IndexError Traceback (most recent call last) <ipython-input-20-2ad2c7679ebc> in <module>() 1 import findspark ----> 2 findspark.init() 3 4 import pyspark /.../anaconda/envs/pyspark/lib/python3.5/site-packages/findspark.py in init(spark_home, python_path, edit_rc, edit_profile) 132 # add pyspark to sys.path 133 spark_python = os.path.join(spark_home, 'python') --> 134 py4j = glob(os.path.join(spark_python, 'lib', 'py4j-*.zip'))[0] 135 sys.path[:0] = [spark_python, py4j] 136 IndexError: list index out of range
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Lo más probable es que esto se deba a que la variable de entorno SPARK_HOME no está configurada correctamente en su sistema. Alternativamente, puede especificarlo cuando esté inicializando findspark , así:

 import findspark findspark.init('/path/to/spark/home')

Después de eso, ¡todo debería funcionar!

over 4 years ago · Santiago Trujillo Report

0

Recibí el mismo error y pude hacerlo funcionar ingresando el directorio de instalación exacto:

 import findspark # Use this findspark.init("C:\Users\PolestarEmployee\spark-1.6.3-bin-hadoop2.6") # Test from pyspark import SparkContext, SparkConf

Básicamente, es el directorio donde se extrajo Spark. En el futuro, dondequiera que veas spark_home ingresa al mismo directorio de instalación. También intenté usar toree para crear un kernel en su lugar, pero está fallando de alguna manera. Un kernel sería una solución más limpia.

over 4 years ago · Santiago Trujillo Report

0

Debe actualizar la variable SPARK_HOME dentro de bash_profile. Para mí, el siguiente comando funcionó (en la terminal):

export SPARK_HOME="/usr/local/Cellar/apache-spark/2.2.0/libexec/"

Después de esto, puede seguir estos comandos:

 import findspark findspark.init('/usr/local/Cellar/apache-spark/2.2.0/libexec')
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!