diff --git a/.github/workflows/test_benchmark_collection_models.yml b/.github/workflows/test_benchmark_collection_models.yml index 023fe077e6..7c7aacb992 100644 --- a/.github/workflows/test_benchmark_collection_models.yml +++ b/.github/workflows/test_benchmark_collection_models.yml @@ -52,6 +52,10 @@ jobs: AMICI_PARALLEL_COMPILE="" pip3 install -v --user \ $(ls -t python/sdist/dist/amici-*.tar.gz | head -1)[petab,test,vis] + - run: | + python3 -m pip uninstall -y petab && python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@develop \ + && python3 -m pip install -U sympy + # retrieve test models - name: Download and test benchmark collection run: | diff --git a/.github/workflows/test_petab_test_suite.yml b/.github/workflows/test_petab_test_suite.yml index 7e9a93c494..76ecc19f8e 100644 --- a/.github/workflows/test_petab_test_suite.yml +++ b/.github/workflows/test_petab_test_suite.yml @@ -58,7 +58,7 @@ jobs: - name: Install petab run: | source ./venv/bin/activate \ - && pip3 install wheel pytest shyaml pytest-cov pysb + && pip3 install wheel pytest shyaml pytest-cov pysb>=1.16 # retrieve test models - name: Download and install PEtab test suite @@ -68,11 +68,18 @@ jobs: && source ./venv/bin/activate \ && cd petab_test_suite && pip3 install -e . + - name: Install petab + run: | + source ./venv/bin/activate \ + && python3 -m pip uninstall -y petab && python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@develop \ + && python3 -m pip install sympy>=1.12.1 + + - name: Run PEtab-related unit tests run: | source ./venv/bin/activate \ && pytest --cov-report=xml:coverage.xml \ - --cov=./ python/tests/test_*petab*.py python/tests/petab/ + --cov=./ python/tests/test_*petab*.py python/tests/petab_/ # run test models - name: Run PEtab test suite diff --git a/documentation/python_installation.rst b/documentation/python_installation.rst index 3c893bcd61..d1e5f37f0a 100644 --- a/documentation/python_installation.rst +++ b/documentation/python_installation.rst @@ -360,16 +360,19 @@ environment variables: | | Default: ``ON`` | | +----------------------------+----------------------------------+---------------------------------+ -Installation under Anaconda ---------------------------- +Installation under conda +------------------------ -To use an Anaconda installation of Python -`https://www.anaconda.com/distribution/ `_, -Python>=3.7), proceed as follows: +There is no amici conda recipe available yet. However, you can install AMICI +using pip in a conda environment. -Since Anaconda provides own versions of some packages which might not -work with AMICI (in particular the ``gcc`` compiler), create a minimal -virtual environment via: +.. note:: + + It is possible, but we currently don't recommend using conda for installing + AMICI, as it commonly leads to conflicts with system installations of + libraries and compilers. + +Create a minimal conda environment via: .. code-block:: bash @@ -415,7 +418,7 @@ Now, you are ready to use AMICI in the virtual environment. .. note:: - **Anaconda on Mac** + **conda on Mac** If the above installation does not work for you, try installing AMICI via: @@ -437,6 +440,9 @@ Now, you are ready to use AMICI in the virtual environment. (For further discussion see https://github.com/AMICI-dev/AMICI/issues/357) +Known issues: + +* ``CMAKE_AR-NOTFOUND: not found``: Try ``conda install binutils``. Optional Boost support ---------------------- diff --git a/pytest.ini b/pytest.ini index 4f682576a3..9c2da85f82 100644 --- a/pytest.ini +++ b/pytest.ini @@ -3,6 +3,7 @@ addopts = -vv --strict-markers filterwarnings = + # warnings are errors error # amici ignore:Conservation laws for non-constant species in models with RateRules are currently not supported and will be turned off.:UserWarning @@ -13,7 +14,6 @@ filterwarnings = ignore:.*inspect.getargspec\(\) is deprecated.*:DeprecationWarning # pysb warnings ignore:the imp module is deprecated in favour of importlib.*:DeprecationWarning:pysb\.core - ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working.*:DeprecationWarning:pysb\.core ignore:Model.initial_conditions will be removed in a future version. Instead, you can get a list of Initial objects with Model.initials.:DeprecationWarning:pysb\.core # https://github.com/pytest-dev/pytest-xdist/issues/825#issuecomment-1292283870 ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning diff --git a/python/sdist/amici/petab/cli/import_petab.py b/python/sdist/amici/petab/cli/import_petab.py index 39fa9b9bfe..b124b4d98b 100644 --- a/python/sdist/amici/petab/cli/import_petab.py +++ b/python/sdist/amici/petab/cli/import_petab.py @@ -3,7 +3,7 @@ import petab from ..petab_import import import_model_sbml -from petab.models.sbml_model import SbmlModel +from petab.v1.models.sbml_model import SbmlModel def _parse_cli_args(): diff --git a/python/sdist/amici/petab/conditions.py b/python/sdist/amici/petab/conditions.py index c0b702b69d..08c2f90302 100644 --- a/python/sdist/amici/petab/conditions.py +++ b/python/sdist/amici/petab/conditions.py @@ -9,9 +9,9 @@ import amici import numpy as np import pandas as pd -import petab +import petab.v1 as petab from amici import AmiciModel -from petab.C import ( +from petab.v1.C import ( MEASUREMENT, NOISE_PARAMETERS, OBSERVABLE_ID, diff --git a/python/sdist/amici/petab/import_helpers.py b/python/sdist/amici/petab/import_helpers.py index 94d8e8e0ce..b52d74004d 100644 --- a/python/sdist/amici/petab/import_helpers.py +++ b/python/sdist/amici/petab/import_helpers.py @@ -11,9 +11,9 @@ import amici import pandas as pd -import petab +import petab.v1 as petab import sympy as sp -from petab.C import ( +from petab.v1.C import ( CONDITION_NAME, ESTIMATE, NOISE_DISTRIBUTION, @@ -22,7 +22,7 @@ OBSERVABLE_NAME, OBSERVABLE_TRANSFORMATION, ) -from petab.parameters import get_valid_parameters_for_parameter_table +from petab.v1.parameters import get_valid_parameters_for_parameter_table from sympy.abc import _clash logger = logging.getLogger(__name__) diff --git a/python/sdist/amici/petab/parameter_mapping.py b/python/sdist/amici/petab/parameter_mapping.py index 54930073da..dc88c1064d 100644 --- a/python/sdist/amici/petab/parameter_mapping.py +++ b/python/sdist/amici/petab/parameter_mapping.py @@ -27,17 +27,17 @@ import amici import numpy as np import pandas as pd -import petab +import petab.v1 as petab import sympy as sp from amici.sbml_import import get_species_initial -from petab.C import * # noqa: F403 -from petab.C import ( +from petab.v1.C import * # noqa: F403 +from petab.v1.C import ( LIN, PARAMETER_SCALE, PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID, ) -from petab.models import MODEL_TYPE_PYSB, MODEL_TYPE_SBML +from petab.v1.models import MODEL_TYPE_PYSB, MODEL_TYPE_SBML from sympy.abc import _clash from .. import AmiciModel diff --git a/python/sdist/amici/petab/petab_import.py b/python/sdist/amici/petab/petab_import.py index 0e63496d75..52b08cfd47 100644 --- a/python/sdist/amici/petab/petab_import.py +++ b/python/sdist/amici/petab/petab_import.py @@ -12,8 +12,8 @@ from warnings import warn import amici -import petab -from petab.models import MODEL_TYPE_PYSB, MODEL_TYPE_SBML +import petab.v1 as petab +from petab.v1.models import MODEL_TYPE_PYSB, MODEL_TYPE_SBML from ..logging import get_logger from .import_helpers import _can_import_model, _create_model_name, check_model diff --git a/python/sdist/amici/petab/petab_problem.py b/python/sdist/amici/petab/petab_problem.py index 618b8b5247..b93eb06a87 100644 --- a/python/sdist/amici/petab/petab_problem.py +++ b/python/sdist/amici/petab/petab_problem.py @@ -4,8 +4,8 @@ import amici import pandas as pd -import petab -from petab.C import PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID +import petab.v1 as petab +from petab.v1.C import PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID from .conditions import create_edatas, fill_in_parameters from .parameter_mapping import create_parameter_mapping diff --git a/python/sdist/amici/petab/pysb_import.py b/python/sdist/amici/petab/pysb_import.py index f5b1c84dbf..aac3a8f330 100644 --- a/python/sdist/amici/petab/pysb_import.py +++ b/python/sdist/amici/petab/pysb_import.py @@ -9,12 +9,12 @@ import re from pathlib import Path -import petab +import petab.v1 as petab import pysb import pysb.bng import sympy as sp -from petab.C import CONDITION_NAME, NOISE_FORMULA, OBSERVABLE_FORMULA -from petab.models.pysb_model import PySBModel +from petab.v1.C import CONDITION_NAME, NOISE_FORMULA, OBSERVABLE_FORMULA +from petab.v1.models.pysb_model import PySBModel from ..logging import get_logger, log_execution_time, set_log_level from . import PREEQ_INDICATOR_ID diff --git a/python/sdist/amici/petab/sbml_import.py b/python/sdist/amici/petab/sbml_import.py index 6acf4587f7..92009bf7cd 100644 --- a/python/sdist/amici/petab/sbml_import.py +++ b/python/sdist/amici/petab/sbml_import.py @@ -8,11 +8,11 @@ import amici import libsbml -import petab +import petab.v1 as petab import sympy as sp from _collections import OrderedDict from amici.logging import log_execution_time, set_log_level -from petab.models import MODEL_TYPE_SBML +from petab.v1.models import MODEL_TYPE_SBML from sympy.abc import _clash from . import PREEQ_INDICATOR_ID @@ -90,7 +90,7 @@ def import_model_sbml( :return: The created :class:`amici.sbml_import.SbmlImporter` instance. """ - from petab.models.sbml_model import SbmlModel + from petab.v1.models.sbml_model import SbmlModel set_log_level(logger, verbose) diff --git a/python/sdist/amici/petab/simulations.py b/python/sdist/amici/petab/simulations.py index 2cbed98dce..0f09c83b7a 100644 --- a/python/sdist/amici/petab/simulations.py +++ b/python/sdist/amici/petab/simulations.py @@ -12,8 +12,8 @@ import amici import numpy as np import pandas as pd -import petab -from petab.C import * # noqa: F403 +import petab.v1 as petab +from petab.v1.C import * # noqa: F403 from .. import AmiciExpData, AmiciModel from ..logging import get_logger, log_execution_time diff --git a/python/sdist/amici/petab/simulator.py b/python/sdist/amici/petab/simulator.py index 9c655b1483..407bf9f7f2 100644 --- a/python/sdist/amici/petab/simulator.py +++ b/python/sdist/amici/petab/simulator.py @@ -14,7 +14,7 @@ from collections.abc import Callable import pandas as pd -import petab +import petab.v1 as petab from amici import AmiciModel, SensitivityMethod_none from .petab_import import import_petab_problem diff --git a/python/sdist/amici/petab/util.py b/python/sdist/amici/petab/util.py index e30b829a04..5392dcdb86 100644 --- a/python/sdist/amici/petab/util.py +++ b/python/sdist/amici/petab/util.py @@ -5,10 +5,10 @@ import libsbml import pandas as pd -import petab -from petab.C import PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID -from petab.mapping import resolve_mapping -from petab.models import MODEL_TYPE_PYSB, MODEL_TYPE_SBML +import petab.v1 as petab +from petab.v1.C import PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID +from petab.v1.mapping import resolve_mapping +from petab.v1.models import MODEL_TYPE_PYSB, MODEL_TYPE_SBML if TYPE_CHECKING: pysb = None diff --git a/python/tests/petab/test_petab_problem.py b/python/tests/petab_/test_petab_problem.py similarity index 100% rename from python/tests/petab/test_petab_problem.py rename to python/tests/petab_/test_petab_problem.py diff --git a/python/tests/test_petab_import.py b/python/tests/test_petab_import.py index fca319e11f..7979e6fbf1 100644 --- a/python/tests/test_petab_import.py +++ b/python/tests/test_petab_import.py @@ -5,7 +5,7 @@ import pytest from amici.testing import TemporaryDirectoryWinSafe, skip_on_valgrind -petab = pytest.importorskip("petab", reason="Missing petab") +petab = pytest.importorskip("petab.v1", reason="Missing petab") @pytest.fixture @@ -76,7 +76,7 @@ def test_get_fixed_parameters(get_fixed_parameters_model): from amici.petab.sbml_import import ( _get_fixed_parameters_sbml as get_fixed_parameters, ) - from petab.models.sbml_model import SbmlModel + from petab.v1.models.sbml_model import SbmlModel sbml_doc, sbml_model = get_fixed_parameters_model condition_df = petab.get_condition_df( @@ -117,7 +117,7 @@ def test_get_fixed_parameters(get_fixed_parameters_model): @skip_on_valgrind def test_default_output_parameters(simple_sbml_model): from amici.petab.petab_import import import_model - from petab.models.sbml_model import SbmlModel + from petab.v1.models.sbml_model import SbmlModel sbml_doc, sbml_model = simple_sbml_model condition_df = petab.get_condition_df( diff --git a/python/tests/test_petab_objective.py b/python/tests/test_petab_objective.py index 07770ac413..260036a267 100755 --- a/python/tests/test_petab_objective.py +++ b/python/tests/test_petab_objective.py @@ -6,7 +6,7 @@ import amici import numpy as np import pandas as pd -import petab +import petab.v1 as petab import pytest from amici.petab.petab_import import import_petab_problem from amici.petab.simulations import SLLH, simulate_petab diff --git a/python/tests/test_petab_simulate.py b/python/tests/test_petab_simulate.py index e1da7768e3..f0310eaca5 100644 --- a/python/tests/test_petab_simulate.py +++ b/python/tests/test_petab_simulate.py @@ -3,7 +3,7 @@ import tempfile from pathlib import Path -import petab +import petab.v1 as petab import petabtests import pytest from amici.petab.simulator import PetabSimulator diff --git a/tests/benchmark-models/test_petab_model.py b/tests/benchmark-models/test_petab_model.py index da3d37b5fb..c4ec2f5dd2 100755 --- a/tests/benchmark-models/test_petab_model.py +++ b/tests/benchmark-models/test_petab_model.py @@ -15,7 +15,7 @@ import amici import numpy as np import pandas as pd -import petab +import petab.v1 as petab import yaml from amici.logging import get_logger from amici.petab.simulations import ( @@ -24,7 +24,7 @@ rdatas_to_measurement_df, simulate_petab, ) -from petab.visualize import plot_problem +from petab.v1.visualize import plot_problem logger = get_logger(f"amici.{__name__}", logging.WARNING) diff --git a/tests/petab_test_suite/test_petab_suite.py b/tests/petab_test_suite/test_petab_suite.py index fee6c6d763..cf1c7d4266 100755 --- a/tests/petab_test_suite/test_petab_suite.py +++ b/tests/petab_test_suite/test_petab_suite.py @@ -6,7 +6,7 @@ import amici import pandas as pd -import petab +import petab.v1 as petab import petabtests import pytest from _pytest.outcomes import Skipped