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 fixes: query numpy path directly; setup pyproject.toml for pip #67

Merged
merged 2 commits into from
Jun 21, 2019

Conversation

roryyorke
Copy link
Collaborator

This is intended to fix #3, #63, and #65. It works on Ubuntu 18.04, I'll still try to test it on Windows 10. I don't have an iOS (MacOS? OSX? ... ) machine to test on.

The test is to prepare a source tarball with python setup.py sdist -- this needs numpy and scikit-build. Then, in a fresh environment without those packages, or anything other than pip, run pip install slycot.0.3.blah.tar.gz (substitute version number for blah). pip install . might be the same thing, I'm not sure.

@jakevdp
Copy link
Contributor

jakevdp commented Jun 18, 2019

I'm not sure what the issue is, but I get an error when running pip install . on this branch in a clean VM

$ pip install .
Processing /content/Slycot
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
ERROR: Command "/usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp2l0ltqp8" failed with error code 1 in /tmp/pip-req-build-yzrxe9ke

@jakevdp
Copy link
Contributor

jakevdp commented Jun 18, 2019

It succeeds if I remove pyproject.toml (as long as I've pre-installed all the build deps)

@jakevdp
Copy link
Contributor

jakevdp commented Jun 18, 2019

For completeness:

$ pip --version
pip 19.1.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
$ python -c "import wheel; print(wheel.__version__)"
0.33.4

@jakevdp
Copy link
Contributor

jakevdp commented Jun 18, 2019

Ah, ran with --verbose and got more info about the error:

$ pip install git+https://github.com/roryyorke/Slycot@rory/more-build-fixes --verbose
<!-- snip --> 
Running command /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpwymdjbra
  Traceback (most recent call last):
    File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
      main()
    File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py", line 54, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/usr/local/lib/python3.6/dist-packages/setuptools/build_meta.py", line 145, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/usr/local/lib/python3.6/dist-packages/setuptools/build_meta.py", line 126, in _get_build_requires
      self.run_setup()
    File "/usr/local/lib/python3.6/dist-packages/setuptools/build_meta.py", line 234, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/usr/local/lib/python3.6/dist-packages/setuptools/build_meta.py", line 141, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 295, in <module>
      setup_package()
    File "setup.py", line 228, in setup_package
      VERSION, gitrevision = get_version_info(src_path)
    File "setup.py", line 153, in get_version_info
      FULLVERSION, GIT_REVISION, GIT_CYCLE = git_version(srcdir)
    File "setup.py", line 101, in git_version
      out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'], srcdir)
    File "setup.py", line 94, in _minimal_ext_cmd
      % (proc.returncode, errmsg))
  __main__.GitError: git err; return code 128, error message:
    'fatal: not a git repository (or any of the parent directories): .git'
  Getting requirements to build wheel ... error
<!-- snip --> 

Looks like the root of the issue is in the setup.py method that generates git hash versions.

@roryyorke
Copy link
Collaborator Author

Thanks for that - I could reproduce with pip install git+file:///(etc). setup.py was trying to determine the source path (for git invocation) from sys.argv[0], which ended up being some script in Python's site-package; setup.py now uses __file__ to find itself.

@jakevdp
Copy link
Contributor

jakevdp commented Jun 19, 2019

Great! Confirmed I can now pip install slycot directly from this branch without issues.

@jakevdp
Copy link
Contributor

jakevdp commented Jun 19, 2019

It might be worth testing this in travis - I think it would be sufficient to replace python setup.py install with pip install ., and I don't think you'd lose any coverage with that change.

@roryyorke
Copy link
Collaborator Author

conda build -c conda-forge conda-recipe-openblas still works on Windows with this branch. I couldn't get a non-Conda build (i.e., pip install) to work, but I don't think it ever has.

@roryyorke roryyorke merged commit a344813 into python-control:master Jun 21, 2019
@roryyorke roryyorke deleted the rory/more-build-fixes branch June 21, 2019 19:00
This was referenced Jun 21, 2019
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.

express dependencies in setup.py
2 participants