Support #4436
closedPython/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'
0%
Description
I've installed version 1.2.1 (Windows 64 bit/HE). I've followed the installation instructions within the included readme.txt (.\Saxon.C.API\python-saxon) I've set $env:PYTHONPATH as per online docs ( $Env:PYTHONPATH += ";C:\Program Files\Saxonica\SaxonHEC1.2.1\Saxon.C.API\python-saxon")
However, I keep getting the following error when trying to run the pytests included in the Python folder, or when using the library from other projects, 52 tests are discovered but not run because of the following error:
Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll Error: : No error
Are there any steps I've missed?
Files
Updated by Michael Kay almost 5 years ago
- Category set to Build and release
- Assignee set to O'Neil Delpratt
Updated by O'Neil Delpratt almost 5 years ago
- Project changed from Saxon to SaxonC
- Category deleted (
Build and release)
Hi,
The installation details for Windows has since been updated.
Please follow the instructions given here:
https://www.saxonica.com/saxon-c/documentation/index.html#!starting/installingpython
Updated by O'Neil Delpratt almost 5 years ago
- Category set to Python Build
- Status changed from New to AwaitingInfo
- Found in version set to 1.2.1
Updated by Naveen Thakur almost 5 years ago
Indeed, those are the very same instructions I've followed.
May I ask, what should the build output exactly? I'm want to confirm the build succeeded.
I can see a 'build' folder being updated (under C:\Program Files\Saxonica\SaxonHEC1.2.1\Saxon.C.API\python-saxon) which contains .obj files. Is there any other expected output I should look for? The libsaxonhec.dll file is not being modified (which I presume is expected behaviour).
Thanks.
Updated by Naveen Thakur almost 5 years ago
- File build_output.txt build_output.txt added
build output attached in case that helps.
Updated by O'Neil Delpratt almost 5 years ago
Having looked at your build_output.txt file you have successful Saxon/C build for python.
To use the Saxon/C in your python scripts you will have to setup the python path to point to the created library.
As mentioned in the documentation:
For arbitrary Powershell Windows need to set: $Env:PYTHONPATH +=
";C:\Program Files\Saxonica\SaxonHEC1.2.1\Saxon.C.API\python-saxon" to
ensure that "import saxonc" in any Python program finds the saxonc module
Updated by Naveen Thakur almost 5 years ago
Thanks for the response.
I've followed the instructions as suggested. I've then tried to run saxon_example.py from PowerShell in Admin mode (assuming this sensible).
For example: PS C:\Program Files\Saxonica\SaxonHEC1.2.1\Saxon.C.API\python-saxon> $Env:PYTHONPATH += ";C:\Program Files\Saxonica\SaxonHEC1.2.1\Saxon.C.API\python-saxon" PS C:\Program Files\Saxonica\SaxonHEC1.2.1\Saxon.C.API\python-saxon> py .\saxon_example.py Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll Error: : No error
Updated by O'Neil Delpratt almost 5 years ago
Naveen Thakur wrote:
Thanks for the response.
I've followed the instructions as suggested. I've then tried to run saxon_example.py from PowerShell in Admin mode (assuming this sensible).
Yes that is right
For example: PS C:\Program Files\Saxonica\SaxonHEC1.2.1\Saxon.C.API\python-saxon> $Env:PYTHONPATH += ";C:\Program Files\Saxonica\SaxonHEC1.2.1\Saxon.C.API\python-saxon" PS C:\Program Files\Saxonica\SaxonHEC1.2.1\Saxon.C.API\python-saxon> py .\saxon_example.py Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll Error: : No error
I have not been able to reproduce this error. Did you install Saxon-HE/C in the same location it is looking for the dll library?
Updated by Naveen Thakur almost 5 years ago
- File python_finds_dll.png python_finds_dll.png added
Yes, it's installed at that location. I've attached a ProcessMon output which 'appears' to show python.exe finding the dll when I run 'saxon_example.py'.
I'm wondering whether there's an issue with the dll - though I have re-downloaded/re-installed a few times.
Are you able to attach your copy of a working dll? I could try and see if that loads.
Updated by O'Neil Delpratt almost 5 years ago
Naveen Thakur wrote:
Yes, it's installed at that location. I've attached a ProcessMon output which 'appears' to show python.exe finding the dll when I run 'saxon_example.py'.
I'm wondering whether there's an issue with the dll - though I have re-downloaded/re-installed a few times.
Are you able to attach your copy of a working dll? I could try and see if that loads.
Yes you can try but I suspect it to be the same file: https://dev.saxonica.com/repos/archive/opensource/latest9.9/hec/dll-temp/libsaxonhec.dll
Updated by O'Neil Delpratt almost 5 years ago
Also What machine setup do you have. i.e Windows version?
Updated by Naveen Thakur almost 5 years ago
Thanks, I'll check the dll. But you're right it's a long-shot.
I'm on Windows 10 Version 10.0.18362 Build 18362
Cheers.
Updated by Naveen Thakur almost 5 years ago
And indeed, it's not the dll - I get the same error.
Updated by Martin Honnen almost 5 years ago
Is that a 32-bit Python installation? The file saxonc.cp37-win32.pyd suggests that. But I think the Saxon-C libsaxonhec.dll is for 64-bit. When I have built and used the Python module sucessfully on Windows 10 then with a 64-bit Python and the extension module pyd
was e.g. saxonc.cp37-win_amd64.pyd
. So that might be the issue, that the Saxon-C dll is meant to be used with 64-bit programs.
Updated by O'Neil Delpratt almost 5 years ago
Oh yes that would be a problem a 32-bit python trying to run a 64-bit Saxon/C library. Are you able to install a 64-bit python build?
Updated by Naveen Thakur almost 5 years ago
Ah yes, good spot. I thought I had installed Python 64-bit but just checked and it's 32-bit.
I will retry with 64 bit Python.
Updated by Naveen Thakur almost 5 years ago
It was indeed the use of 32-bit Python rather than 64-bit that caused the issue.
Thank you both.
Updated by O'Neil Delpratt about 1 year ago
- Status changed from AwaitingInfo to Closed
Please register to edit this issue