building Blender 2.79 as a python module on Windows 10 x64 - no bpy.dll found

I’ve compiled Blender as a python module according to the directions here:

I’m using Visual Studio 2017 Community Edition.

I’ve found that in the bin folder, I have the expected bpy.pyd file, but no DLL files.

When I attempt to use bpy in my ide (pycharm) I get the following error after trying “import bpy”:

Traceback (most recent call last):
File “<input>”, line 1, in <module>
File “E:\Applications\JetBrains\PyCharm Community Edition 2017.2.1\helpers\pydev_pydev_bundle\”, line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: DLL load failed: The specified module could not be found.

I suspect that it’s looking for the DLL, as the original instructions from the link indicate it’s supposed to be copied as well.

Is this a known issue with building Blender 2.79 as a Python module?

How do I fix it?



if you are using a debug build, try renaming the module bpy.pyd to bpy_d.pyd. No need to change the “import bpy”

I’m definitely doing a release build. So is the DLL no longer necessary? Only the pyd file?



The pyd file is a dll. The dll that the error refers to is the module itself. This error is common when using python debug without the “_d” in the module name.

If that is not the case, I do not know what may be happening :\

OK so I have sorted this out. I’ll explain how to get it working for posterity, in case anyone else tries to solve this.

I suspect that when the original directions were written, there was more stuff in the bin folder than there is now. When you build Blender as a pymodule, at least as of 2.79, there are no DLLs in the bin folder. Only the bpy.pyd file (and some other stuff which doesn’t help).

So you need to scavenge your regular Blender install for the missing DLL files that the original instructions refer to.

In summary:

  • compile Blender as a pymodule per the original directions provided at the following link:

  • copy the bpy.pyd file to site-packages in your Python install

copy bin\bpy.pyd C:\Python35\Lib\site-packages\

  • assuming you have a regular Blender install of the same version and bitness (x32, x64) that you built, copy the following DLLs to the site packages directory above as well:


  • Note this is where I went off the rails. I thought they’d be in my build, but I didn’t find them there, I had to scavenge them from my binary install.

** Also note, do not copy over the python35.dll file, or if you do, delete it afterwards as the original instructions direct.

  • Also in your Blender binary installation, find the folder 2.XX (in my case, 2.79), and copy the whole folder into your Python install directory (as above, copy it into C:\Python35).

After performing the above steps, I was able to get content-assist in Pycharm for the bpy module.

Also, as a note, I’ve found that the bpy.pyd file exports multiple python modules. For example, I know it exports a module called mathutils. It may have others that I haven’t poked into yet. To get IDE completion support for these other modules, you’ll need to go into your site-packages directory using the command line and create a symbolic link sort of like below for mathutils:

mklink mathutils.pyd bpy.pyd

Once you do that, the mathutils module can also be parsed from your IDE. I tested this using Pycharm 2017.2.1, and I was able to access stuff inside mathutils.

Please note that it MUST be a symbolic link. A shortcut like most folks are used to creating with GUI won’t work. They are different things.



1 Like

can you provide instructions on setting up the environment for blender excecution from python in linux.

Can you share the bpy.pyd file please?