StephenSmith25 / PythonFMU3

A lightweight framework that enables the packaging of Python3.x code as co-simulation FMUs following version 3.0
MIT License
7 stars 2 forks source link

Can you confirm if python3.11 is mandatory for using pythonfmu3 #8

Closed gricharuk closed 1 month ago

gricharuk commented 1 month ago

I have built a test application with pythonfmu3, it works fine being instantiated with fmpy,

But I need to actually run on a second server that has to run python3.9, redhat 8.

When I rebuild - it runs, when I try and instantiate it fails stating it is missing a python3.11 "so" file.

When I grep the folder, and unzip the FMU file, for python3.11 - I can see

grep -R "python3.11"
Binary file FMUWrapper.fmu matches
Binary file binaries/x86_64-linux/FMUWrapper.so matches

But my python version is

python
Python 3.9.19 | packaged by conda-forge | (main, Mar 20 2024, 12:50:21) 
[GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

These are two different machines so I don't think I have a polluted environment, I've performed a clean etc. On the second machine I don't have python3.11 installed at all.

Any thoughts? is this a hard coded version of python?

StephenSmith25 commented 1 month ago

The project does not depend on a particular version of python. It uses the stable API, so python > 3.6ish should work. The issue is with the CI builds and the upload to pypi. When the CI builds the project and uploads it it occurs within a 3.11 environment. There are similar issues with PythonFMU, for example https://github.com/NTNU-IHB/PythonFMU/issues/128 .

I think the fastest solution, if you can - is to build the project from source. If you build from source it will use whatever Python install you have in your build environment. Which is primarily achieved with

  1. cd pythonfmu3/pythonfmu-export
  2. build the project, build scripts in the folder can be used
  3. now cd into the root and do pip install ., or pip install -e .

Let me know if you need any more advice, or if that will not work for you. You can get a C++ compiler from conda as well, if you are using that mechanism. Maybe those instructions are not the best, so let me know if you need more info.

As a note, I think if I create a conda version of this project (rather than pip) it should work. But I have not got round to that yet.

gricharuk commented 1 month ago

Thanks for the feedback - I will have a try!

I appreciate your work, a really useful library.....

StephenSmith25 commented 1 month ago

Thanks, let me know if you run into any issues

gricharuk commented 1 month ago

Hi, I've rebuilt for python3.9 - it works fine,

I did a few actions on my machine if you are interested?


Looks good - I'll leave you to figure out a method to remove the dependency, this solution works for me!