-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Register build-time dependencies in the setup.py as a setup_requirement. #7867
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
Comments
Would you be able to submit a PR illustrating the desired fix? On 14 November 2016 at 23:39, Holger Peters notifications@github.com
|
Okay, I spent some time reading I don't know if I understand ConclusionI guess that my request is more tricky than I originally thought. Making scikit-learn |
Theoretically, The The The real solution is PEP 518, which provides a way for source packages to statically tell pip "hey please install these packages before you run setup.py". Unfortunately, PEP 518 is accepted but not yet implemented. If someone wants to write a patch for pip to actually implement it then many people will be grateful :-). |
@njsmith well, this ( Pandas uses |
I tried adding PEP 518 is still in development (and I guess it will take quite some time). pypa/pip#3691 Note these two packages also require numpy to build and install ok with pip.
|
Some weirdness around installing scikit-learn. See: * scikit-learn/scikit-learn#8242 * scikit-learn/scikit-learn#7867 Solution is to force numpy and scipy installation before requirements.txt is installed.
Some weirdness around installing scikit-learn. See: * scikit-learn/scikit-learn#8242 * scikit-learn/scikit-learn#7867 Solution is to force numpy and scipy installation before requirements.txt is installed.
* Add reformat.R to convert smartsurvey format. * Add feature generators. * Extract data from db not flat files. * Update README. * Add db_to_flat_file.py to create merged db dump. * Add urllookup as module. * Add urllookup tests on travis. * Add PII removal using scrubadub. * Dump to pickle objects. Note: DataFrameSelector outputs a numpy array, but it is easier to calculate date features using pandas prior to conversion to a numpy array. For this reason, create an argument as to whether the DataFrameSelector is dealing with date features or not, and then apply the date transforms if so, and output a numpy array. Some weirdness around installing scikit-learn. See: * scikit-learn/scikit-learn#8242 * scikit-learn/scikit-learn#7867 Solution is to force numpy and scipy installation before requirements.txt is installed.
* Add reformat.R to convert smartsurvey format. * Add feature generators. * Extract data from db not flat files. * Update README. * Add db_to_flat_file.py to create merged db dump. * Add urllookup as module. * Add urllookup tests on travis. * Add PII removal using scrubadub. * Dump to pickle objects. Note: DataFrameSelector outputs a numpy array, but it is easier to calculate date features using pandas prior to conversion to a numpy array. For this reason, create an argument as to whether the DataFrameSelector is dealing with date features or not, and then apply the date transforms if so, and output a numpy array. Some weirdness around installing scikit-learn. See: * scikit-learn/scikit-learn#8242 * scikit-learn/scikit-learn#7867 Solution is to force numpy and scipy installation before requirements.txt is installed.
Any updates on this? It would be great if this worked, so |
I've just checked what scipy does: it adds setup_requires and
build_requires=[numpy>=1.8.2] if and only if import numpy fails.
…On 4 January 2018 at 03:12, Barry Hart ***@***.***> wrote:
Any updates on this? It would be great if this worked, so scikit-learn
would work better with typical Python tools like pip.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7867 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEz6zJreeqh9xmZ6Zo6Otl1DltWYhK2ks5tG6bcgaJpZM4KxRmC>
.
|
I would consider a PR which did the same here for scipy (and numpy).
…On 4 January 2018 at 09:07, Joel Nothman ***@***.***> wrote:
I've just checked what scipy does: it adds setup_requires and
build_requires=[numpy>=1.8.2] if and only if import numpy fails.
On 4 January 2018 at 03:12, Barry Hart ***@***.***> wrote:
> Any updates on this? It would be great if this worked, so scikit-learn
> would work better with typical Python tools like pip.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#7867 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAEz6zJreeqh9xmZ6Zo6Otl1DltWYhK2ks5tG6bcgaJpZM4KxRmC>
> .
>
|
I'm working on a PR for this. Ready for early (but not final) review if anyone is interested. |
I really wouldn't recommend doing the scipy thing these days. What I'd recommend is:
There is light on the horizon for the |
Thanks for the input @njsmith! |
@njsmith: I had already implemented the first suggestion, and it seems to work okay. I tried the simpler approach, but on my Mac, source installations did not work correctly. I saw no apparent errors, but after installation was complete, Anyway, the PR is up for review. |
@njsmith summarizes exactly what I would consider a good solution to the problem (today). |
OK I have looked a bit at this (including the two PRs from @barrywhart) and I have to say that I am a bit stuck, here is where I am at:
If there are examples of packages, which use numpy.distutils to build extensions, and that came up with a good way of doing this kind of things I'd be super happy if someone can point me to their setup.py. |
Unfortunately, # Must be at the top of setup.py, before importing setuptools
import sys
pip_is_running = ("setuptools" in sys.modules) Also, yeah, until PEP 518 support lands in pip, there is no workable way to get numpy automatically installed at build time. Even if you use |
I see, thanks a lot for the details!
Maybe a dumb question, but is there an easy way to figure out inside setup.py whether we are compiling from source or not? |
The simplest approach would be to make |
Which is pretty much the status quo?
…On 10 January 2018 at 12:56, Nathaniel J. Smith ***@***.***> wrote:
The simplest approach would be to make setup.py always error out if numpy
isn't installed. Pretty much the only things you can do with setup.py are
either to build from source, or some more obscure developer-only actions,
and I assume developers will have numpy installed anyway.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7867 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEz6-pHgZ60HVNtDBZe0cXFZg4B6auqks5tJBjRgaJpZM4KxRmC>
.
|
Agreed, basically this is what we are already doing. Unless there is a way in our setup.py to figure out that we are installing a wheel (or using |
My compete suggestion is:
Is that what's being called the status quo? |
IIUC your complete suggestion is "Keep your setup.py as it is and just add numpy and scipy in I think this is what #10402 is doing we should probably discuss there for the finer details. |
I package Python packages as wheels using the
pip wheel
command. Scikit-learn does not report its requirements to setuptools asinstall_requires
orsetup_requires
. This makespip wheel
fail.Description
The current checks for the presence of numpy and scipy during installation is according to what I found in the repo and the tracker based on Issue #1495 and PR #4371.
I suggest to avoid raising errors in
setup.py
and listnumpy
as an setup requirement and numpy and scipy as an install requirement, so that pip/wheel can install the dependencies seamlessly in the background, if they are not present. Pip'ssetup_requires
section should list all packages necessary to invoke setup.py subbcommands (http://setuptools.readthedocs.io/en/latest/setuptools.html#setup_requires).In my usage example,
pip wheel
would installnumpy
then temporarily for the creation of the scikit-learn wheel.Steps/Code to Reproduce
Expected Results
A scikit-learn wheel should be buildable as simple as
Actual Results
Discussion
The nature of my request is basically, to make scikit-learn behave more closely to how other packages behave.
The text was updated successfully, but these errors were encountered: