PIP for Blender

I made a tool to manage Python packages inside Blender. It’s really bare bones currently. Let me know if you think this is a good idea. In Windows it’s best to open the terminal (Window > Toggle System Console) to see what’s happening when you press the buttons.

Release: https://github.com/amb/blender_pip/releases
Issues: https://github.com/amb/blender_pip/issues

11 Likes

There’s no feedback after clicking Ensure PIP so I’m not sure what that did.

Clicking on List produced the following error:

BTW, I should have a number of PIP installed modules on my pc as Sverchok uses them as dependencies for some of its Extra Nodes.

I made a new release (1.0.1). It should now print out the error message in the UI, as well as other messages generated by PIP.

I replicated your issue with simply using a non-existing module in the call, which means the addon can’t probably find PIP on your Blender installations Python. Also you can try turning “as local user” on/off if that has any effect.

Seems “ensurepip” only installs “pip3” module, not “pip”, I made changes to 1.0.2 that should use --default-pip which also installs “pip”.

1 Like

the addon tissue has a module about this. if it can help https://github.com/alessandro-zomparelli/tissue/blob/master/utils_pip.py

1 Like

I manually installed pyside2 but I couldn’t import it in Blender. but I will see this again later

New release 1.0.4 should now be also working in Linux, also some bugs fixed and PIP upgrade option added.

A much needed functionality in Blender. Thank you!

I did a pull request to make the lines a bit tighter:

Before:
image

After:
image

Maybe the ‘List’ could have options to update and remove installed modules?

3 Likes

Thanks for the PR, merged.

I was just wondering if after pressing LIST this output looks correct?

Did you try Ensure PIP, Upgrade PIP and Install something (like for example “cffi”) first? The thing is probably write protected, but should work with user flag (in theory).

1 Like

This is great! :smiley:
Exactly what I needed. I am currently writing an add-on that requires several additional python packages (wheel, PyMCubes, scipy, pillow). My current workaround was to manually install all these packages from the command line to the local python installation that ships with Blender.
For details see here (section “Installation of local python libraries”):

It seems your package just makes it possible to install everything without leaving Blender. Works like a charm for me. :+1:

1 Like

Turns out that I had to run Blender as Administrator.

Just reporting that this also works on the new Alpha release of Blender 2.92

this is nice to have . i also suggest backing up a python directory and linking/mounting to that directory, so you can keep installed modules and changes accross blender versions

@ambi This is an essential add-on and should be bundled in Blender. Any chance for that?

Unfortunately I can’t commit to supporting the add-on. If somebody else wants to do that, they have my blessing to fork the project and try to introduce it into the base Blender.

1 Like

you dont need to , pip is bundled with blender as of v2.9 i think or 3.0 … aside from that i suggest people just use the template function of blender to integrate additional python libraries

Setup new libraries require some care, as you may break blender’s one with dependency.
Eg: if you setup latest scipy version, you’ll find yourself with a new numpy version too …
So be careful with that.

Sharing modules across blender versions is not an option as there are python version changes in the between - blender 2.8x / 2.9x / 3.x do not rely on the same python version.

then just create a script with all your desired modules and run it directly from texteditor :

import subprocess
import sys
import os
 
# path to python.exe
python_exe = os.path.join(sys.prefix, 'bin', 'python.exe')
 

# install desired packages
subprocess.call([python_exe, "-m", "pip", "install", "opencv-python"])

i didnt have problems with the templates though, but you are right , there could be problems

There might be non-coder-users of add-ons needing to manually install additional modules or look up module version numbers etc.

Even though I code myself, Ambi’s tool is my go-to solution if something is messed up.