Skip to content

express dependencies in setup.py #3

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

Closed
slivingston opened this issue Aug 24, 2016 · 6 comments · Fixed by #67
Closed

express dependencies in setup.py #3

slivingston opened this issue Aug 24, 2016 · 6 comments · Fixed by #67
Assignees
Labels

Comments

@slivingston
Copy link
Member

setup.py does not describe required packages to build and install slycot.

The motivated error occurs when numpy is not present. I found the following after pip install slycot:

Building wheels for collected packages: slycot
  Running setup.py bdist_wheel for slycot ... error
  Complete output from command /home/scott/tmp/f00f/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-SRAJ87/slycot/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpAzLVXPpip-wheel- --python-tag cp27:
  Running from numpy source directory.
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-SRAJ87/slycot/setup.py", line 240, in <module>
      setup_package()
    File "/tmp/pip-build-SRAJ87/slycot/setup.py", line 225, in setup_package
      from numpy.distutils.core import setup
  ImportError: No module named numpy.distutils.core
@MaxGaukler
Copy link

If the dependencies are not specified in setup.py, it is impossible to install slycot via pip install -r requirements.txt, even if you add all dependencies to requirements.txt, because the build fails if scikit-build isn't installed before slycot.

Therefore we should at least add setup_requires=['scikit-build'].

@moorepants
Copy link
Contributor

moorepants commented May 23, 2019

Seems reasonable to add setup_requires. Here is the description from the setuptools docs:

setup_requires

A string or list of strings specifying what other distributions need to be present in order for the setup script to run. setuptools will attempt to obtain these (even going so far as to download them using EasyInstall) before processing the rest of the setup script or commands. This argument is needed if you are using distutils extensions as part of your build process; for example, extensions that process setup() arguments and turn them into EGG-INFO metadata files.

(Note: projects listed in setup_requires will NOT be automatically installed on the system where the setup script is being run. They are simply downloaded to the ./.eggs directory if they’re not locally available already. If you want them to be installed, as well as being available when the setup script is run, you should add them to install_requires and setup_requires.)

@roryyorke
Copy link
Collaborator

Closed issue #61 is pretty much the same thing as this. I just installed numpy, scikit-build, and slycot (in that order) in a clean virtual-env; pip claimed to have installed slycot, but as in #63 I then get "No module named 'slycot'", so I get the idea we don't have an install-from-pip capability.

Specific to this issue: if we add scikit-build to 'setup-requires', does that mean The Right Thing would happen if we installed from pip, i.e., it would first install scikit-build?

What does this have to do with requirements.txt? When would we use that?

And finally, is there a way we can test this without uploading wheels to PyPI?

@roryyorke
Copy link
Collaborator

My current test method is, in a venv with numpy and scikit-build installed, to build a source distribution, and then, in a venv without numpy and scikit-build, run pip install slycot-<version>.tar.gz.

So far this fails with the following:

  • setup_requires=['scikit-build'] added to metadata in setup.py
  • the following added to setup.cfg.in
[options]
setup_requires =
  numpy
  scikit-build

I see scikit-build recommend using pyproject.toml on their page, but setuptools docs say that setup.cfg has "broader compatibility".

@roryyorke
Copy link
Collaborator

On this branch https://github.com/roryyorke/Slycot/tree/rory/pip-fixes I can generate an sdist and then install it with pip, but "python setup.py install" fails, so the Conda builds all fail. The failure is due to the installed files ending up in the wrong place; I assume it has something to do with CMAKE_INSTALL_PREFIX, but I'm not sure how to debug it.

@roryyorke
Copy link
Collaborator

This is either a mistake in how we're using scikit-build, or a bug in that package; either way, I've opened an issue asking for help here: scikit-build/scikit-build#424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants