There is a number of issues with your question:

To start with, PySpark is not an add-on package, but an essential component of Spark itself; in other words, when installing Spark you get also PySpark by default (you cannot avoid it, even if you would like to). So, step 2 should be enough (and even before that, PySpark should be available in your machine since you have been using Spark already).

Step 1 is unnecessary: Pyspark from PyPi (i.e. installed with pip or conda) does not contain the full Pyspark functionality; it is only intended for use with a Spark installation in an already existing cluster. From the docs:

The Python packaging for Spark is not intended to replace all of the other use cases. This Python packaged version of Spark is suitable for interacting with an existing cluster (be it Spark standalone, YARN, or Mesos) - but does not contain the tools required to setup your own standalone Spark cluster. You can download the full version of Spark from the Apache Spark downloads page.

NOTE: If you are using this with a Spark standalone cluster you must ensure that the version (including minor version) matches or you may experience odd errors

Based on the fact that, as you say, you have already been using Spark (via Scala), your issue seems rather to be about upgrading. Now, if you use pre-built Spark distributions, you have actually nothing to install - you just download, unzip, and set the relevant environment variables (SPARK_HOME etc) - see my answer on "upgrading" Spark, which is actually also applicable for first-time "installations".

Answer from desertnaut on Stack Overflow
🌐
Apache
spark.apache.org › docs › latest › api › python › getting_started › install.html
Installation — PySpark 4.1.1 documentation - Apache Spark
torch: Required for machine learning ... high-performance model training optimizations. Installable on non-Darwin systems. Installable with pip install "pyspark[mllib]"....
🌐
Spark By {Examples}
sparkbyexamples.com › home › pyspark › how to install pyspark on mac (in 2024)
How to Install PySpark on Mac (in 2024) - Spark By {Examples}
July 30, 2025 - Installing PySpark on macOS allows users to experience the power of Apache Spark, a distributed computing framework, for big data processing and analysis
Discussions

python - Installing pyspark on MacBook - Stack Overflow
I have used Spark in Scala for a long time. Now I am using pyspark for the first time. This is on a Mac First I installed pyspark using conda install pyspark, and it installed pyspark 2.2.0 I inst... More on stackoverflow.com
🌐 stackoverflow.com
installation - How to install and use pyspark on mac - Stack Overflow
I'm taking a machine learning course and am trying to install pyspark to complete some of the class assignments. I downloaded pyspark from this link, unzipped it and put it in my home directory, and More on stackoverflow.com
🌐 stackoverflow.com
python - Installing PySpark on Mac with pipenv - Stack Overflow
I have a setup where I use pipenv for my virtual environments. I am using a MacBook. I have done the following: Installed openJDK 11 using brew Set paths in the .zprofile folder: eval "$(/opt/ More on stackoverflow.com
🌐 stackoverflow.com
installing pyspark on my m1 mac, getting an env error
I wrote a blog post recently on how to install Java with SDKMAN and Python / PySpark / Delta Lake with conda. I am on an m1 Mac as well, so those instructions will work for you. I don't like the `brew install apache-spark` approach because that doesn't make it easy to switch between different Spark versions. You need a specific set of versions to make everything play nicely. Here's the versions I'm currently using for my localhost PySpark setup: openjdk version "1.8.0_322" delta-spark 1.2.1 Python 3.9.13 PySpark 3.2.0 Here's the conda environment I am using. The other approach I've used is Poetry, see the chispa project as an example. Poetry is especially nice for projects that you'd like to publish to PyPi because those commands are built-in. The Python versioning is tough. I've only been able to find a good workflow with conda or Poetry. Anything else has caused me pain & suffering, haha. More on reddit.com
🌐 r/apachespark
6
3
June 4, 2022
🌐
Machine Learning Plus
machinelearningplus.com › blog › install pyspark on mac – a step-by-step guide to install pyspark on mac with code examples
Install PySpark on MAC - A Step-by-Step Guide to Install PySpark on MAC with Code Examples - machinelearningplus
April 11, 2023 - If not, you can download it from https://www.python.org/downloads/mac-osx/ PySpark requires Java 8 or later to run. To install the latest version of JDK, open your terminal and execute the following command: ... Set the JAVA_HOME environment variable in your shell profile (e.g., ~/.bashrc or ~/.zshrc) by adding the following line: ... First, we need to install Apache Spark using Homebrew. Open the Terminal and run the following command: ... This command will install the latest version of Apache Spark on your macOS system.
🌐
Medium
medium.com › @jpurrutia95 › install-and-set-up-pyspark-in-5-minutes-m1-mac-eb415fe623f3
Install and Set Up Pyspark in 5 Minutes (M1 Mac) | by JP Urrutia | Medium
August 4, 2023 - Install and Set Up Pyspark in 5 Minutes (M1 Mac) You’ve got big data and think you’re ready for the big-league processing. Are your pandas jobs starting to struggle when trying to handle large …
Top answer
1 of 3
4

