Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CMake using incorrect Python library for building model extension #2220

Merged
merged 2 commits into from
Dec 3, 2023

Conversation

dweindl
Copy link
Member

@dweindl dweindl commented Dec 1, 2023

This fixes a bug where a model extension would be built for an incorrect Python version. If there is a newer Python version available than the one in use during model import, CMake would incorrectly used the newer version. This results in not so informative errors like:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/model_name/model_name.py", line 12, in <module>
    import _model_name
ModuleNotFoundError: No module named '_model_name'

Fixed here by explicitly setting the Python executable that is used to find the matching libraries.

This fixes a bug where a model extension would be built for an incorrect
Python version. If there is a newer Python version available than the one
in use during model import, CMake would incorrectly used the newer version.
This results in not so informative errors like:
```
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/model_name/model_name.py", line 12, in <module>
    import _model_name
ModuleNotFoundError: No module named '_model_name'
```

Fixed here by explicitly setting the Python executable that is used to
find the matching libraries.
@dweindl dweindl requested a review from a team as a code owner December 1, 2023 19:40
Copy link

codecov bot commented Dec 1, 2023

Codecov Report

Merging #2220 (d0a603c) into develop (dff4ec3) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #2220   +/-   ##
========================================
  Coverage    76.50%   76.50%           
========================================
  Files           91       91           
  Lines        15034    15034           
========================================
  Hits         11502    11502           
  Misses        3532     3532           
Flag Coverage Δ
cpp 73.08% <ø> (ø)
cpp_python 37.03% <ø> (ø)
petab 53.77% <ø> (ø)
python 77.13% <ø> (ø)
sbmlsuite ?

Flags with carried forward coverage won't be shown. Click here to find out more.

@dweindl dweindl self-assigned this Dec 1, 2023
Copy link
Member

@FFroehlich FFroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dweindl dweindl merged commit a973bc0 into AMICI-dev:develop Dec 3, 2023
19 checks passed
@dweindl dweindl deleted the fix_py_exe branch December 3, 2023 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants