adding 3rd party modules

Being a tad impatient I’m toying with the idea of writing an “alembic reader”.
The official python bindings haven’t been released yet (, so I’m planning to hack it with the h5py module ( Hdf5 is the backbone of alembic and I’ve had success writing a custom cache format for Maya => Houdini using this before alembic came out.

My question…
Is it at all possible to import modules outside of blender’s python?
I’ve tried compiling python 3.2, numpy and h5py and adding it to sys.path with no success. I get:

>>> import h5py
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "/usr/local/python3.2/lib/python3.2/site-packages/h5py/", line 1, in <module>
    from h5py import _errors
ImportError: cannot import name _errors

The above error doesn’t appear in the compiled python3.2 shell.
I’ve tried copying the modules into blenders site-packages with the same result.

Does anyone have any experience with adding a 3rd party module?
Is it possible to run the blender python outside of blender?

Any hints, tips, pointers or solutions are greatly appreciated.


Hey dogwynn!

Thanks for the pointer! I compiled python again with wide unicode:

./configure --prefix=/usr/local/python3.2 --enable-shared --with-wide-unicode

I then recompiled nump and h5py against the new python.
In blender I did the following with success:

import sys
import h5py

Thanks again!

My pleasure, and best of luck to you.

I guess ABI tagging is a good thing in the long run, but I must say, this is quite a low-level issue to force individual users to resolve. Feels extremely un-Pythonic, IMO. It’s supposed to make things easier on Ubuntu, but frankly, having to recompile either Python or Blender (and 3rd-party mods) to make things work correctly is not easier. :-/


Hi, I think I have the same error. I got a 3rd party module which I got running at my own python environment (c:\python32) but if I want it use in my Blender 2.59 bounded python he founds the module but can not open it because it tells me it does not find the dynamic library.

You said you compiled blender from source using your system python. Please can you tell me how this step should be executed or do you have a link to a documentation?
Where do i get a blender version which I can build myself ?

Thank you very much!
I hope it is no problem if i hijack this thread because it it solved.

EDIT: found this trunk:
hope it is the right one


Hey BlenderFish!

I’m not sure if the question was intended for me, but in my case I didn’t compile blender. I compiled python. To make it work I had to use this flag:


See post above for the other settings.

If the question was not intended for me, I guess what you need to do is the exact opposite and compile the blender python without wide unicode to make it match your os modules

Good luck

where are you typing this?

.comfigure --prefix=/usr/local/python3.2 --enable-shared --with-wide-unicode

I’ve downloaded the source, opened up the solution file in /PCBuild folder as per these instructions (see section 3.5)

…now I want to set the unicode so I can build it wide :slight_smile: I get the concept, I’m lost in the minutia.

Sorry for the tardy reply.

I compiled Python on my Ubuntu, so I’m afraid I can’t be of much help on windows compiling.

I noticed that you had a typo in the “./configure” above. I assume that’s not your problem, but just in case here’s a small intro:
The “./configure” means that you want to use the file called configure in the current (.) directory (/). Omitting the “/” means that you want to access a hidden file called configure which in this case probably doesn’t exist.

If I’m not mistaken cygwin is a “UNIX” like environment so I guess the same rules apply.

Also, I’m afraid that “/usr/local” doesn’t exist on your machine. Try replacing the path with some other place. If I remember correctly cygwin calls the system drives “/cygrdive/[DRIVERLETTER]”, so try soemthing like “/cygdrive/c/Program\ Files/myPython3.2”

Then to answer the big question. To get the wide unicode just use the “–with-wide-unicode” flag as mentioned above.

Hope this gets you further,

ahhh, so linux vs windows and cgwin vs MSVC. That at least explains why I was totally lost. Thanks for your answer!

No problem!
Good luck!