kpt09
kpt09

Reputation: 21

Cannot get spark/pyspark working on macOS Mojave

Have a new MacBook w/ macOS Mojave but cannot get spark/pyspark working. I have done the following:

export SPARK_HOME="/Users/myname/spark/python"
export PATH="$SPARK_HOME/bin:$PATH"
export SPARK_HOME=/Users/myname/spark/python
export PATH=$SPARK_HOME/bin:$PATH
export SPARK_HOME=/Users/myname/spark
export PATH=$SPARK_HOME/bin:$PATH
export SPARK_HOME=~/spark
export PATH=$SPARK_HOME/bin:$PATH

Different installation articles say I should just be able to do pyspark in the terminal, or spark/bin/spark-shell or just 'bin/spark-shell`, I just keep getting versions of the message

-bash: pyspark: command not found

Any advice?

Upvotes: 2

Views: 479

Answers (1)

Dave
Dave

Reputation: 2059

If you've installed pyspark from pip, you don't need the standalone installation. You just need to fix you env vars. First, find the location of your site packages:

python -c "import site; print(site.getsitepackages())"

This is probably something like this /usr/lib/pythonX.Y/site-packages

Then, add the exports to your bash profile and source it.

echo "export SPARK_HOME=/usr/lib/pythonX.Y/site-packages/pyspark" >> ~/.bash_profile
echo "export PATH=$SPARK_HOME/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile

Upvotes: 0

Related Questions