Project

Profile

Help

Support #4436

Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'

Added by Naveen Thakur 7 months ago. Updated 7 months ago.

Status:
AwaitingInfo
Priority:
Normal
Category:
Python Build
Start date:
2020-01-21
Due date:
% Done:

0%

Estimated time:
Found in version:
1.2.1

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?

build_output.txt (12.9 KB) build_output.txt Naveen Thakur, 2020-01-22 13:38
python_finds_dll.png (22.4 KB) python_finds_dll.png Naveen Thakur, 2020-01-22 19:13

History

#1 Updated by Michael Kay 7 months ago

  • Category set to Build and release
  • Assignee set to O'Neil Delpratt

#2 Updated by O'Neil Delpratt 7 months ago

  • Project changed from Saxon to Saxon/C
  • 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

#3 Updated by O'Neil Delpratt 7 months ago

  • Category set to Python Build
  • Status changed from New to AwaitingInfo
  • Found in version set to 1.2.1

#4 Updated by Naveen Thakur 7 months 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.

#5 Updated by Naveen Thakur 7 months ago

build output attached in case that helps.

#6 Updated by O'Neil Delpratt 7 months 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

#7 Updated by Naveen Thakur 7 months 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

#8 Updated by O'Neil Delpratt 7 months 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?

#9 Updated by Naveen Thakur 7 months ago

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.

#10 Updated by O'Neil Delpratt 7 months 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

#11 Updated by O'Neil Delpratt 7 months ago

Also What machine setup do you have. i.e Windows version?

#12 Updated by Naveen Thakur 7 months 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.

#13 Updated by Naveen Thakur 7 months ago

And indeed, it's not the dll - I get the same error.

#14 Updated by Martin Honnen 7 months 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.

#15 Updated by O'Neil Delpratt 7 months 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?

#16 Updated by Naveen Thakur 7 months 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.

#17 Updated by Naveen Thakur 7 months ago

It was indeed the use of 32-bit Python rather than 64-bit that caused the issue.

Thank you both.

Please register to edit this issue

Also available in: Atom PDF