Installing Python: Anaconda vs. Venv
Before You Start
You should know: - How to open your computerβs terminal (or PowerShell) and navigate using ls, pwd, and cd. - The essential difference between a computerβs operating system and the software installed on it.
You will learn: - The difference between Anaconda and pure Python (venv). - How to elect an installation pathway that fits your research style. - How to verify that Python actually exists and is accessible from your command line.
Introduction
Python is not a program you open by double-clicking an icon on your desktop. It is a language, and to use it, you must install a βtranslatorβ (the Python interpreter) on your computer. This interpreter reads the text files you write and executes them as instructions.
However, in scientific computing, installing βjust Pythonβ is rarely enough. You also need heavy numerical libraries like NumPy, SciPy, and GDAL. Because these libraries are complex, the community has developed two distinct philosophies for installing and managing Python.
Choosing the right ecosystem now will save you countless hours of troubleshooting later.
Path 1: The Anaconda Ecosystem (The Heavyweight)
Anaconda (and its smaller cousin Miniforge) is an all-in-one distribution built specifically for data science.
When you install Anaconda, you arenβt just installing Python. You are installing Python, a massive suite of pre-compiled scientific libraries, a package manager called conda, and several graphical interfaces (like Jupyter and Spyder).
Pros: - βIt just worksβ: Complex geospatial libraries (like GDAL or GeoPandas) are notoriously difficult to install because they rely on C++ and Fortran code. Anaconda handles this seamlessly. - Self-contained: It doesnβt interfere with your computerβs system-level setup. - Batteries included: You immediately have access to 90% of the libraries you need.
Cons: - Massive footprint: A full Anaconda installation can easily consume 4-5 GB of hard drive space. - Sluggish updates: The centralized conda resolver can be notoriously slow when searching for new packages.
How to Install (Anaconda)
We highly recommend installing Miniforge instead of the full Anaconda. Miniforge provides the powerful conda package manager without downloading gigabytes of libraries you may never use.
- Go to the Miniforge GitHub releases page.
- Download the installer for your operating system (Windows
.exe, macOS.shor.pkg, Linux.sh). - Run the installer. Important for Windows users: When prompted, do not check the box to βAdd Anaconda to my PATH environment variable,β but do check the box to βRegister Anaconda as my default Python 3.β
Path 2: Standard Python + venv (The Lightweight)
The alternative is to install βpureβ Python directly from the Python Software Foundation. This gives you a clean, lightweight installation. To manage your libraries, you use Pythonβs built-in venv (Virtual Environments) system alongside pip (the standard package installer).
Pros: - Featherweight: The installation is only a few megabytes. - Industry Standard: This is how software engineers and web developers construct Python architectures. - Fast: Standard pip installation is incredibly quick.
Cons: - Compilation headaches: If a geography package requires complex C++ bindings (like rasterio), standard pip may fail to install it unless your computer already has the right compilers installed. (Windows users suffer the most here).
How to Install (Standard Python)
Windows: Go to python.org/downloads and download the latest installer. Crucial Step: On the very first screen of the installer, check the box that says βAdd Python to PATHβ before clicking Install. If you forget this, your terminal will never find Python.
Mac: Macs come with a system version of Python, but you should not mess with it. The easiest way to install a modern, user-controlled Python on Mac is via Homebrew. Open your terminal and run: brew install python
Linux (Ubuntu/Debian): Open your terminal and run: sudo apt update sudo apt install python3 python3-pip python3-venv
Which path should you choose?
- Choose Miniforge/Anaconda if: You are on Windows, or you anticipate doing heavy geospatial work (analyzing satellite imagery, routing networks, working with Shapefiles). The
condapackage manager is specifically designed to solve the installation nightmares of spatial libraries. - Choose Standard Python + venv if: You are on a Mac/Linux, you prefer a minimalist, fast system, or your work leans closer to standard software engineering and API development than heavy geoprocessing.
Verify Your Work
You must confirm that your computerβs terminal recognizes the Python installation.
- Close your terminal entirely. (This is a hard requirementβterminals load paths at startup. Reopen it to refresh its memory).
- Type the following command:
python --version(Note for Mac/Linux users on standard installs: you might need to type python3 --version instead).
If everything worked, the terminal will print a version number (e.g., Python 3.11.4).
If it says command not found or triggers the Windows Store: Your computer does not know where you installed Python. If you are on Windows, reinstall Python and ensure you checked the βAdd to PATHβ box.
Do not proceed to the next chapter until your terminal can successfully print your Python version!