It seems that Blender now comes with pip bundled in it, but I haven’t figured out how to use pip to install packages from the command line because I looked the Blender folder inside and out and there is no pip.exe. There’s just some scripts inside the pip folder inside the Blender folder. Anyone know how to install packages using Blender’s pip (and not the one that’s with the Python distro outside of Blender)? Blender 3.2.0 Windows 10
1 Answer
In Windows 10, the python interpreter installs new packages not into the Blender installation directory, but into the personal user directory. As a result, packages are installed but are not available inside Blender – they cannot be accessed from the Python console or Blender Text Editor using the “import” command. We can solve the problem by hard-coding the directory where pip should install the required packages – the “site-packages” directory located inside the directory where Blender is installed.
Here's an example command line
"c:\Program Files\Blender Foundation\Blender 3.2\3.2\python\bin\python.exe" -m pip install --upgrade scipi -t "c:\Program Files\Blender Foundation\Blender 3.2\3.2\python\lib\site-packages"
It would install scipi
if scipi were available for Python 3.10, which it currently isn't. Replace scipi
in the command line with the name of the package you want to install.
-
$\begingroup$ Hi thank you for the answer. Before I try this, because I also use Python in VS Code, and have the regular Python setup outside of Blender - is this command going to permanently redirect pip’s package install location to the Blender folder? If so how do I change it back? $\endgroup$ Commented Jun 14, 2022 at 2:01
-
$\begingroup$ No. The redirect is caused by the -t argument. If you use pip without it then the default location is used. $\endgroup$ Commented Jun 14, 2022 at 13:10
-
$\begingroup$ I get permissions error WinError5 $\endgroup$ Commented Apr 28, 2023 at 15:09
-
$\begingroup$ It happens also if I am running Blender as Administrator $\endgroup$ Commented Apr 28, 2023 at 15:10