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

Cherry-pick #18745 to 7.x: Fix bdist during installation of Python requirements #19905

Merged
merged 1 commit into from
Jul 14, 2020

Conversation

marc-gr
Copy link
Contributor

@marc-gr marc-gr commented Jul 14, 2020

Cherry-pick of PR #18745 to 7.x branch. Original message:

What does this PR do?

This PR addresses an issue in the build system which produces errors similar to the following:

09:10:15  Building wheels for collected packages: autopep8, backports.ssl-match-hostname, dockerpty, docopt, ipaddress, MarkupSafe, nose-timer, PyYAML, termcolor, texttable, jsondiff, stomp.py, ordered-set
09:10:15    Running setup.py bdist_wheel for autopep8: started
09:10:15    Running setup.py bdist_wheel for autopep8: finished with status 'error'
09:10:15    Complete output from command /tmp/tmp.mtLXh51exX/python-env/build/ve/linux/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-a_wqse9r/autopep8/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpxy52gjolpip-wheel- --python-tag cp36:
09:10:15    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
09:10:15       or: -c --help [cmd1 cmd2 ...]
09:10:15       or: -c --help-commands
09:10:15       or: -c cmd --help
09:10:15    
09:10:15    error: invalid command 'bdist_wheel'
09:10:15    
09:10:15    ----------------------------------------
09:10:15    Failed building wheel for autopep8
09:10:15    Running setup.py clean for autopep8
09:10:15    Running setup.py bdist_wheel for backports.ssl-match-hostname: started
09:10:16    Running setup.py bdist_wheel for backports.ssl-match-hostname: finished with status 'error'
09:10:16    Complete output from command /tmp/tmp.mtLXh51exX/python-env/build/ve/linux/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-a_wqse9r/backports.ssl-match-hostname/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpzd52u8z1pip-wheel- --python-tag cp36:
09:10:16    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
09:10:16       or: -c --help [cmd1 cmd2 ...]
09:10:16       or: -c --help-commands
09:10:16       or: -c cmd --help
09:10:16    
09:10:16    error: invalid command 'bdist_wheel'

Note that these errors are from the APM CI where they have been discovered in builds for the APM Server project but the source of the errors appears to stem from libbeat.

A full discussion and background on this issue can be found here: elastic/apm-server#3661

Cause and resolution

I believe this may have been introduced during the migration to Python 3 but I don't have a test history that goes back far enough to confirm this.

This is a difficult-to-reproduce problem and I have yet to be able to do so locally. However, it seems clear that the issue is that the wheel Python package needs to be present in order for the wheels to be created. This fix attempts to simply simply tell pip to install wheel into the newly-created virtual environment before it proceeds with installing packages from the requirements file.

Why is it important?

Fixes errors found in the CI on package which depend on libbeat.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

I haven't found a way to just run the PythonVirtualenv target with mage but I did run mage pythonUnitTest which does seem to exercise this code path.

Related issues

* Fix bdist/wheel errors on build

* Use independent args

* Formatting

* Remove -r

* Collapse into single line

* Update dev-tools/mage/pytest.go

Co-authored-by: Andrew Kroh <[email protected]>

Co-authored-by: Andrew Kroh <[email protected]>
(cherry picked from commit 10a2ce9)
@marc-gr marc-gr added [zube]: In Review backport Team:Automation Label for the Observability productivity team labels Jul 14, 2020
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jul 14, 2020
@andrewkroh andrewkroh merged commit 06b353b into elastic:7.x Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Automation Label for the Observability productivity team [zube]: Done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants