FYI: UE4 switching to Python 3.7.7 by default (4.26)

Hey all,

Just an FYI that as of UE 4.26, we will be switching to using Python 3.7.7 by default in the UE4 editor. This change should hopefully happen by preview 3.

If you need to continue to use Python 2.7.14, then you’ll have to use a source build of UE4 and either:

  • Edit PythonScriptPlugin.Build.cs and PythonScriptPluginPreload.Build.cs to use “Python” rather than “Python3” in their dependency lists.
  • Set your UE_PYTHON_DIR environment variable to point to a custom Python installation.

If you are using a source build of preview 2 and would like to try this early (for Windows or Mac), then you can edit PythonScriptPlugin.Build.cs and PythonScriptPluginPreload.Build.cs to use “Python3” rather than “Python” in their dependency lists. Please note that this will prevent you from using USD until we submit the updated version for Python 3.

Thanks,
Jamie.

2 Likes

That is fantastic news, thanks Jamie!

Jamie, For ue4.26’s python3.7 install, i did a pip install for openimageio wheel i found at
https://www.lfd.uci.edu/~gohlke/pythonlibs/#openimageio

It works if i launch python itself from the terminal, but once i am in the editor i get a dll error. Do you have any ideas what might be causing this?

From terminal


C:\Program Files\Epic Games\UE_4.26\Engine\Binaries\ThirdParty\Python3\Win64>python
Python 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from OpenImageIO import ImageBuf
>>> print(dir(ImageBuf))
'__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'copy_metadata', 'copy_pixels', 'deep', 'deep_erase_samples', 'deep_insert_samples', 'deep_samples', 'deep_value', 'deep_value_uint', 'deepdata', 'file_format_name', 'get_pixels', 'getchannel', 'geterror', 'getpixel', 'has_error', 'init_spec', 'initialized', 'interppixel', 'interppixel_NDC', 'interppixel_NDC_full', 'interppixel_bicubic', 'interppixel_bicubic_NDC', 'make_writable', 'make_writeable', 'miplevel', 'name', 'nativespec', 'nchannels', 'nmiplevels', 'nsubimages', 'orientation', 'oriented_full_height', 'oriented_full_width', 'oriented_full_x', 'oriented_full_y', 'oriented_height', 'oriented_width', 'oriented_x', 'oriented_y', 'pixelindex', 'pixels_valid', 'pixeltype', 'read', 'reset', 'roi', 'roi_full', 'set_deep_samples', 'set_deep_value', 'set_deep_value_uint', 'set_full', 'set_origin', 'set_pixels', 'set_write_format', 'set_write_tiles', 'setpixel', 'spec', 'specmod', 'subimage', 'swap', 'write', 'xbegin', 'xend', 'xmax', 'xmin', 'ybegin', 'yend', 'ymax', 'ymin', 'zbegin', 'zend', 'zmax', 'zmin']

From Editor


LogPython: from OpenImageIO import ImageBuf
LogPython: Error: Traceback (most recent call last):
LogPython: Error: File "<string>", line 1, in <module>
LogPython: Error: ImportError: DLL load failed: The specified procedure could not be found.

Generally an error like that would mean that either the DLL can’t be loaded (eg, compiled against the wrong version of CPython), or that the DLL can’t be found (eg, not on a known DLL path).

Given that it loads in the interpreter itself, I’d guess the latter. Where did it install the .dll/.pyd files to?

pip installed the dll/pyd files to “…Python3\Win64\Lib\site-packages” loosely (no sub-dirs…except for the wheel dist-info directory ).
OpenColorIO.dll
OpenImageIO.dll
OpenImageIO.pyd

Sounds like I might have to compile the openimageio from source… Do i need to use the ue4 from source as well? Is the included python3.7 a custom build?
Thank you Jamie

I find also copy shiboken2