There is a number of issues with your question:

To start with, PySpark is not an add-on package, but an essential component of Spark itself; in other words, when installing Spark you get also PySpark by default (you cannot avoid it, even if you would like to). So, step 2 should be enough (and even before that, PySpark should be available in your machine since you have been using Spark already).

Step 1 is unnecessary: Pyspark from PyPi (i.e. installed with pip or conda) does not contain the full Pyspark functionality; it is only intended for use with a Spark installation in an already existing cluster. From the docs:

The Python packaging for Spark is not intended to replace all of the other use cases. This Python packaged version of Spark is suitable for interacting with an existing cluster (be it Spark standalone, YARN, or Mesos) - but does not contain the tools required to setup your own standalone Spark cluster. You can download the full version of Spark from the Apache Spark downloads page.

NOTE: If you are using this with a Spark standalone cluster you must ensure that the version (including minor version) matches or you may experience odd errors

Based on the fact that, as you say, you have already been using Spark (via Scala), your issue seems rather to be about upgrading. Now, if you use pre-built Spark distributions, you have actually nothing to install - you just download, unzip, and set the relevant environment variables (SPARK_HOME etc) - see my answer on "upgrading" Spark, which is actually also applicable for first-time "installations".

2 of 3
3

Step 1: If you don't have brew first install brew using the following command in terminal

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Step 2: Once you have brew then run below command to install java on your Mac.

brew cask install homebrew/cask-versions/adoptopenjdk8

Step 3: Once Java is installed run the below command to install spark on Mac

brew install apache-spark

Step 4: type pyspark -version

🌐
DataCamp
datacamp.com › tutorial › installation-of-pyspark
Install Pyspark on Windows, Mac & Linux | DataCamp
August 29, 2020 - Follow our step-by-step tutorial and learn how to install PySpark on Windows, Mac, & Linux operating systems. See how to manage the PATH environment variables for PySpark. Discover PySpark today!
🌐
GitHub
gist.github.com › brianspiering › 1e690b593db025b5acee920fa7330366
Installation guide to pyspark on M1 Mac · GitHub
SPARK_HOME = "/opt/homebrew/Cellar/apache-spark/3.3.1/libexec" JAVA_HOME = '/opt/homebrew/opt/openjdk' os.environ['SPARK_HOME'] = SPARK_HOME os.environ['JAVA_HOME'] = JAVA_HOME sys.path.extend([ f"{SPARK_HOME}/python/lib/py4j-0.10.9.5-src.zip", f"{SPARK_HOME}/python/lib/pyspark.zip", ]) from pyspark.sql import SparkSession spark = SparkSession.builder\ .master('local[*]') \ .getOrCreate() Tested on Ventura 13.0.1 (22A400) M2 chip.
Find elsewhere
🌐
Kevin Vecmanis
kevinvecmanis.io › python › pyspark › install › 2019 › 05 › 31 › Installing-Apache-Spark.html
Complete Guide to Installing PySpark on MacOS | Kevin Vecmanis
May 31, 2019 - Install this by running pip install py4j. Now you’ll be able to succesfully import pyspark in the Python3 shell! To run PySpark in Jupyter Notebook, open Jupyter Notebook from the terminal.
🌐
Insidelearningmachines
insidelearningmachines.com › home › how to install pyspark on macbook pro m3
How to Install Pyspark on MacBook Pro M3
May 1, 2024 - In this post, I’ll cover step-by-step how to install Pyspark on a MacBook Pro M3 computer.
🌐
Stack Overflow
stackoverflow.com › questions › 73684427 › how-to-install-and-use-pyspark-on-mac
installation - How to install and use pyspark on mac - Stack Overflow
Here are the environment variable changes I did to get pyspark working on my Mac: export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.6.jdk/Contents/Home/ export SPARK_HOME=/opt/spark-3.3.0-bin-hadoop3 export PATH=$JAVA_HOME/bin:$SPARK_HOME:$SPARK_HOME/bin:$SPARK_HOME/sbin:$PATH export PYSPARK_PYTHON=python3 export PYSPARK_DRIVER_PYTHON='jupyter' export PYSPARK_DRIVER_PYTHON_OPTS='notebook --no-browser --port=8889' Also ensure that, you've Java SE 8+ and Python 3.5+ installed.
🌐
Maelfabien
maelfabien.github.io › bigdata › SparkInstall
How to install (py)Spark on MacOS (late 2020) -
November 19, 2020 - Adapt the commands to match your Python path (using which python3) and the folder in which Java has been installed: export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home export JRE_HOME=/Library/java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/ export SPARK_HOME=/usr/local/Cellar/apache-spark/3.0.1/libexec export PATH=/usr/local/Cellar/apache-spark/3.0.1/bin:$PATH export PYSPARK_PYTHON=/Users/maelfabien/opt/anaconda3/bin/python
🌐
Stack Overflow
stackoverflow.com › questions › 79427039 › installing-pyspark-on-mac-with-pipenv
python - Installing PySpark on Mac with pipenv - Stack Overflow
Install all dependencies using pipenv install -e ., here pyspark version 3.3.0 is included. ... I use VS code, when I run all tests they pass as expected. However, when I then run pyspark in the terminal in the activated shell environment, I get an error:
🌐
Java-success
java-success.com › home › 01: installing & getting started with pyspark on mac tutorial
01: Installing & getting started with Pyspark on Mac tutorial | Big Data & Java Success
June 21, 2024 - This post shows how to get pyspark installed using the installer for Mac known as the homebrew. Homebrew is a package manager for MacOS (and Linux). It can be used to install, update, and manage various applications and tools on Macs.
🌐
Reddit
reddit.com › r/apachespark › installing pyspark on my m1 mac, getting an env error
r/apachespark on Reddit: installing pyspark on my m1 mac, getting an env error
June 4, 2022 -

