Reputation: 21
Have a new MacBook w/ macOS Mojave but cannot get spark/pyspark working. I have done the following:
/Users/myname/
)spark
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
>> python get-pip.py
in the terminal >> Checked that it was installed by doing import pip
in the python shell >> sudo easy_install pip
in the regular terminalpip install pyspark
, which workedUsers/myname/
pathexport 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
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