[Bf-python] Fwd: Blender Python PIP

Campbell Barton ideasman42 at gmail.com
Wed Jan 27 02:47:19 CET 2016


Hi All.

Tom Newport mailed me personally on this topic,
but I think this may be interesting to wider Python/Blender dev community,
so forwarding a mail to bf-python list.


---------- Forwarded message ----------
From: Campbell Barton <ideasman42 at gmail.com>
Date: Tue, Dec 22, 2015 at 2:46 PM
Subject: Re: Blender Python PIP
To: Tom Newport <tom.newport at bioch.ox.ac.uk>

On Fri, Dec 4, 2015 at 11:06 PM, Tom Newport <tom.newport at bioch.ox.ac.uk> wrote:
> Hi Campbell,
>
> tl;dr - Could pip be included in the blender python environment? It would
> make building blender addons with dependencies easier.
>
> I'm currently building an addon for Blender to display molecular simulation
> data. The bulk of the file I/O and calculation work can already be handled
> by a great python package called mdtraj, but it's proving rather difficult
> to include in the addon in a cross-platform or portable way. I'm sure I'm
> not the only wannabe addon developer in this position.
>
> Currently I use rpyc to access an object running in a python server on
> localhost - the user can then install mdtraj in the system python
> environment using pip. This is sub-optimal since it takes a while for data
> to be transferred and rather defeats the point of blender's great python
> support.
>
> It would be great to be able to use pip to install missing packages when
> registering an add-on - is this something that could be practically done? Do
> you have any advice for including dependencies in addons?
>
> All the best,
>
> Tom



Hi Tom, there are a few issues here.

Assuming pip is included, the issue becomes integration - simply
having pip is not enough, since pip may require user input:
either we have to run the process in a new terminal, or hook into pip
to replace requests to user-input with some GUI equivalent.

Once this is done users will want a way to run pip update/uninstall
etc... how to handle Blender upgrades, when Blender uses a new Python
how to check the old installation and match the packages previously
installed.

This leads to the question - where does pip fit in Blender... is it
for developers or a small set of tools that require it? or is it
something we're prepared to support more widely - where non-python
developers who never heard of pip can expect to have a good user
experience and Python packages will be managed automatically.

My concern is we would deliver something which in practice is only
handy for Python developers, but would end up becoming annoying for
users - Say they try install an add-on which depends on a C extension
and they don't have a build environment.

Another detail - is we're not ABI compatible with the official Python
on ms-windows (so C extensions need to be built especially for
Blender). We don't have a choice here unless we want to be tied to the
compiler version Python uses for all of Blender.

----

On the other hand - including 3rd party modules with add-ons is a
hassle at the moment, but most likely for user convenience we would
want to use binary packages.

I asked about this a while ago:
http://stackoverflow.com/questions/33817017/reusable-package-manager-for-graphical-python-applications

A lot of this comes down to support and making sure non technical
users don't have to learn a lot to do typical operations
(install/uninstall/upgrade).
however I don't think making users run pip really makes things 'easy'
unless those users are also Python developers who already know how to
run pip.

-- 
- Campbell



More information about the Bf-python mailing list