I wanted to learn spark on both scala and Python. I had python3 already so started off with Scala installation first

brew install coursier/formulas/coursier && cs setup

this installed a bunch of stuff scala, scala cli etc etc

Then I ran

brew install apache-spark

which installed a whole bunch of stuff as well. The apache-spark docs said pypark comes along with it, and you can run it by just running "pyspark" which I did, and a got a python like REPL

whenever I imported it in the Jupyter notebook however, it didn't work, so I had to do a pip3 install

then I ran

from pyspark import SparkContext
sc = SparkContext()
n = sc.parallelize([4,10,9,7])
n.take(3)

I got this as an error

 raise RuntimeError(("Python in worker has different version %s than that in " +
RuntimeError: Python in worker has different version 3.8 than that in driver 3.7, PySpark cannot run with different minor versions. Please check environment variables PYSPARK_PYTHON and PYSPARK_DRIVER_PYTHON are correctly set.

I got the path using "which python3" and tried setting the above two paths in zshrc and z_profile to no effect. I'm a bit of a noob with this stuff and now I'm lost.

Can someone help me out here? TIA!

🌐
Medium
medium.com › swlh › pyspark-on-macos-installation-and-use-31f84ca61400
PySpark on macOS: installation and use | by René-Jean Corneille | The Startup | Medium
October 22, 2019 - PySpark on macOS: installation and use Spark is a very popular framework for data processing. It has slowly taken over the use of Hadoop for data analytics. In memory processing can yield up to 100x …
🌐
Francoposa
francoposa.io › resources › dev-setup › spark-pyspark-setup-macos
Spark and PySpark Setup for MacOS | francoposa.io
Including the version number in the install location allows us to maintain multiple Spark versions if desired. [~/Downloads]% mv spark-3.0.1-bin-hadoop2.7 /usr/local/spark-3.0.1 # May require sudo · Symlink the versioned directory to a more convenient unversioned path. % ln -s /usr/local/spark-3.0.1 /usr/local/spark # May require sudo · % export PATH=$PATH:/usr/local/spark/bin % which pyspark /usr/local/spark/bin/pyspark % which spark-shell /usr/local/spark/bin/spark-shell
🌐
Luminis
luminis.eu › home › blog › how to install pyspark and apache spark on macos
How to Install PySpark and Apache Spark on MacOS - Luminis
December 11, 2018 - To do so, please go to your terminal and type: brew install apache-spark Homebrew will now download and install Apache Spark, it may take some time depending on your internet connection.
🌐
DEV Community
dev.to › ruthvikraja_mv › how-to-install-apache-pyspark-on-mac-using-python-4mhk
How to install Apache PySpark on Mac using Python? - DEV Community
February 8, 2022 - Now, its time to check the installed Java version on your Mac, enter the following command in the terminal to check the version: ... Launch Anaconda Navigator (or) any other IDE to run python code for installing Apache PySpark on your Machine.
🌐
DEV Community
dev.to › shittu_olumide_ › how-to-install-pyspark-on-your-local-machine-nn4
How to Install PySpark on Your Local Machine - DEV Community
December 9, 2024 - PySpark, the Python API for Apache Spark, is a game-changer for data analysis and processing. While its potential is immense, setting it up on your local machine can feel challenging. This article breaks down the process step-by-step, covering everything from installing Java and downloading Spark to testing your setup with a simple script.