https://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2020-01-21T20:47:57ZSaxonica Developer CommunitySaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147702020-01-21T20:47:57ZMichael Kaymike@saxonica.com
<ul><li><strong>Category</strong> set to <i>Build and release</i></li><li><strong>Assignee</strong> set to <i>O'Neil Delpratt</i></li></ul> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147712020-01-22T00:10:09ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Project</strong> changed from <i>Saxon</i> to <i>SaxonC</i></li><li><strong>Category</strong> deleted (<del><i>Build and release</i></del>)</li></ul><p>Hi,</p>
<p>The installation details for Windows has since been updated.</p>
<p>Please follow the instructions given here:</p>
<p><a href="https://www.saxonica.com/saxon-c/documentation/index.html#!starting/installingpython" class="external">https://www.saxonica.com/saxon-c/documentation/index.html#!starting/installingpython</a></p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147722020-01-22T00:10:54ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Category</strong> set to <i>Python Build</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>AwaitingInfo</i></li><li><strong>Found in version</strong> set to <i>1.2.1</i></li></ul> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147732020-01-22T12:32:57ZNaveen Thakur
<ul></ul><p>Indeed, those are the very same instructions I've followed.</p>
<p>May I ask, what should the build output exactly? I'm want to confirm the build succeeded.</p>
<p>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).</p>
<p>Thanks.</p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147742020-01-22T12:38:38ZNaveen Thakur
<ul><li><strong>File</strong> <a href="/attachments/48702">build_output.txt</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/48702/build_output.txt">build_output.txt</a> added</li></ul><p>build output attached in case that helps.</p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147752020-01-22T13:18:13ZO'Neil Delprattoneil@saxonica.com
<ul></ul><p>Having looked at your build_output.txt file you have successful Saxon/C build for python.</p>
<p>To use the Saxon/C in your python scripts you will have to setup the python path to point to the created library.</p>
<p>As mentioned in the documentation:</p>
<pre><code>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
</code></pre> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147762020-01-22T15:41:34ZNaveen Thakur
<ul></ul><p>Thanks for the response.</p>
<p>I've followed the instructions as suggested. I've then tried to run saxon_example.py from PowerShell in Admin mode (assuming this sensible).</p>
<p>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</p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147792020-01-22T18:10:23ZO'Neil Delprattoneil@saxonica.com
<ul></ul><p>Naveen Thakur wrote:</p>
<blockquote>
<p>Thanks for the response.</p>
<p>I've followed the instructions as suggested. I've then tried to run saxon_example.py from PowerShell in Admin mode (assuming this sensible).</p>
</blockquote>
<p>Yes that is right</p>
<blockquote>
<p>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</p>
</blockquote>
<p>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?</p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147802020-01-22T18:25:33ZNaveen Thakur
<ul><li><strong>File</strong> <a href="/attachments/48704">python_finds_dll.png</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/48704/python_finds_dll.png">python_finds_dll.png</a> added</li></ul><p>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'.</p>
<p>I'm wondering whether there's an issue with the dll - though I have re-downloaded/re-installed a few times.</p>
<p>Are you able to attach your copy of a working dll?
I could try and see if that loads.</p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147812020-01-22T19:09:38ZO'Neil Delprattoneil@saxonica.com
<ul></ul><p>Naveen Thakur wrote:</p>
<blockquote>
<p>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'.</p>
<p>I'm wondering whether there's an issue with the dll - though I have re-downloaded/re-installed a few times.</p>
<p>Are you able to attach your copy of a working dll?
I could try and see if that loads.</p>
</blockquote>
<p>Yes you can try but I suspect it to be the same file: <a href="https://dev.saxonica.com/repos/archive/opensource/latest9.9/hec/dll-temp/libsaxonhec.dll" class="external">https://dev.saxonica.com/repos/archive/opensource/latest9.9/hec/dll-temp/libsaxonhec.dll</a></p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147822020-01-22T19:11:15ZO'Neil Delprattoneil@saxonica.com
<ul></ul><p>Also What machine setup do you have. i.e Windows version?</p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147832020-01-22T19:12:46ZNaveen Thakur
<ul></ul><p>Thanks, I'll check the dll. But you're right it's a long-shot.</p>
<p>I'm on Windows 10 Version 10.0.18362 Build 18362</p>
<p>Cheers.</p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147842020-01-22T19:17:55ZNaveen Thakur
<ul></ul><p>And indeed, it's not the dll - I get the same error.</p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147852020-01-23T09:33:03ZMartin Honnenmartin.honnen@gmx.de
<ul></ul><p>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 <code>pyd</code> was e.g. <code>saxonc.cp37-win_amd64.pyd</code>. So that might be the issue, that the Saxon-C dll is meant to be used with 64-bit programs.</p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147862020-01-23T10:11:30ZO'Neil Delprattoneil@saxonica.com
<ul></ul><p>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?</p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147872020-01-23T10:38:19ZNaveen Thakur
<ul></ul><p>Ah yes, good spot.
I thought I had installed Python 64-bit but just checked and it's 32-bit.</p>
<p>I will retry with 64 bit Python.</p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=147882020-01-23T10:52:10ZNaveen Thakur
<ul></ul><p>It was indeed the use of 32-bit Python rather than 64-bit that caused the issue.</p>
<p>Thank you both.</p> SaxonC - Support #4436: Python/C error: 'Unable to load C:\Program Files\Saxonica\SaxonHEC1.2.1\libsaxonhec.dll'https://saxonica.plan.io/issues/4436?journal_id=250292023-11-07T13:17:10ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Status</strong> changed from <i>AwaitingInfo</i> to <i>Closed</i></li></ul>