Project

Profile

Help

Support #4436

closed

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

Added by Naveen Thakur almost 5 years ago. Updated about 1 year ago.

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

0%

Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
1.2.1
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

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

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
Actions #1

Updated by Michael Kay almost 5 years ago

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

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

Actions #3

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
Actions #4

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.

Actions #5

Updated by Naveen Thakur almost 5 years ago

build output attached in case that helps.

Actions #6

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
Actions #7

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

Actions #8

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?

Actions #9

Updated by Naveen Thakur almost 5 years 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.

Actions #10

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

Actions #11

Updated by O'Neil Delpratt almost 5 years ago

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

Actions #12

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.

Actions #13

Updated by Naveen Thakur almost 5 years ago

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

Actions #14

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.

Actions #15

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?

Actions #16

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.

Actions #17

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.

Actions #18

Updated by O'Neil Delpratt about 1 year ago

  • Status changed from AwaitingInfo to Closed

Please register to edit this issue

Also available in: Atom PDF