|badge1| |badge2| |badge3| |badge4| |badge5| |badge6|
.. |badge1| image:: https://img.shields.io/pypi/v/pharmpy-core.svg
:target: https://pypi.org/project/pharmpy-core
.. |badge2| image:: https://img.shields.io/pypi/l/pharmpy-core.svg
:target: https://github.com/pharmpy/pharmpy/blob/main/LICENSE.LESSER
.. |badge3| image:: https://github.com/pharmpy/pharmpy/actions/workflows/main.yml/badge.svg
:target: https://github.com/pharmpy/pharmpy/actions
.. |badge4| image:: https://img.shields.io/pypi/pyversions/pharmpy-core
:target: https://www.python.org/downloads/
.. |badge5| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
.. |badge6| image:: https://codecov.io/gh/pharmpy/pharmpy/branch/main/graph/badge.svg?token=JZTHXXQPII
:target: https://codecov.io/gh/pharmpy/pharmpy
.. _README:
|logo|
======
.. |logo| image:: https://github.com/pharmpy/pharmpy/raw/main/docs/Pharmpy_logo.svg
:width: 250
Pharmpy is an open-source software package for pharmacometric modeling. It has functionality ranging from reading and
manipulating model files and datasets to full tools where subsequent results are collected and presented.
Features include:
* A **model abstraction** which splits a model into core components which Pharmpy understands and can manipulate:
parameters, random variables, statements (including ODE system), dataset, and execution steps
* An **abstraction for modelfit results** which splits a parsed results into core components: e.g. OFV, parameter
estimates, relative standard errors (RSEs), residuals, predictions
* **Functions for manipulation of models and datasets** in the modeling-module: e.g. change structural model, add
time-after-dose column, add covariate effects
* **Tools for automated model development**: building various aspects (structural, iiv, iov, ruv, covariates, ...) of PK, PKPD, TMDD and drug-metabolite models automatically
* **Tools to aid model development** in the tools-module: execution of models within Python/R scripts, bootstrap,
comparison of estimation methods
* **Simplify scripting** of workflows. Makes it possible to run scripts including calls to long running tools multiple times without having to rerun already finished tool runs.
* Support for **multiple estimation tools**: parse NONMEM models, execute NONMEM, nlmixr2, and rxODE2 models, run all
Pharmpy tools with NONMEM and some with nlmixr2
For more comprehensive information and documentation, see: https://pharmpy.github.io
Pharmpy can be used as a regular Python package, in R via the `pharmr <https://github.com/pharmpy/pharmr>`_ package,
or via its built in command line interface.
If you have any questions or want to discuss with other users and developers in the Pharmpy community, you can go to our
discussion page: https://github.com/pharmpy/pharmpy/discussions
Getting started
===============
Installation
------------
For installation in R, see `pharmr <https://github.com/pharmpy/pharmr>`_.
Install the latest stable version from PyPI:
pip install pharmpy-core # or 'pip3 install' if that is your default python3 pip
Python Example
--------------
.. code-block:: none
>>> from pharmpy.modeling import read_model
>>> from pharmpy.tools import load_example_modelfit_results
>>> model = load_example_model("pheno")
>>> model.parameters
value lower upper fix
POP_CL 0.004693 0.00 ∞ False
POP_VC 1.009160 0.00 ∞ False
COVAPGR 0.100000 -0.99 ∞ False
IIV_CL 0.030963 0.00 ∞ False
IIV_VC 0.031128 0.00 ∞ False
SIGMA 0.013086 0.00 ∞ False
>>> res = load_example_modelfit_results("pheno")
>>> res.parameter_estimates
POP_CL 0.004696
POP_VC 0.984258
COVAPGR 0.158920
IIV_CL 0.029351
IIV_VC 0.027906
SIGMA 0.013241
Name: estimates, dtype: float64
>>>
CLI Example
-----------
.. code-block:: none
# Get help
pharmpy -h
# Remove first ID from dataset and save new model using new dataset
pharmpy data filter run1.mod 'ID!=1'
# Run tool for selecting IIV structure
pharmpy run iivsearch run1.mod
User guide
----------
There is also a `user guide for getting started <https://pharmpy.github.io/latest/getting_started.html>`_
Contact
=======
This is the `team behind Pharmpy <https://pharmpy.github.io/latest/contributors.html>`_
Please ask a question in an issue or contact one of the maintainers if you have any questions.
Contributing
------------
If you interested in contributing to Pharmpy, you can find more information under
`Contribute <https://pharmpy.github.io/latest/contribute.html#contribute>`_.
Raw data
{
"_id": null,
"home_page": "https://pharmpy.github.io",
"name": "pharmpy-core",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "pharmacometrics",
"author": "Rikard Nordgren",
"author_email": "rikard.nordgren@uu.se",
"download_url": "https://files.pythonhosted.org/packages/4a/aa/0a986fbfb9bffe9dfe0b70f32a87f83cda72ecdfe0e8aa36c165cafaa1ad/pharmpy_core-1.9.0.tar.gz",
"platform": null,
"description": "|badge1| |badge2| |badge3| |badge4| |badge5| |badge6|\n\n.. |badge1| image:: https://img.shields.io/pypi/v/pharmpy-core.svg\n :target: https://pypi.org/project/pharmpy-core\n\n.. |badge2| image:: https://img.shields.io/pypi/l/pharmpy-core.svg\n :target: https://github.com/pharmpy/pharmpy/blob/main/LICENSE.LESSER\n\n.. |badge3| image:: https://github.com/pharmpy/pharmpy/actions/workflows/main.yml/badge.svg\n :target: https://github.com/pharmpy/pharmpy/actions\n\n.. |badge4| image:: https://img.shields.io/pypi/pyversions/pharmpy-core\n :target: https://www.python.org/downloads/\n\n.. |badge5| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n\n.. |badge6| image:: https://codecov.io/gh/pharmpy/pharmpy/branch/main/graph/badge.svg?token=JZTHXXQPII\n :target: https://codecov.io/gh/pharmpy/pharmpy\n\n.. _README:\n\n|logo|\n======\n\n.. |logo| image:: https://github.com/pharmpy/pharmpy/raw/main/docs/Pharmpy_logo.svg\n :width: 250\n\nPharmpy is an open-source software package for pharmacometric modeling. It has functionality ranging from reading and\nmanipulating model files and datasets to full tools where subsequent results are collected and presented.\n\nFeatures include:\n\n* A **model abstraction** which splits a model into core components which Pharmpy understands and can manipulate:\n parameters, random variables, statements (including ODE system), dataset, and execution steps\n* An **abstraction for modelfit results** which splits a parsed results into core components: e.g. OFV, parameter\n estimates, relative standard errors (RSEs), residuals, predictions\n* **Functions for manipulation of models and datasets** in the modeling-module: e.g. change structural model, add\n time-after-dose column, add covariate effects\n* **Tools for automated model development**: building various aspects (structural, iiv, iov, ruv, covariates, ...) of PK, PKPD, TMDD and drug-metabolite models automatically\n* **Tools to aid model development** in the tools-module: execution of models within Python/R scripts, bootstrap, \n comparison of estimation methods\n* **Simplify scripting** of workflows. Makes it possible to run scripts including calls to long running tools multiple times without having to rerun already finished tool runs.\n* Support for **multiple estimation tools**: parse NONMEM models, execute NONMEM, nlmixr2, and rxODE2 models, run all\n Pharmpy tools with NONMEM and some with nlmixr2\n\nFor more comprehensive information and documentation, see: https://pharmpy.github.io\n\nPharmpy can be used as a regular Python package, in R via the `pharmr <https://github.com/pharmpy/pharmr>`_ package,\nor via its built in command line interface.\n\nIf you have any questions or want to discuss with other users and developers in the Pharmpy community, you can go to our\ndiscussion page: https://github.com/pharmpy/pharmpy/discussions\n\nGetting started\n===============\n\nInstallation\n------------\n\nFor installation in R, see `pharmr <https://github.com/pharmpy/pharmr>`_.\n\nInstall the latest stable version from PyPI:\n\n pip install pharmpy-core # or 'pip3 install' if that is your default python3 pip\n\nPython Example\n--------------\n\n.. code-block:: none\n\n >>> from pharmpy.modeling import read_model\n >>> from pharmpy.tools import load_example_modelfit_results\n >>> model = load_example_model(\"pheno\")\n >>> model.parameters\n value lower upper fix\n POP_CL 0.004693 0.00 \u221e False\n POP_VC 1.009160 0.00 \u221e False\n COVAPGR 0.100000 -0.99 \u221e False\n IIV_CL 0.030963 0.00 \u221e False\n IIV_VC 0.031128 0.00 \u221e False\n SIGMA 0.013086 0.00 \u221e False\n >>> res = load_example_modelfit_results(\"pheno\")\n >>> res.parameter_estimates\n POP_CL 0.004696\n POP_VC 0.984258\n COVAPGR 0.158920\n IIV_CL 0.029351\n IIV_VC 0.027906\n SIGMA 0.013241\n Name: estimates, dtype: float64\n >>>\n\nCLI Example\n-----------\n\n.. code-block:: none\n\n # Get help\n pharmpy -h\n\n # Remove first ID from dataset and save new model using new dataset\n pharmpy data filter run1.mod 'ID!=1'\n\n # Run tool for selecting IIV structure\n pharmpy run iivsearch run1.mod\n\nUser guide\n----------\n\nThere is also a `user guide for getting started <https://pharmpy.github.io/latest/getting_started.html>`_\n\nContact\n=======\n\nThis is the `team behind Pharmpy <https://pharmpy.github.io/latest/contributors.html>`_\n\nPlease ask a question in an issue or contact one of the maintainers if you have any questions.\n\nContributing\n------------\n\nIf you interested in contributing to Pharmpy, you can find more information under\n`Contribute <https://pharmpy.github.io/latest/contribute.html#contribute>`_.\n",
"bugtrack_url": null,
"license": "GNU Lesser General Public License v3 (LGPLv3)",
"summary": "Pharmacometric modeling",
"version": "1.9.0",
"project_urls": {
"Bug Tracker": "https://github.com/pharmpy/pharmpy/issues",
"Homepage": "https://pharmpy.github.io",
"Source Code": "https://github.com/pharmpy/pharmpy"
},
"split_keywords": [
"pharmacometrics"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "675c13c5073dfd6269253930be398ebf094fbbbb3648ecc22f44b9ff385edb96",
"md5": "75020e66d144637adb9915b25e544aa3",
"sha256": "ffb1cc5cc7524596fe23375ba088635151ddfb5edef89d1ca123099a8ba9d102"
},
"downloads": -1,
"filename": "pharmpy_core-1.9.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "75020e66d144637adb9915b25e544aa3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 966081,
"upload_time": "2025-09-03T14:25:30",
"upload_time_iso_8601": "2025-09-03T14:25:30.429761Z",
"url": "https://files.pythonhosted.org/packages/67/5c/13c5073dfd6269253930be398ebf094fbbbb3648ecc22f44b9ff385edb96/pharmpy_core-1.9.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4aaa0a986fbfb9bffe9dfe0b70f32a87f83cda72ecdfe0e8aa36c165cafaa1ad",
"md5": "8eb415b90f2e96255edc6f57529d2ac8",
"sha256": "2a2a0b220e79ada44a86d8f714ced8f0c72713d3ad16241262939d18ab390332"
},
"downloads": -1,
"filename": "pharmpy_core-1.9.0.tar.gz",
"has_sig": false,
"md5_digest": "8eb415b90f2e96255edc6f57529d2ac8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 3371558,
"upload_time": "2025-09-03T14:25:32",
"upload_time_iso_8601": "2025-09-03T14:25:32.492084Z",
"url": "https://files.pythonhosted.org/packages/4a/aa/0a986fbfb9bffe9dfe0b70f32a87f83cda72ecdfe0e8aa36c165cafaa1ad/pharmpy_core-1.9.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-03 14:25:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pharmpy",
"github_project": "pharmpy",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "alabaster",
"specs": [
[
"==",
"1.0.0"
]
]
},
{
"name": "altair",
"specs": [
[
"==",
"5.5.0"
]
]
},
{
"name": "appdirs",
"specs": [
[
"==",
"1.4.4"
]
]
},
{
"name": "asttokens",
"specs": [
[
"==",
"3.0.0"
]
]
},
{
"name": "attrs",
"specs": [
[
"==",
"25.3.0"
]
]
},
{
"name": "Babel",
"specs": [
[
"==",
"2.17.0"
]
]
},
{
"name": "beautifulsoup4",
"specs": [
[
"==",
"4.13.5"
]
]
},
{
"name": "bleach",
"specs": [
[
"==",
"6.2.0"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2025.8.3"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.4.3"
]
]
},
{
"name": "click",
"specs": [
[
"==",
"8.2.1"
]
]
},
{
"name": "cloudpickle",
"specs": [
[
"==",
"3.1.1"
]
]
},
{
"name": "comm",
"specs": [
[
"==",
"0.2.3"
]
]
},
{
"name": "csscompressor",
"specs": [
[
"==",
"0.9.5"
]
]
},
{
"name": "dask",
"specs": [
[
"==",
"2025.7.0"
]
]
},
{
"name": "debugpy",
"specs": [
[
"==",
"1.8.16"
]
]
},
{
"name": "decorator",
"specs": [
[
"==",
"5.2.1"
]
]
},
{
"name": "defusedxml",
"specs": [
[
"==",
"0.7.1"
]
]
},
{
"name": "distributed",
"specs": [
[
"==",
"2025.7.0"
]
]
},
{
"name": "docutils",
"specs": [
[
"==",
"0.21.2"
]
]
},
{
"name": "executing",
"specs": [
[
"==",
"2.2.1"
]
]
},
{
"name": "fastjsonschema",
"specs": [
[
"==",
"2.21.2"
]
]
},
{
"name": "fsspec",
"specs": [
[
"==",
"2025.7.0"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.10"
]
]
},
{
"name": "imagesize",
"specs": [
[
"==",
"1.4.1"
]
]
},
{
"name": "importlib_metadata",
"specs": [
[
"==",
"8.7.0"
]
]
},
{
"name": "ipykernel",
"specs": [
[
"==",
"6.30.1"
]
]
},
{
"name": "ipython",
"specs": [
[
"==",
"9.5.0"
]
]
},
{
"name": "ipython_pygments_lexers",
"specs": [
[
"==",
"1.1.1"
]
]
},
{
"name": "ipywidgets",
"specs": [
[
"==",
"8.1.7"
]
]
},
{
"name": "itables",
"specs": [
[
"==",
"2.5.1"
]
]
},
{
"name": "jedi",
"specs": [
[
"==",
"0.19.2"
]
]
},
{
"name": "Jinja2",
"specs": [
[
"==",
"3.1.6"
]
]
},
{
"name": "jsonschema",
"specs": [
[
"==",
"4.25.1"
]
]
},
{
"name": "jsonschema-specifications",
"specs": [
[
"==",
"2025.4.1"
]
]
},
{
"name": "jupyter-client",
"specs": [
[
"==",
"8.6.3"
]
]
},
{
"name": "jupyter-core",
"specs": [
[
"==",
"5.8.1"
]
]
},
{
"name": "jupyter-sphinx",
"specs": [
[
"==",
"0.5.3"
]
]
},
{
"name": "jupyterlab-pygments",
"specs": [
[
"==",
"0.3.0"
]
]
},
{
"name": "jupyterlab-widgets",
"specs": [
[
"==",
"3.0.15"
]
]
},
{
"name": "lark",
"specs": [
[
"==",
"1.2.2"
]
]
},
{
"name": "locket",
"specs": [
[
"==",
"1.0.0"
]
]
},
{
"name": "lxml",
"specs": [
[
"==",
"6.0.1"
]
]
},
{
"name": "markdown-it-py",
"specs": [
[
"==",
"4.0.0"
]
]
},
{
"name": "MarkupSafe",
"specs": [
[
"==",
"3.0.2"
]
]
},
{
"name": "matplotlib-inline",
"specs": [
[
"==",
"0.1.7"
]
]
},
{
"name": "mdurl",
"specs": [
[
"==",
"0.1.2"
]
]
},
{
"name": "mistune",
"specs": [
[
"==",
"3.1.4"
]
]
},
{
"name": "mpmath",
"specs": [
[
"==",
"1.3.0"
]
]
},
{
"name": "msgpack",
"specs": [
[
"==",
"1.1.1"
]
]
},
{
"name": "narwhals",
"specs": [
[
"==",
"2.3.0"
]
]
},
{
"name": "nbclient",
"specs": [
[
"==",
"0.10.2"
]
]
},
{
"name": "nbconvert",
"specs": [
[
"==",
"7.16.6"
]
]
},
{
"name": "nbformat",
"specs": [
[
"==",
"5.10.4"
]
]
},
{
"name": "nest-asyncio",
"specs": [
[
"==",
"1.6.0"
]
]
},
{
"name": "networkx",
"specs": [
[
"==",
"3.5"
]
]
},
{
"name": "numexpr",
"specs": [
[
"==",
"2.11.0"
]
]
},
{
"name": "numpy",
"specs": [
[
"==",
"2.3.2"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"25.0"
]
]
},
{
"name": "pandas",
"specs": [
[
"==",
"2.3.2"
]
]
},
{
"name": "pandocfilters",
"specs": [
[
"==",
"1.5.1"
]
]
},
{
"name": "parso",
"specs": [
[
"==",
"0.8.5"
]
]
},
{
"name": "partd",
"specs": [
[
"==",
"1.4.2"
]
]
},
{
"name": "patsy",
"specs": [
[
"==",
"1.0.1"
]
]
},
{
"name": "pexpect",
"specs": [
[
"==",
"4.9.0"
]
]
},
{
"name": "platformdirs",
"specs": [
[
"==",
"4.4.0"
]
]
},
{
"name": "prompt-toolkit",
"specs": [
[
"==",
"3.0.52"
]
]
},
{
"name": "psutil",
"specs": [
[
"==",
"7.0.0"
]
]
},
{
"name": "ptyprocess",
"specs": [
[
"==",
"0.7.0"
]
]
},
{
"name": "pure-eval",
"specs": [
[
"==",
"0.2.3"
]
]
},
{
"name": "Pygments",
"specs": [
[
"==",
"2.19.2"
]
]
},
{
"name": "pyreadr",
"specs": [
[
"==",
"0.5.3"
]
]
},
{
"name": "python-dateutil",
"specs": [
[
"==",
"2.9.0.post0"
]
]
},
{
"name": "pytz",
"specs": [
[
"==",
"2025.2"
]
]
},
{
"name": "pywin32",
"specs": [
[
"!=",
"304"
],
[
">=",
"302"
]
]
},
{
"name": "PyYAML",
"specs": [
[
"==",
"6.0.2"
]
]
},
{
"name": "pyzmq",
"specs": [
[
"==",
"27.0.2"
]
]
},
{
"name": "referencing",
"specs": [
[
"==",
"0.36.2"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.5"
]
]
},
{
"name": "rich",
"specs": [
[
"==",
"14.1.0"
]
]
},
{
"name": "roman-numerals-py",
"specs": [
[
"==",
"3.1.0"
]
]
},
{
"name": "rpds-py",
"specs": [
[
"==",
"0.27.1"
]
]
},
{
"name": "scipy",
"specs": [
[
"==",
"1.16.1"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.17.0"
]
]
},
{
"name": "snowballstemmer",
"specs": [
[
"==",
"3.0.1"
]
]
},
{
"name": "sortedcontainers",
"specs": [
[
"==",
"2.4.0"
]
]
},
{
"name": "soupsieve",
"specs": [
[
"==",
"2.8"
]
]
},
{
"name": "Sphinx",
"specs": [
[
"==",
"8.2.3"
]
]
},
{
"name": "sphinxcontrib-applehelp",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "sphinxcontrib-devhelp",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "sphinxcontrib-htmlhelp",
"specs": [
[
"==",
"2.1.0"
]
]
},
{
"name": "sphinxcontrib-jsmath",
"specs": [
[
"==",
"1.0.1"
]
]
},
{
"name": "sphinxcontrib-qthelp",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "sphinxcontrib-serializinghtml",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "stack-data",
"specs": [
[
"==",
"0.6.3"
]
]
},
{
"name": "statsmodels",
"specs": [
[
"==",
"0.14.5"
]
]
},
{
"name": "symengine",
"specs": [
[
"==",
"0.14.1"
]
]
},
{
"name": "sympy",
"specs": [
[
"==",
"1.14.0"
]
]
},
{
"name": "tblib",
"specs": [
[
"==",
"3.1.0"
]
]
},
{
"name": "tinycss2",
"specs": [
[
"==",
"1.4.0"
]
]
},
{
"name": "toolz",
"specs": [
[
"==",
"1.0.0"
]
]
},
{
"name": "tornado",
"specs": [
[
"==",
"6.5.2"
]
]
},
{
"name": "traitlets",
"specs": [
[
"==",
"5.14.3"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
"==",
"4.15.0"
]
]
},
{
"name": "tzdata",
"specs": [
[
"==",
"2025.2"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.5.0"
]
]
},
{
"name": "wcwidth",
"specs": [
[
"==",
"0.2.13"
]
]
},
{
"name": "webencodings",
"specs": [
[
"==",
"0.5.1"
]
]
},
{
"name": "widgetsnbextension",
"specs": [
[
"==",
"4.0.14"
]
]
},
{
"name": "zict",
"specs": [
[
"==",
"3.0.0"
]
]
},
{
"name": "zipp",
"specs": [
[
"==",
"3.23.0"
]
]
},
{
"name": "tflite_runtime",
"specs": []
},
{
"name": "tflite_runtime",
"specs": []
},
{
"name": "tflite_runtime",
"specs": []
},
{
"name": "tflite_runtime",
"specs": []
},
{
"name": "tflite_runtime",
"specs": []
},
{
"name": "tflite_runtime",
"specs": []
},
{
"name": "tflite_runtime",
"specs": []
}
],
"tox": true,
"lcname": "pharmpy-core"
}