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

Build wheels automatically in CI environment #168

Merged
merged 80 commits into from
Jan 30, 2020

Conversation

mtreinish
Copy link
Member

@mtreinish mtreinish commented Apr 23, 2019

Summary

Right now when it's time to push a relase of qiskit-aer we have to
manually build wheels for all our supported environments because we
included compiled code in the project. This involves setting up a proper
environment with portable librariers and compilers in Linux, Windows,
and Mac OSX with all 4 versions of python we support. Then manually
building the 12 wheels necessary to publish on pypi. There is no reason
this manual step needs to exist and we can just leverage CI to do our
wheel building when it's time to do a release.

This commit adds initial support for building our wheels in travis
(for linux and osx) and azure pipelines (for windows). It leverages the
cibuildwheel project to automate the wheel building on linux and osx. This
will ensure we setup the proper environment for all 4 python versions on
both environments (for example pulling in the manylinux docker container on
linux). For windows it leverages conda to setup a fresh environment for each
python version instead of using cibuildwheel because of specific configuration
needed there.

Details and comments

TODO:

  • Add windows builds with azure-pipelines
  • Debug wheel building process until it succeeds
  • Uncomment tag conditions and twine upload to pypi.org

@mtreinish
Copy link
Member Author

The build process for linux (and I assume osx and windows once I start debugging that) is blocked by #172 because cibuildwheel uses venvs to created isolated python environments. If we can't build the sdist into a wheel inside a venv than it's going to fail every time.

@mtreinish
Copy link
Member Author

Well 1/3 of the way there. The osx wheels built successfully: https://travis-ci.com/Qiskit/qiskit-aer/jobs/229330750

@chriseclectic
Copy link
Member

@mtreinish are you still working on this or should I close this PR?

@mtreinish
Copy link
Member Author

@chriseclectic I am still working on it, higher priority work has come up since my last update here. I'm planning to circle back to it eventually.

@mtreinish
Copy link
Member Author

So the current state of this is that windows builds are failing on find_blas. Even after manually installing openblas from source and also installing a copy via anaconda. The linux builds are failing because it's trying to link against libpython which is explicitly prohibited by the manylinux 2010 (and manylinux1) specifications. Details on that can be found here: https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1 and https://www.python.org/dev/peps/pep-0571/#the-manylinux2010-policy

It looks like to move forward on here we'll have to change the linux builds to not link against libpython and for windows figure out why find_blas can't find either openblas installation.

@mtreinish mtreinish force-pushed the automate-wheel-build branch from d426f3d to d6018e0 Compare November 12, 2019 19:39
@atilag
Copy link
Member

atilag commented Dec 28, 2019

Ok, now that we've merged pybin11 support and that we took advantage of it to change the way we were linking the extensions, we shall have no problems with libpython anymore. I'll resume this PR asap and fix the remaining issues.

@mtreinish mtreinish force-pushed the automate-wheel-build branch 2 times, most recently from 589a883 to 2bcc5c2 Compare January 3, 2020 22:22
@mtreinish
Copy link
Member Author

Finally, the linux builds are working now. OSX is working as well except for python 3.8:

https://travis-ci.com/Qiskit/qiskit-aer/jobs/273238792#L1023

which looks like it's related to what was fixed in: Qiskit/qiskit@af390a8

Windows also still needs work it's not finding openblas right now:

https://dev.azure.com/qiskit-ci/qiskit-aer/_build/results?buildId=6841&view=logs&j=88076fea-ae17-5b87-3f51-0f9c840a5695&t=4e9c5838-9918-5d21-d580-b0d6b55ac95f&l=242

@mtreinish mtreinish mentioned this pull request Jan 17, 2020
13 tasks
@mtreinish mtreinish force-pushed the automate-wheel-build branch 3 times, most recently from bee2c36 to 96b84ce Compare January 23, 2020 19:52
Right now when it's time to push a relase of qiskit-aer we have to
manually build wheels for all our supported environments because we
included compiled code in the project. This involves setting up a proper
environment with portable librariers and compilers in Linux, Windows,
and Mac OSX with all 3 versions of python we support. Then manually
building the 9 wheels necessary to publish on pypi. There is no reason
this manual step needs to exist and we can just leverage CI to do our
wheel building when it's time to do a release.

This commit adds initial support for building our wheels in travis
(for linux and osx) and appveyor (for windows). It leverages the
cibuildwheel project to automate the wheel building. This will ensure we
setup the proper environment for all 3 python versions on all 3
environments (for example pulling in the manylinux docker container on
linux).
@mtreinish mtreinish force-pushed the automate-wheel-build branch from 1fa5bb8 to f8279e4 Compare January 24, 2020 20:29
@mtreinish
Copy link
Member Author

After merging the openpulse branch onto master things are failing on linux and windows now.

@atilag it looks like the linux failure is because things are attempting to link against libpython again: https://travis-ci.com/Qiskit/qiskit-aer/jobs/280091283#L615 we need to fix this.

@atilag
Copy link
Member

atilag commented Jan 30, 2020

Yep, Cython code from Open Pulse sim branch was still being linked against libpython, but I have already fix it on master after merging #550 . That shouldn't be a problem now.

Now that we've finally debugged the wheel build process on all python
versions across all 3 supported OSes it's time to prepare this job for
actually automating wheel publishing at release. This commit does 2
things first it makes all the new jobs conditional so they only run on
new tags (ie a release). The second thing it does is uncomment the twine
upload section. Now after each job finishes it's wheel build it will
upload those files to pypi automatically.
@mtreinish mtreinish changed the title [WIP] Build wheels automatically in CI environment Build wheels automatically in CI environment Jan 30, 2020
@mtreinish
Copy link
Member Author

Ok, everything here is finally working now that #550 merged. All the wheel builds succeeded on ea96598 so this is finally ready to go. I've removed the WIP from the PR title and made all the jobs only run on tags/releases. After this merges I will go into the travis and azure UI and set the password for twine as a secret so that for releases CI will automatically build and upload wheels.

If anyone is curious azure enables us to upload artifacts, the windows wheels that were built can be found here: https://dev.azure.com/qiskit-ci/qiskit-aer/_build/results?buildId=7712&view=artifacts&type=publishedArtifacts (it's the zip file labeled drop)

atilag
atilag previously approved these changes Jan 30, 2020
Copy link
Member

@atilag atilag left a comment

Choose a reason for hiding this comment

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

Finally here!! Automation, welcome :D

.travis.yml Outdated Show resolved Hide resolved
@atilag atilag merged commit 65474a0 into Qiskit:master Jan 30, 2020
@mtreinish mtreinish deleted the automate-wheel-build branch January 31, 2020 00:32
mtreinish added a commit to mtreinish/qiskit-aer that referenced this pull request Jan 31, 2020
In the recently merged Qiskit#168 a small oversight was made in the last
revision to that PR. The name of the stage was updated from wheels to
deploy, but the stage listed for the individual jobs was never updated.
This commit corrects the oversight and uses a consistent stage name for
the new jobs.
chriseclectic pushed a commit that referenced this pull request Jan 31, 2020
In the recently merged #168 a small oversight was made in the last
revision to that PR. The name of the stage was updated from wheels to
deploy, but the stage listed for the individual jobs was never updated.
This commit corrects the oversight and uses a consistent stage name for
the new jobs.
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.

3 participants