Use Saxon-HE/C build package anywhere to use in Python application
I have downloaded and installed the Saxon-HE/C linux binary and build the Python extension using command 'python3 saxon-setup.py build_ext -if'. As a result 'saxonc.cpp' and 'saxonc.cpython-37m-x86_64-linux-gnu.so' 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)?
- Status changed from New to AwaitingInfo
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:
- Saxon location: "D:\Content\SaxonHEC1.2.1\Saxon.C.API\python-saxon"
- Added above path in PYTHONPATH and Path environment variables.
- Created a file with Notepad++ in another folder with the code below:
proc = saxonc.PySaxonProcessor(license=False)
It says "ModuleNotFoundError: No module named 'saxonc'"
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.
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.
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.
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
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!
Finally, I could integrate the Saxon/C Python extension combined with 'rt' and 'libsaxonhec.so' in AWS lambda.
- 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