SYMPTOMS
While attempting to launch Nuke on a Windows machine, some users experience a consistent crash and an error message similar to the following appears in the Command Prompt:
ImportError: DLL load failed while importing _ctypes: The specified module could not be found.
This article will provide the steps that should be taken to prevent this error, and background as to why it occurs.
CAUSE
We are currently aware of the following programs which can cause the DLL load failed while importing _ctypes error and prevent Nuke 16 from launching. However, please note that this is a non-exhaustive list, and the problem could also be produced by other applications:
This issue is a result of additional “application paths” being added to the Windows Registry that conflict with Nuke’s version of Python. Although this problem has only been reported when launching Nuke 16 so far, the same issue could affect other versions of Nuke.
When a third-party application that uses Python is installed, it may add its own directories to the Python module search path (sys.path) via the Windows Registry. If the application’s version of Python is the same version Nuke uses, these additional “application paths” can prevent Nuke from accessing and importing the Python modules it needs to run.
As an example, Spyder 6 uses Python 3.11, which is the same release of Python Nuke 16 utilizes. Because Spyder 6 creates Registry entries pointing toward its “application paths”, when Nuke launches it will search those locations for specific modules and fail to open when they cannot be found.
For additional details regarding Windows Registry entries and Python, please see the Further Reading section.
RESOLUTION
The available options to resolve this issue depend on which program(s) are causing the problem. As such, the first step is to verify what specific program is conflicting with Nuke’s Python version.
In order to do so, please follow the process outlined below to launch Nuke 16's Python executable and print the current module search paths:
- Open a Command Prompt window and run the following command:
"C:\Program Files\Nuke16.0v1\python.exe"
- Run the following two lines, pressing the Enter key twice to fully execute the code:
import sys
for p in sys.path: print(p)
- At this point you should see that the search paths utilized by Nuke are printed out:
For comparison, here is the same output with Spyder 6 installed:
Note: These additional highlighted paths should not be manually deleted or edited, and you should instead use one of the options below to resolve the issue.
Once you have identified the program(s) responsible, select one of the following solutions that best fits your needs:
A) Uninstall the application
If you have a problematic application installed but no longer need it, simply uninstall the program and Nuke will be able to launch successfully.
B) Uninstall the application and upgrade to a newer version
If you still need to use the program, removing the existing version and updating to a more recent release which doesn't conflict with Nuke's Python could resolve the issue.
For instance, the latest Anaconda3 release uses Python 3.12, and installing it does not impact Nuke 16's ability to launch.
C) Reinstall the application without defining its “application paths”
If you still need to use the program without upgrading its version, some applications like Anaconda3 and MiniConda3 have an option during installation to disable the “application paths” that prevent Nuke from launching.
For Anaconda3 and MiniConda3, this option is called “Register {program} as my default Python 3.11”, and should be disabled in order for Nuke to launch correctly.
The basic steps for reinstalling Anaconda without defining it as the default for Python 3.11 can be found below, but please note that the specific setting name may vary between applications, and not all programs will have this option:
i) Uninstall the application from your machine
ii) Begin reinstalling the program
iii) When prompted, disable the "Register {program} as my default Python 3.11" option box:
D) Manually modify the Windows Registry
If you need to continue using a program but it does not have an option to prevent “application paths” from being added to the Windows Registry, it is possible to adjust the Registry to remove these paths.
WARNING: Any incorrect changes made in the Windows Registry could adversely affect your machine, so this should be done with caution and a backup should always be created before editing the Windows Registry. Foundry is not liable for any changes made to your machine, and any such changes may prevent other applications from working correctly.
If you feel comfortable altering your computer's settings via the Windows Registry and would like to proceed, please do the following actions as an Administrator:
i) Open the Registry Editor and navigate to: Computer\HKEY_CURRENT_USER\Software\Python\PythonCoreii) Expand the 3.11 sub-folder, and select the PythonPath folder:
iii) Right-click this folder, select the Rename option, and set the name to "PythonPath_Disabled" (or similar):
iv) The DLL load failed error should no longer appear when launching Nuke 16. If this is not the case, you may need to repeat this process in the Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore location as well.
FURTHER READING
For more information regarding how Registry entries can can change the Python sys.path, please visit the Python documentation here:
https://docs.python.org/3/using/windows.html#finding-modules
If you are still experiencing difficulties after removing conflicting Python “application paths”, please create a support ticket to let us know the exact issue encountered and the troubleshooting steps that have been taken.
For more information on how to open a support request, please refer to this article:
Q100064: How to raise a support ticket
We're sorry to hear that
Please tell us why