This is a Blender Add-on which enables support for using pip (the standard Python Package Manager) from within Blender.
Blender utilizes a bundled Python implementation, which does not include pip. Because of this, it is actually quite difficult to install third-party libraries and packages into the Blender Python Implementation.
This issue makes developing Blender Add-ons far more difficult, because developers cannot use tried-and-true 3rd party libraries, and are forced to write the same code over and over for each add-on that needs it.
Pip4Blender makes this just as easy as installing normal add-ons, and supports a developer-centric workflow designed to make building and distributing add-ons with dependencies as simple as possible.
PyAesel is licensed under the MIT license. For further details, please refer to the LICENSE file.
If you believe that you have found a bug in Pip4Blender, or have an enhancement request, we encourage you to raise an issue on our github page.
Pip4Blender is installed exactly like any other Blender add-on, and is distributed as a single Python file. The latest release can be downloaded from https://github.com/AO-StreetArt/pip4blender/releases.
Note
Users with Blender 2.80 should download the pip4blender.py file from the blender-2.80 branch. A new release compatible with Blender 2.80 will be created when the new version of Blender is officially released.
From the User Preferences panel, select ‘Install Addon from File’, and select the pip4blender.py file.
Installing Pip in the Blender environment is also required before the rest of the functionality of the add-on is accessed. This can be done by selecting the ‘Install Pip in Blender’ button, but only needs to be done once for any given Blender installation.
This might take a few minutes to run, if you want to watch the installation progress you should run Blender from a terminal.
Now that the add-on is installed, we can use it to install any Python package available over pip.
Installing a single package is done by specifying the package name, then using the ‘Install Python Library’ button:
For example, if we type ‘requests’ into the text box shown above, then hit the button, we would install the Requests module into Blender’s Python installation with pip.
If you have been provided with a requirements.txt file, often along with an add-on you wish to install, you can hit the ‘Install Requirements File’ button, and select the file in the browser that opens up:
This will install all dependent packages specified in the requirements file to your Blender installation.
Developers creating new Add-ons will benefit the most from pip4blender. During initial development, developers can install libraries as needed, one-by-one. This reduces the overall cost of development by promoting use of solid, well-tested, third-party libraries instead of the same code re-written over and over again.
Upgrading a library can be accomplished by pre-pending ‘–upgrade’ to the name of the library. For example, to upgrade the requests library, we would enter ‘–upgrade requests’ into the ‘Package Name’ text field, then hit ‘Install Python Library’.
Be warned: DO NOT upgrade a package that came with Blender by default.
Once an add-on is complete (enough) to release to the public, a requirements.txt file can be generated, which specifies the name and version of all dependent packages. This file can then be packaged along with an add-on, and distributed.
Users who have pip4blender installed can hit the ‘Install Requirements File’ button, which will open a file browser to select the requirements file supplied by the developer.
There are several known limitations to consider when using pip4blender.
Pip4Blender should not be used to update libraries that came bundled with Blender. This has the potential to permanently damage your Blender installation.
C Modules which include the ‘Python.h’ header will fail. The bundled Python installation does not include the source files for Python, making this rather difficult. Support for this is not planned at this time.