SOLVED: DLL Load Failed - QtCore
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
SOLVED: DLL Load Failed - QtCore
Hello,
I have exhausted all avenues in trying to solve this error. I have seen it has occurred for many people online and having tried all their 'fixes' I am now posting here to see if anyone can offer anything new.
I am trying to interface with FreeCAD 0.18 using Python in Visual Studio via Anaconda 3, python version 3.6.10
The error arises when calling 'from PySide2.QtCore import *' through FreeCAD's QtCore.py file. It reads DLL load failed: The specified procedure could not be found.
In my attempts to solves this I have:
1. checked PySide2 and shiboken2 are the same version - they are 5.15
2. Added Anaconda as PATH variable
3. uninstalled and reinstalled python environments
4. conda installed PySide2 and pip installed PySide2
Firstly, what does this mean exactly? And what can I do to fix it?
I am new to FreeCAD and its API so any help/advice is greatly appreciated.
I have exhausted all avenues in trying to solve this error. I have seen it has occurred for many people online and having tried all their 'fixes' I am now posting here to see if anyone can offer anything new.
I am trying to interface with FreeCAD 0.18 using Python in Visual Studio via Anaconda 3, python version 3.6.10
The error arises when calling 'from PySide2.QtCore import *' through FreeCAD's QtCore.py file. It reads DLL load failed: The specified procedure could not be found.
In my attempts to solves this I have:
1. checked PySide2 and shiboken2 are the same version - they are 5.15
2. Added Anaconda as PATH variable
3. uninstalled and reinstalled python environments
4. conda installed PySide2 and pip installed PySide2
Firstly, what does this mean exactly? And what can I do to fix it?
I am new to FreeCAD and its API so any help/advice is greatly appreciated.
Last edited by Friel20 on Fri Oct 02, 2020 11:25 am, edited 2 times in total.
Re: DLL Load Failed - QtCore
Does your FreeCAD 0.18 version also use Python 3.6?I am trying to interface with FreeCAD 0.18 using Python in Visual Studio via Anaconda 3, python version 3.6.10
Since you have Visual Studio installed you should try to run FreeCAD in the debugger. Then in Visual Studio activate the Output window and clear its content.The error arises when calling 'from PySide2.QtCore import *' through FreeCAD's QtCore.py file. It reads DLL load failed: The specified procedure could not be found.
Enter from PySide2.QtCore import * into FreeCAD's Python console. Now check the content of the Output window of Visual Studio. It should print which dlls are tried to be loaded and from which location.
This error usually means that a dll of the requested name was found but it's binary incompatible.DLL load failed: The specified procedure could not be found.
The FreeCAD installer includes the Python environment and all extension modules the application needs. There is actually no need to install further libraries from somewhere else.1. checked PySide2 and shiboken2 are the same version - they are 5.15
2. Added Anaconda as PATH variable
3. uninstalled and reinstalled python environments
3. conda installed PySide2 and pip installed PySide2
You said PySide2 and shiboken version is 5.15. So I assume that the linked Qt version is 5.12 or newer. However, the Qt version FreeCAD 0.18 is linked to is probably 5.6 (check in FreeCAD with Help > About > Copy to clipboard)
Re: DLL Load Failed - QtCore
Many thanks for you response! I have answered these as best I can...
From what I can gather it's failing in QtCore.py
DLL load failed: The specified procedure could not be found.
Stack trace:
> File "C:\Program Files\FreeCAD 0.18\Ext\PySide\QtCore.py", line 1, in <module>
> from PySide2.QtCore import *
> File "C:\Program Files\FreeCAD 0.18\Mod\Fem\femtools\ccxtools.py", line 36, in <module>
> from PySide import QtCore
> File "C:\Program Files\FreeCAD 0.18\Mod\Fem\femobjects\_FemSolverCalculix.py", line 32, in <module>
> from femtools import ccxtools
> File "C:\Program Files\FreeCAD 0.18\Mod\Fem\ObjectsFem.py", line 446, in makeSolverCalculixCcxTools
> from femobjects import _FemSolverCalculix
> File "mypathtopyfile", line 140, in <module>
> solver_obj = objFEM.makeSolverCalculixCcxTools(FC.ActiveDocument)
Loaded 'PySide.QtCore'
Loaded 'femtools.ccxtools'
Loaded 'femobjects._FemSolverCalculix'
Loaded 'ObjectsFem'
Loaded '__main__'
Loaded 'runpy'
Yes I have changed Anaconda python from 3.8 to 3.6 to match FreeCADDoes your FreeCAD 0.18 version also use Python 3.6?
The resulting output:Since you have Visual Studio installed you should try to run FreeCAD in the debugger. Then in Visual Studio activate the Output window and clear its content.
From what I can gather it's failing in QtCore.py
DLL load failed: The specified procedure could not be found.
Stack trace:
> File "C:\Program Files\FreeCAD 0.18\Ext\PySide\QtCore.py", line 1, in <module>
> from PySide2.QtCore import *
> File "C:\Program Files\FreeCAD 0.18\Mod\Fem\femtools\ccxtools.py", line 36, in <module>
> from PySide import QtCore
> File "C:\Program Files\FreeCAD 0.18\Mod\Fem\femobjects\_FemSolverCalculix.py", line 32, in <module>
> from femtools import ccxtools
> File "C:\Program Files\FreeCAD 0.18\Mod\Fem\ObjectsFem.py", line 446, in makeSolverCalculixCcxTools
> from femobjects import _FemSolverCalculix
> File "mypathtopyfile", line 140, in <module>
> solver_obj = objFEM.makeSolverCalculixCcxTools(FC.ActiveDocument)
Loaded 'PySide.QtCore'
Loaded 'femtools.ccxtools'
Loaded 'femobjects._FemSolverCalculix'
Loaded 'ObjectsFem'
Loaded '__main__'
Loaded 'runpy'
Correct - without installing it will still arrive at the same error.The FreeCAD installer includes the Python environment and all extension modules the application needs. There is actually no need to install further libraries from somewhere else.
The Qt version is 5.6.2. Does this need updated to match PySide2 and shiboken2 version? Or those update to match Qt version 5.6?You said PySide2 and shiboken version is 5.15. So I assume that the linked Qt version is 5.12 or newer. However, the Qt version FreeCAD 0.18 is linked to is probably 5.6 (check in FreeCAD with Help > About > Copy to clipboard)
Re: DLL Load Failed - QtCore
I didn't want the output of FreeCAD but rather that of VS when you run FreeCAD from within it.The resulting output:
Is this the version FreeCAD uses?The Qt version is 5.6.2
And can you also figure out which Qt version PySide2 5.15 is linked to? If for some reason you cannot figure out this with VS then you can also use the tool ProcessExporer. Therefore start the external Python interpreter from anaconda and try to load QtCore. Now open the ProcessExplorer and select python.exe. In a separate window you should see all loaded dlls -- among them Qt5Core.dll. In the properties dialog to this file you should see the Qt version number.
Re: DLL Load Failed - QtCore
VS does not show any output when I put that line in to FreeCAD's python console.I didn't want the output of FreeCAD but rather that of VS when you run FreeCAD from within it.
The Qt version is 5.6.2
This is the version shown from Help > About > Copy to clipboard in FreeCAD.Is this the version FreeCAD uses?
This version is 5.9.7.0 from VS and Process Explorer.And can you also figure out which Qt version PySide2 5.15 is linked to?
Re: DLL Load Failed - QtCore
With VS you must load the FreeCAD.exe and press F5 or alternatively run FreeCAD and in VS use Debug > Attach to process. Important is that FreeCAD runs with a debugger.VS does not show any output when I put that line in to FreeCAD's python console.
OK, then the different Qt versions is the problem.This version is 5.9.7.0 from VS and Process Explorer.
Re: DLL Load Failed - QtCore
I have tried this and still not receiving any output window messages in Visual Studio after putting from PySide2.QtCore import * into FreeCAD's python console.With VS you must load the FreeCAD.exe and press F5 or alternatively run FreeCAD and in VS use Debug > Attach to process. Important is that FreeCAD runs with a debugger.
Would this imply VS and FreeCAD are not linked?
What can I do to resolve this. Have tried conda install qt=5.6 with no success.OK, then the different Qt versions is the problem.
Re: DLL Load Failed - QtCore
You should try with FreeCAD v0.19 then because this uses a newer Qt version and if you are lucky you will find a PySide2 version that uses the same Qt version.What can I do to resolve this. Have tried conda install qt=5.6 with no success.
Re: DLL Load Failed - QtCore
To close out this post I want to share my fix for other users.
To successfully access and use FreeCAD API in Visual Studio (Community Version) 2019 I created the python 3.6 environment as a conda environment through VS's Python Environment's 'Add Environment' functionality. This bypassed the issues I faced using Anaconda and it's installation of python 3.6 which did not allow communication with FreeCAD in my instance.
Hope this is of use to anyone else facing this issue.
To successfully access and use FreeCAD API in Visual Studio (Community Version) 2019 I created the python 3.6 environment as a conda environment through VS's Python Environment's 'Add Environment' functionality. This bypassed the issues I faced using Anaconda and it's installation of python 3.6 which did not allow communication with FreeCAD in my instance.
Hope this is of use to anyone else facing this issue.
Re: SOLVED: DLL Load Failed - QtCore
This needs to be added to the wiki
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs