ICB-DCM / pyPESTO

python Parameter EStimation TOolbox
https://pypesto.readthedocs.io
BSD 3-Clause "New" or "Revised" License
216 stars 47 forks source link

PetabImporter does not check for existing amici models in location specified by output_folder arg. #1318

Closed m-philipps closed 4 months ago

m-philipps commented 6 months ago

Bug description When using the PetabImporter the amici model is re-compiled although it is already available at the location specified by the output_folder argument.

Before compiling the amici model the PetabImporter checks if an amici module is already available, but does not check within subfolders of the current path: https://github.com/ICB-DCM/pyPESTO/blob/ee852cb216a65b12bf2d1e16edc8c0fba6c3e714/pypesto/petab/importer.py#L355-L356 This does not make use of the output_folder argument.

Expected behavior Since by default the amici models are compiled to the folder amici_models/ I would expect those to be found and not recompiled.

dweindl commented 6 months ago

Ideally, the referenced line should also use amici.import_model_module instead of importlib.import_module. The former will also take the output directory as arguments.

m-philipps commented 6 months ago

Ah, nice. There's also a workaround with importlib.machinery.PathFinder() but I supose the amici solution is preferred?