From 60ed8314c8c524df4179043c1a731dfecffe658a Mon Sep 17 00:00:00 2001 From: Phil Chiu Date: Sun, 6 Jun 2021 09:36:34 -0600 Subject: [PATCH 1/5] Add conda recipe --- conda.recipe/build.sh | 9 ++++++++ conda.recipe/meta.yaml | 49 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 conda.recipe/build.sh create mode 100644 conda.recipe/meta.yaml diff --git a/conda.recipe/build.sh b/conda.recipe/build.sh new file mode 100644 index 00000000..deb84884 --- /dev/null +++ b/conda.recipe/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -euo pipefail + +cd ${SRC_DIR} +${PYTHON} -m pip install . -vv + +cd ${SRC_DIR}/baseclasses +${PYTHON} -m pip install . -vv diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml new file mode 100644 index 00000000..44f55bf9 --- /dev/null +++ b/conda.recipe/meta.yaml @@ -0,0 +1,49 @@ +package: + name: pyoptsparse + version: "{{ load_setup_py_data().version }}" + + +source: + - path: ../ + + # Embed mdolab-baseclasses package. + # This is sub-optimal, baseclasses should be provided as a conda package as + # well. This may cause problems if the pyoptsparse is installed into an + # environment which requires other, incompatible versions of baseclasses. + - git_url: https://github.com/mdolab/baseclasses.git + git_rev: v1.5.2 + folder: baseclasses + + +requirements: + build: + - python + - numpy + - swig + - {{ compiler('c')}} + - {{ compiler('cxx')}} + - {{ compiler('fortran') }} + + host: + - python + - numpy + + run: + - python + - numpy + - sqlitedict >=1.6 + - scipy >1.2 + +test: + imports: + - pyoptsparse + + source_files: + - test + + requires: + - testflo + - parameterized + + commands: + - testflo . \ No newline at end of file From a9ad6fcbce53aede825184c2c904b21583690ffa Mon Sep 17 00:00:00 2001 From: Phil Chiu Date: Sun, 6 Jun 2021 09:37:10 -0600 Subject: [PATCH 2/5] Build ipopt with conda --- conda.recipe/build.sh | 2 +- conda.recipe/meta.yaml | 4 +++- pyoptsparse/pyIPOPT/setup.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/conda.recipe/build.sh b/conda.recipe/build.sh index deb84884..44b94726 100644 --- a/conda.recipe/build.sh +++ b/conda.recipe/build.sh @@ -3,7 +3,7 @@ set -euo pipefail cd ${SRC_DIR} -${PYTHON} -m pip install . -vv +IPOPT_DIR=${CONDA_PREFIX} ${PYTHON} -m pip install . -vv cd ${SRC_DIR}/baseclasses ${PYTHON} -m pip install . -vv diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 44f55bf9..ea06d0c8 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -20,6 +20,7 @@ requirements: - python - numpy - swig + - ipopt - {{ compiler('c')}} - {{ compiler('cxx')}} - {{ compiler('fortran') }} @@ -31,6 +32,7 @@ requirements: run: - python - numpy + - ipopt - sqlitedict >=1.6 - scipy >1.2 @@ -46,4 +48,4 @@ test: - parameterized commands: - - testflo . \ No newline at end of file + - testflo --verbose . \ No newline at end of file diff --git a/pyoptsparse/pyIPOPT/setup.py b/pyoptsparse/pyIPOPT/setup.py index f875ca2e..c2ebf0dc 100644 --- a/pyoptsparse/pyIPOPT/setup.py +++ b/pyoptsparse/pyIPOPT/setup.py @@ -51,7 +51,7 @@ def configuration(parent_package="", top_path=None): "pyipoptcore", FILES, library_dirs=[IPOPT_LIB], - libraries=["ipopt", "coinmumps", "coinmetis", "dl", "m", "blas", "lapack"], + libraries=["ipopt", "mumps_common_seq", "scotchmetis", "dl", "m", "blas", "lapack"], extra_link_args=["-Wl,-rpath,%s -L%s" % (IPOPT_LIB, IPOPT_LIB)], include_dirs=[numpy_include, IPOPT_INC], ) From aa1711d826c309cd34866e5a65f4df8748d92a91 Mon Sep 17 00:00:00 2001 From: Phil Chiu Date: Sun, 6 Jun 2021 13:31:47 -0600 Subject: [PATCH 3/5] Revert changes to pyIOPT setup.py For compatibility with current CI --- pyoptsparse/pyIPOPT/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyoptsparse/pyIPOPT/setup.py b/pyoptsparse/pyIPOPT/setup.py index c2ebf0dc..f875ca2e 100644 --- a/pyoptsparse/pyIPOPT/setup.py +++ b/pyoptsparse/pyIPOPT/setup.py @@ -51,7 +51,7 @@ def configuration(parent_package="", top_path=None): "pyipoptcore", FILES, library_dirs=[IPOPT_LIB], - libraries=["ipopt", "mumps_common_seq", "scotchmetis", "dl", "m", "blas", "lapack"], + libraries=["ipopt", "coinmumps", "coinmetis", "dl", "m", "blas", "lapack"], extra_link_args=["-Wl,-rpath,%s -L%s" % (IPOPT_LIB, IPOPT_LIB)], include_dirs=[numpy_include, IPOPT_INC], ) From 46a03ee2a89237ff5697003f04e047b4bc71d68a Mon Sep 17 00:00:00 2001 From: Phil Chiu Date: Sun, 6 Jun 2021 13:40:59 -0600 Subject: [PATCH 4/5] Add patch to conda recipe --- conda.recipe/meta.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index ea06d0c8..58f42843 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -5,6 +5,8 @@ package: source: - path: ../ + - patches: + - patch-IPOPT-setup-for-conda.patch # Embed mdolab-baseclasses package. # This is sub-optimal, baseclasses should be provided as a conda package as From 4ba79c3016e6ece6a9c304f42f7e1791a776ebe4 Mon Sep 17 00:00:00 2001 From: Phil Chiu Date: Sun, 6 Jun 2021 14:21:13 -0600 Subject: [PATCH 5/5] Commit the patch --- conda.recipe/patch-IPOPT-setup-for-conda.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 conda.recipe/patch-IPOPT-setup-for-conda.patch diff --git a/conda.recipe/patch-IPOPT-setup-for-conda.patch b/conda.recipe/patch-IPOPT-setup-for-conda.patch new file mode 100644 index 00000000..69f94934 --- /dev/null +++ b/conda.recipe/patch-IPOPT-setup-for-conda.patch @@ -0,0 +1,13 @@ +diff --git a/pyoptsparse/pyIPOPT/setup.py b/pyoptsparse/pyIPOPT/setup.py +index f875ca2..c2ebf0d 100644 +--- a/pyoptsparse/pyIPOPT/setup.py ++++ b/pyoptsparse/pyIPOPT/setup.py +@@ -51,7 +51,7 @@ def configuration(parent_package="", top_path=None): + "pyipoptcore", + FILES, + library_dirs=[IPOPT_LIB], +- libraries=["ipopt", "coinmumps", "coinmetis", "dl", "m", "blas", "lapack"], ++ libraries=["ipopt", "mumps_common_seq", "scotchmetis", "dl", "m", "blas", "lapack"], + extra_link_args=["-Wl,-rpath,%s -L%s" % (IPOPT_LIB, IPOPT_LIB)], + include_dirs=[numpy_include, IPOPT_INC], + )