Skip to content

Commit b884f91

Browse files
authored
Use swig from PyPI (#2774)
Use swig from PyPI (https://github.com/nightlark/swig-pypi / https://pypi.org/project/swig/) instead of requiring a system installation. Closes #2737.
1 parent 3f1c6e7 commit b884f91

File tree

9 files changed

+18
-21
lines changed

9 files changed

+18
-21
lines changed

.github/actions/install-apt-dependencies/action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ runs:
1111
libboost-chrono-dev \
1212
libboost-math-dev \
1313
libboost-serialization-dev \
14-
libhdf5-serial-dev \
15-
swig
14+
libhdf5-serial-dev
1615
shell: bash

.github/actions/install-macos-dependencies/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ runs:
3030
# install hdf5 without dependencies, because pkgconf installation fails,
3131
# because it's already installed on the runners. install the other
3232
# hdf5 dependencies (libaec) manually
33-
run: brew install libaec && brew install --ignore-dependencies hdf5 && brew install swig libomp boost
33+
run: brew install libaec && brew install --ignore-dependencies hdf5 && brew install libomp boost
3434
shell: bash

.github/workflows/test_windows.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ jobs:
5252
- name: Install deps
5353
shell: bash
5454
run: |
55-
python -m pip install --upgrade pip \
56-
&& choco install -y ninja \
57-
&& choco install -y swig
55+
python -m pip install --upgrade pip
5856
5957
- name: Install OpenBLAS
6058
shell: powershell

binder/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ RUN apt-get update && apt-get install -y \
1414
python3-dev \
1515
python3-pip \
1616
python3-venv \
17-
swig \
1817
wget
1918

2019
# BEGIN BINDER

container/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ RUN apt-get update && apt-get install -y \
1212
python3 \
1313
python3-dev \
1414
python3-pip \
15-
python3-venv \
16-
swig
15+
python3-venv
1716

1817
# prepare python install
1918

doc/python_installation.rst

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Short guide
99
Installation of the AMICI Python package has the following prerequisites:
1010

1111
* Python>=3.11
12-
* :term:`SWIG`>=4.1
1312
* CBLAS compatible BLAS library
1413
(e.g., OpenBLAS, CBLAS, Atlas, Accelerate, Intel MKL)
1514
* a C++20 compatible C++ compiler and a C compiler
@@ -50,7 +49,7 @@ Install the AMICI dependencies via ``apt``
5049

5150
.. code-block:: bash
5251
53-
sudo apt install libatlas-base-dev swig python3-dev
52+
sudo apt install libatlas-base-dev python3-dev
5453
5554
# optionally for HDF5 support:
5655
sudo apt install libhdf5-serial-dev
@@ -72,7 +71,7 @@ Install the AMICI dependencies via ``apt``
7271

7372
.. code-block:: bash
7473
75-
sudo dnf install openblas-devel swig
74+
sudo dnf install openblas-devel
7675
7776
Install AMICI:
7877

@@ -88,7 +87,7 @@ Install the AMICI dependencies via ``pacman``
8887

8988
.. code-block:: bash
9089
91-
sudo pacman -S python swig openblas gcc hdf5 boost-libs
90+
sudo pacman -S python openblas gcc hdf5 boost-libs
9291
9392
Export the bash variables ``BLAS_CFLAGS`` and ``BLAS_LIBS`` to point to where BLAS was installed, e.g.:
9493

@@ -109,13 +108,13 @@ Alternatively:
109108

110109
.. code-block:: bash
111110
112-
sudo pacman -Si python swig openblas gcc hdf5 boost-libs
111+
sudo pacman -Si python openblas gcc hdf5 boost-libs
113112
114113
2. Upgrade installed packages if required mininum versions are not satisfied for AMICI installation.
115114

116115
.. code-block:: bash
117116
118-
sudo pacman -Su python swig openblas gcc hdf5 boost-libs
117+
sudo pacman -Su python openblas gcc hdf5 boost-libs
119118
120119
3. Export the bash variables ``BLAS_CFLAGS`` and ``BLAS_LIBS`` to point to where BLAS was installed, e.g.:
121120

@@ -138,8 +137,6 @@ Install the AMICI dependencies using homebrew:
138137

139138
.. code-block:: bash
140139
141-
brew install swig
142-
143140
# optionally for HDF5 support:
144141
brew install hdf5
145142
@@ -399,8 +396,7 @@ To activate the environment, run:
399396
400397
(and ``conda deactivate`` later to deactivate it again).
401398

402-
:term:`SWIG` must be installed and available in your ``PATH``, and a
403-
CBLAS-compatible BLAS must be available. You can also use conda to
399+
A CBLAS-compatible BLAS must be available. You can also use conda to
404400
install the latter locally, using:
405401

406402
.. code-block:: bash

python/sdist/pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ requires = [
66
"wheel",
77
"numpy>=2.0",
88
"cmake-build-extension==0.6.0",
9+
"swig",
910
]
1011
build-backend = "setuptools.build_meta"
1112

@@ -27,6 +28,7 @@ dependencies = [
2728
"toposort",
2829
"setuptools>=48",
2930
"mpmath",
31+
"swig"
3032
]
3133
license = "BSD-3-Clause"
3234
authors = [

scripts/buildAmici.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ fi
4848

4949
# set python executable for cmake
5050
export PYTHON_EXECUTABLE="${amici_path}/venv/bin/python"
51-
python3 -m pip install numpy
51+
python3 -m pip install numpy swig
52+
export SWIG=$(which swig)
5253

5354
suitesparse_root="${amici_path}/ThirdParty/SuiteSparse"
5455

scripts/installAmiciSource.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ fi
3333
export PYTHON_EXECUTABLE="${AMICI_PATH}/venv/bin/python"
3434

3535
python -m pip install --upgrade pip wheel
36-
python -m pip install --upgrade pip setuptools cmake_build_extension==0.6.0 numpy petab
36+
# we need to install all build-system.requires manually, because of
37+
# --no-build-isolation below.
38+
# The latter is necessary for code coverage to work.
39+
python -m pip install --upgrade pip setuptools cmake_build_extension==0.6.0 numpy petab swig
3740
python -m pip install git+https://github.com/pysb/pysb@master # for SPM with compartments
3841
AMICI_BUILD_TEMP="${AMICI_PATH}/python/sdist/build/temp" \
3942
python -m pip install --verbose -e "${AMICI_PATH}/python/sdist[petab,test,vis,jax]" --no-build-isolation

0 commit comments

Comments
 (0)