Support #5041


Use Saxon-HE/C build package anywhere to use in Python application

Added by santanu das over 2 years ago. Updated 10 months ago.

Start date:
Due date:
% Done:


Estimated time:
Found in version:



I have downloaded and installed the Saxon-HE/C linux binary and build the Python extension using command 'python3 build_ext -if'. As a result 'saxonc.cpp' and '' files generated inside 'python-saxon' folder.

Now I want to copy and use the build (I guess only the 'python-saxon' folder) as library in a different system(PC - Win or Linux or Mac) and call from Python application.

Is it possible? If not then where can I download that kind of code package (just copy paste and use)?

Thanks, Santanu

Actions #1

Updated by O'Neil Delpratt over 2 years ago

  • Status changed from New to AwaitingInfo

Dear User,

You should be able to move the Saxon/C library to the default location for python libraries. The following forum post should help you to setup:

Also check out

Actions #2

Updated by santanu das over 2 years ago

Thanks Neil for your reply.

As I have understood, the workaround from the above links works within the same system, means you can use the Python extension within any project in the same system where you have made the build by setting up the environment variables.

But in my case the build was made in a linux system then I copied that in a Win 10 laptop. And performed the following steps:

  1. Saxon location: "D:\Content\SaxonHEC1.2.1\Saxon.C.API\python-saxon"
  2. Added above path in PYTHONPATH and Path environment variables.
  3. Created a file with Notepad++ in another folder with the code below:

import sys sys.path.append("D:\Content\SaxonHEC1.2.1\Saxon.C.API\python-saxon") import saxonc proc = saxonc.PySaxonProcessor(license=False)

It says "ModuleNotFoundError: No module named 'saxonc'"

Any thoughts?


Actions #3

Updated by Martin Honnen over 2 years ago

In my understanding you need to install and build on Windows to have a Windows specific Python extension, you need to install and build on Linux to have a Linux compatible Python extension, you can't expect to copy a C/C++ based extension from one OS/platform to another OS/platform.

Actions #4

Updated by O'Neil Delpratt over 2 years ago


Yes Martin is right.I misinterpreted the initial requirement in comment #0. You cannot build the Saxon/C python library on one os platform to use on a different os platform. You will need to download the Saxon/C installer for each os system you intend to use.

Actions #5

Updated by santanu das over 2 years ago

Thanks Neil and Martin for your inputs.

One more question, I want to use Saxon in AWS lambda script. Does it require the same type of installation and configurations' that we do for physical systems or it requires any special configuration?

Any suggestion or forum post link will be helpful.

Actions #6

Updated by Norm Tovey-Walsh over 2 years ago

There's no reason that it shouldn't work in a lambda.

The only challenge, I think, will be making sure that your lambda includes all the necessary libraries and dependencies. I've never tried to install Saxon/C in a lambda, but I did get a slightly complicated Python+ImageMagick+exiftool (everyone's favorite lambda, the one that uploads photographs automatically) lambda working with serverless.

It's been a while since I did that, but I seem to recall that serverless lets you run the whole thing locally in a container that mocks up the AWS interfaces. That really speeds up the process of working out which dependencies are missing!

Actions #7

Updated by santanu das over 2 years ago

Finally, I could integrate the Saxon/C Python extension combined with 'rt' and '' in AWS lambda.


Actions #8

Updated by O'Neil Delpratt 10 months ago

  • Status changed from AwaitingInfo to Closed

I am closing this issue given we have released Python package wheels for SaxonC 12.

Please register to edit this issue

Also available in: Atom PDF