diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f453bbd3..161a4ff6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -30,7 +30,7 @@ jobs: channels: conda-forge miniforge-variant: Mambaforge - name: Install basic dependencies - run: mamba install -y -v lapack "libblas=*=*netlib" cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 --file docs/requirements.txt + run: mamba install -y -v lapack "libblas=*=*netlib" "cython>=0.26,<3" "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 --file docs/requirements.txt - name: Install CyIpopt run: | rm pyproject.toml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3a279636..dae49dcd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,7 +35,8 @@ jobs: miniforge-variant: Mambaforge - name: Install basic dependencies run: | - mamba install -q -y lapack "libblas=*=*netlib" cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 + mamba install -q -y lapack "libblas=*=*netlib" "ipopt=${{ matrix.ipopt-version }}" "numpy>=1.15" "pkg-config>=0.29.2" "setuptools>=39.0" "cython=0.29.*" + - run: echo "IPOPTWINDIR=USECONDAFORGEIPOPT" >> $GITHUB_ENV - name: Install CyIpopt run: | rm pyproject.toml @@ -45,7 +46,7 @@ jobs: run: | python -c "import cyipopt" mamba remove lapack - mamba install -q -y cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 pytest>=3.3.2 + mamba install -q -y "ipopt=${{ matrix.ipopt-version }}" "numpy>=1.15" "pkg-config>=0.29.2" "setuptools>=39.0" "pytest>=3.3.2" "cython=0.29.*" mamba list pytest - name: Test with pytest and scipy, new ipopt @@ -54,6 +55,6 @@ jobs: # Ipopt needed different libfortrans. if: (matrix.ipopt-version != '3.12' && matrix.python-version != '3.11') || (matrix.ipopt-version != '3.12' && matrix.python-version != '3.10' && matrix.os != 'macos-latest') run: | - mamba install -q -y -c conda-forge "cython>=0.26" "ipopt=${{ matrix.ipopt-version }}" "numpy>=1.15" "pkg-config>=0.29.2" "setuptools>=39.0" "scipy=1.9.*" "pytest>=3.3.2" + mamba install -q -y -c conda-forge "ipopt=${{ matrix.ipopt-version }}" "numpy>=1.15" "pkg-config>=0.29.2" "setuptools>=39.0" "scipy=1.9.*" "pytest>=3.3.2" "cython=0.29.*" mamba list pytest diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 00000000..97f00633 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,26 @@ +name: windows + +on: [push, pull_request] + +# cancels prior builds for this workflow when new commit is pushed +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Manually install on Windows with Ipopt binaries + runs-on: windows-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - run: python -m pip install numpy "cython<3" setuptools + - run: Invoke-WebRequest -Uri "https://github.com/coin-or/Ipopt/releases/download/releases%2F3.13.3/Ipopt-3.13.3-win64-msvs2019-md.zip" -OutFile "Ipopt-3.13.3-win64-msvs2019-md.zip" + - run: 7z x Ipopt-3.13.3-win64-msvs2019-md.zip + - run: mv Ipopt-3.13.3-win64-msvs2019-md/* . + - run: python setup.py install + - run: python examples/hs071.py diff --git a/setup.py b/setup.py index 50d47953..28a29049 100644 --- a/setup.py +++ b/setup.py @@ -185,10 +185,18 @@ def handle_ext_modules_general_os(): # environment variable is set to USECONDAFORGEIPOPT then this setup will be # run. if sys.platform == "win32" and ipoptdir == "USECONDAFORGEIPOPT": + print('Using Conda Forge Ipopt on Windows.') ext_module_data = handle_ext_modules_win_32_conda_forge_ipopt() elif sys.platform == "win32" and ipoptdir: + print('Using Ipopt in {} directory on Windows.'.format(ipoptdir)) + ext_module_data = handle_ext_modules_win_32_other_ipopt() + elif sys.platform == "win32" and not ipoptdir: + ipoptdir = os.path.abspath(os.path.dirname(__file__)) + msg = 'Using Ipopt adjacent to setup.py in {} on Windows.' + print(msg.format(ipoptdir)) ext_module_data = handle_ext_modules_win_32_other_ipopt() else: + print('Using Ipopt found with pkg-config.') ext_module_data = handle_ext_modules_general_os() EXT_MODULES, DATA_FILES, include_package_data = ext_module_data # NOTE : The `name` kwarg here is the distribution name, i.e. the name that