[Bf-python] Loading shared library in Blender Python

Sybren A. Stüvel sybren at stuvel.eu
Wed Jun 17 17:16:45 CEST 2015


On Wed, Jun 17, 2015 at 04:53:56PM +0200, Arnaud Degroote wrote:
> To be more precise, what we try is doing
> 
> import numpy
> 
> which fails with 
> 
> ImportError: cannot import name 'multiarray'
> 
> (whole discussion is here : https://github.com/morse-simulator/morse/pull/630)
> 
> It basically fails because python from Ubuntu is built with
> multiarch option and so the libraries have extension
> cpython-34m-x86_64-linux-gnu.so. It is not the case of the python
> embedded in binary blender.
> 
> Of course, it is always possible, in this case, to use the numpy
> copy from blender (but it is not a generic solution), or to hack the
> filesystem (but it is cumbersome for users).

Alternatively, you could recompile Blender yourself, it then works
with the platform Python. This is on my machine:

>>> import sip
>>> sip.__file__
'/usr/lib/python3/dist-packages/sip.cpython-34m-x86_64-linux-gnu.so'

However, that won't help your users if you want to distribute a binary
extension.

I don't know how much effort it would be to compile Blender with
multiarch-Python by default, and what kind of incompatibilities it
would give on other platforms/distributions. Maybe someone else can
comment on this?

-- 
Sybren A. Stüvel

http://stuvelfoto.nl/
http://stuvel.eu/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20150617/a5d847ee/attachment.sig>


More information about the Bf-python mailing list