Installing Python in User Space with Miniconda on macOS Tahoe
Miniconda is a minimal installer for Conda, a package, dependency, and environment manager for any languageβPython, R, and more. It is a great solution for installing Python in your user space (i.e., without needing administrator privileges) and managing different project environments.
Why Use Miniconda?
- User-Specific Installation: Installs Python and related packages in your home directory, avoiding the need for
sudo. - Environment Management: Create isolated environments for different projects, preventing dependency conflicts.
- Package Management: Easily install, update, and remove packages using the
condacommand.
Installation Steps
-
Download Miniconda:
- Go to https://docs.conda.io/en/latest/miniconda.html and download the macOS installer for your architecture (either
arm64for Apple Silicon orx86_64for Intel).
- Go to https://docs.conda.io/en/latest/miniconda.html and download the macOS installer for your architecture (either
-
Run the Installer:
- Double-click the downloaded
.pkgfile and follow the on-screen instructions. - Accept the license agreement.
- Choose the "Install for me only" option. This installs Miniconda in your home directory (e.g.,
/Users/yourname/miniconda3).
- Double-click the downloaded
-
Initialize Conda for Zsh:
- After installation, the installer will likely prompt you to initialize Conda. If not, open your terminal and run:
conda init zsh- This modifies your
.zshrcfile to include Conda's settings.
-
Restart Your Terminal:
- Close and reopen your terminal window for the changes to take effect.
- You should see
(base)at the beginning of your terminal prompt, indicating that thebaseConda environment is active.
Basic Conda Usage
Creating an Environment
To create a new, isolated environment for a project:
conda create --name myenv python=3.9
myenv: The name of your new environment.python=3.9: Specifies the Python version.
Activating an Environment
To use the environment, activate it:
conda activate myenv
Your terminal prompt will change to (myenv).
Installing Packages
With your environment activated, install packages using conda install:
conda install numpy pandas
Deactivating an Environment
To return to the base environment:
conda deactivate
Related Guides
- Configuring the Zsh Profile and PATH on macOS Tahoe
- Python Virtual Environments (venv)
- Pip (Installing packages without sudo)