Introduction to pip
The Python package manager pip is used to install Python libraries, such as numpy. It downloads packages from the Python Package Index (PyPI), the official repository for Python libraries. When you run a pip command, it retrieves the specified package from PyPI and installs it into your Python environment.
Installing pip in Blender's Python
First, make sure your System Console is open by selecting Window > Toggle System Console from the menu. This will allow you to view the installation progress.

Open the Scripting Tab in Blender and run the following script. It retrieves the path to your current Python executable (python_exe) and installs the ensurepip module, which sets up pip in your Python environment. This can take a while, so check your System Console to see the progress.
import subprocess import sys python_exe = str(sys.executable) subprocess.call([python_exe, '-m', 'ensurepip']) subprocess.call([python_exe, '-m', 'pip', 'install', '--upgrade', 'pip'])
Installing Python Packages in Blender's Python
Once pip is installed, you can run the following script to install any Python package. In this example, we install the scipy library. Replace scipy with any other package you wish to install.
import subprocess import sys python_exe = str(sys.executable) subprocess.call([python_exe, '-m', 'pip', 'install', '--upgrade', 'scipy'])

Forcing Package Installation in Blender's Python
Sometimes, Blender's lib and site-packages folders are not writable due to system permissions. On Windows, these folders might look like:
C:\Program Files\Blender Foundation\Blender 5.0\5.0\python\lib C:\Program Files\Blender Foundation\Blender 5.0\5.0\python\lib\site-packages
In such cases, pip may install packages to a different location, such as a user-specific directory (e.g., AppData on Windows). Blender might not recognize modules installed this way, which can cause import errors or other issues. To resolve this, run a Command Prompt as Administrator and use Blender's Python executable directly. You can find the path to Blender's Python executable using print(sys.executable), which will output a path like this:
C:\Program Files\Blender Foundation\Blender 5.0\5.0\python\bin\python.exe
You can then use this path in the Administrator Command Prompt to install packages directly into Blender's Python environment. Run it with the following arguments and options, replacing <package-name> with the library you want to install (e.g., scipy):
-m pip install --ignore-installed --upgrade --force-reinstall <package-name>
To install a package (e.g., scipy) directly into Blender's bundled Python, make sure to close all Blender windows, then run the following command. This ensures the package is installed into Blender's Python environment rather than a user-specific site directory:
"C:\Program Files\Blender Foundation\Blender 5.0\5.0\python\bin\python.exe" -m pip install --ignore-installed --upgrade --force-reinstall scipy
