Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script for building manylinux wheels #189

Merged
merged 7 commits into from
Mar 9, 2023
Merged

Conversation

nrontsis
Copy link
Contributor

@nrontsis nrontsis commented Feb 21, 2023

Adds scripts to build manylinux wheels as discussed in #41 (comment)

Tested to work with https://github.com/nrontsis/cyipopt tag patch-3, to include the fix of #188.


Discussion points from #41:

  • I'd prefer if it built from source release tarballs (ipopt, etc.) than from git checkouts for the specific versions you select. This will at least enable some binary installs using pip.

I am not sure I understand, but I would rather rely on building ipopt and mumps from source, so that we have recent versions (with binaries built within the manylinux docker image and thus maximise compatibility), instead of relying on outdated versions from the distro used. Note that the distro used by the manylinux docker image is purposefully quite old.

  • for openblas, I typically build against the netlib version of blas so that users can dynamically switch their blas implementation. Do we have to package openblas in the wheel? Or would it be fine to avoid that. It would be interesting to know if numpy wheels include it. If so, can we rely on whatever NumPy supplies? That should always be present since we have NumPy as a dependency.

I chose to continue linking with openblas, as this is what numpy/scipy does and it's unclear to me how or if dynamic linking against another blas library would happen in conjuction with the loading hacks of auditwheels that we use.

  • For openblas we may need to rename it

I think this might already be done for us via audit wheels? Here are the libraries included in the generated wheels from this pr:

$ ls -lh cyipopt.libs
total 92968
-rwxr-xr-x  1 work  staff   2.7M 21 Feb 23:11 libcoinmumps-2ebffd84.so.3.0.4
-rwxr-xr-x  1 work  staff   2.6M 21 Feb 23:11 libgfortran-ce9df58f.so.5.0.0
-rwxr-xr-x  1 work  staff   2.8M 21 Feb 23:11 libipopt-e3a6f34c.so.3.14.11
-rwxr-xr-x  1 work  staff    37M 21 Feb 23:11 libopenblas-r0-44846fb5.3.15.so
-rwxr-xr-x  1 work  staff   266K 21 Feb 23:11 libquadmath-aa18d9dd.so.0.0.0

@nrontsis nrontsis marked this pull request as ready for review February 21, 2023 23:27
git clone https://github.com/mechmotum/cyipopt --depth=1 --branch $TAG
pushd cyipopt
mkdir dist
for PYVERSION in "cp311-cp311" "cp310-cp310" "cp39-cp39" "cp38-cp38" "pp39-pypy39_pp73" "pp38-pypy38_pp73" ; do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also support for python 3.7 in this manylinux docker image, but building on python 3.7 was failing with:

  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
      /tmp/cyipopt/setup.py:26: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated. Requirements should be satisfied by a PEP 517 installer. If you are using pip, you can try `pip install --use-pep517`.
        dist.Distribution().fetch_build_eggs(SETUP_REQUIRES)
      WARNING: The wheel package is not available.
      /opt/_internal/cpython-3.7.16/bin/python: No module named pip
      Traceback (most recent call last):
        File "/tmp/pip-build-env-gdt5mhcy/overlay/lib/python3.7/site-packages/setuptools/installer.py", line 97, in _fetch_build_egg_no_warn
          subprocess.check_call(cmd)
        File "/opt/_internal/cpython-3.7.16/lib/python3.7/subprocess.py", line 363, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/opt/_internal/cpython-3.7.16/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmppqmsycvd', '--quiet', 'numpy>=1.15']' returned non-zero exit status 1.
      
      The above exception was the direct cause of the following exception:
      
      Traceback (most recent call last):
        File "/opt/_internal/cpython-3.7.16/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/opt/_internal/cpython-3.7.16/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/opt/_internal/cpython-3.7.16/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-gdt5mhcy/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-gdt5mhcy/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-gdt5mhcy/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 26, in <module>
        File "/tmp/pip-build-env-gdt5mhcy/overlay/lib/python3.7/site-packages/setuptools/dist.py", line 894, in fetch_build_eggs
          return _fetch_build_eggs(self, requires)
        File "/tmp/pip-build-env-gdt5mhcy/overlay/lib/python3.7/site-packages/setuptools/installer.py", line 42, in _fetch_build_eggs
          replace_conflicting=True,
        File "/tmp/pip-build-env-gdt5mhcy/overlay/lib/python3.7/site-packages/pkg_resources/__init__.py", line 816, in resolve
          req, best, replace_conflicting, env, installer, required_by, to_activate
        File "/tmp/pip-build-env-gdt5mhcy/overlay/lib/python3.7/site-packages/pkg_resources/__init__.py", line 852, in _resolve_dist
          req, ws, installer, replace_conflicting=replace_conflicting
        File "/tmp/pip-build-env-gdt5mhcy/overlay/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1123, in best_match
          return self.obtain(req, installer)
        File "/tmp/pip-build-env-gdt5mhcy/overlay/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1135, in obtain
          return installer(requirement)
        File "/tmp/pip-build-env-gdt5mhcy/overlay/lib/python3.7/site-packages/setuptools/installer.py", line 99, in _fetch_build_egg_no_warn
          raise DistutilsError(str(e)) from e
      distutils.errors.DistutilsError: Command '['/opt/_internal/cpython-3.7.16/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmppqmsycvd', '--quiet', 'numpy>=1.15']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 23.0 -> 23.0.1
[notice] To update, run: /opt/_internal/cpython-3.7.16/bin/python -m pip install --upgrade pip

popd

# build cyipopt for many python versions
git clone https://github.com/mechmotum/cyipopt --depth=1 --branch $TAG
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean by the release tarballs is to download https://files.pythonhosted.org/packages/4c/34/180b14dc521ae6a393c98d74d59afc79a7edc19a18721b69571843bfc495/cyipopt-1.2.0.tar.gz and extract it instead of checkout out a commit in the git repo.



# Ipopt (The solver itself)
git clone https://github.com/coin-or/Ipopt --depth=1 --branch releases/3.14.11
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you just yum install ipopt? Seems like either 3.13 or 3.14 are available: https://packages.fedoraproject.org/pkgs/coin-or-Ipopt/coin-or-Ipopt/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you say "but I would rather rely on building ipopt and mumps from source, so that we have recent versions".

@moorepants
Copy link
Collaborator

For the licenses, we have to bundle the licenses for any of the libs we distribute in the wheel assuming that they are only permissive licenses. If any are GPL I think we have to release the whole wheel as GPL.

@moorepants
Copy link
Collaborator

libgfortran looks like it is GPL: https://en.wikipedia.org/wiki/GNU_Fortran so that's a bit problematic when redistributing.

@moorepants
Copy link
Collaborator

moorepants commented Feb 22, 2023

I'll merge this if you set it up to bundle the licenses for the bundled libs. This is a PR where scipy did it: MacPython/scipy-wheels#5

EDIT: and long thread seeing how the conversation/debate goes on these things: scipy/scipy#7093

@nrontsis
Copy link
Contributor Author

I'll merge this if you set it up to bundle the licenses for the bundled libs. This is a PR where scipy did it: MacPython/scipy-wheels#5

Done. Thanks for the interesting link on the licensing debate.

@moorepants
Copy link
Collaborator

Thanks for this.

@moorepants moorepants merged commit 86a015b into mechmotum:master Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants