I am the maintainer of a blender as a python module 'bpy' on pip and github.


I am able to build blender pretty successfully. I have wheels for multiple python versions created. This allows extension authors to install the module bpy into a venv for unit testing of their extension, without comprimising their Blender environment.

Currently though, it only works in Python 3.6 (the current version of Python that Blender supports).

I would argue that it could be useful for such extension authors to test their extensions against upcoming versions of Python as they come out.

Would it be possible to link blender against the new python37.dll?

Currently what I am doing is I install bpy into the python 3.7 venv:

pip install bpy

Then, I start a new Python session and attempt to import the package:

import bpy

ImportError: DLL load failed: The specified module could not be found

Then, after copying and pasting python37.dll and renaming the copy to python36.dll, my fears were confirmed, it is trying to use python36.dll:

import bpy

ImportError: Module use of python36.dll conflicts with this version of Python

Is there a way to, intuitively, tell blender when its building to target a certain version of Python?


The build scripts can be found in ./vscode/tasks/build_all.bat


Here is an image of the PYTHON variables from CMAKE; I don't see PYTHON_LIBRARY, though

Python Variables from CMAKE

Here is a picture with the grouped variables:

Grouped vars

  • $\begingroup$ Did you try compiling blender itself against your desired version of Python? You can't just rename DLL's, that almost never works, and in fact here its actively detecting and stopping that. $\endgroup$ – Fire Lancer Aug 9 '18 at 16:11
  • $\begingroup$ Correct, I compiled Blender from sources using Python 3.7 in cmake. The intended goal of copying and renaming the DLL was not to attempt to resolve the issue, it was merely to track down the source of the ImportError: DLL load failed: The specified module could not be found error. Thanks for your time $\endgroup$ – user57267 Aug 9 '18 at 16:14
  • $\begingroup$ And you did use your new version of bpy and any other Python modules also built with 3.7? I trust cmake to not do anything strange here, so if built with 3.7 there should not be any 3.6 references at all. $\endgroup$ – Fire Lancer Aug 9 '18 at 16:17
  • 1
    $\begingroup$ Leaning a little off-topic as its about building blender. Post a screenshot of your cmake PYTHON vars (from cmake-gui or similar). $\endgroup$ – batFINGER Aug 9 '18 at 16:24
  • 3
    $\begingroup$ I'm voting to close this question as off-topic because this is about building Blender, which is off-topic. See: blender.meta.stackexchange.com/questions/399/… $\endgroup$ – Ray Mairlot Aug 9 '18 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy