-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
BLD do not cythonize for sdist #15533
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
Conversation
Thanks to have picked-up this one over. We need an additional step to check the version of pip (0.18) is required. Scipy is doing something similar: https://github.com/scipy/scipy/blob/master/setup.py#L285 |
The old ubuntu seems to have |
Could we ask to upgrade the version of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments
any idea why the windows builds fail? |
Does |
On windows CI we install sklearn from source distribution (that we first build), no in editable mode. So sklearn ends up in python site-packages. But when we do that only the We would have the same issue on linux and mac if we installed from source distribution (maybe we should do that in one of the jobs ?) So it turns out that parsing pyproject.toml is not a suitable option |
I don't know, I'd say no, I just followed
WDYT @glemaitre ? I'd be happy to revert it and just have the version synced with a comment. |
On Ubuntu 18.04, the system pip3 is 9.0.1:
We should never ever ask users to Doing Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
ImportError: cannot import name 'main' The fix is to delete the new version of pip in Note: to delete the locally installed pip and make /usr/bin/pip3 work again, just do:
So in the end my advice would be to do: as long as cython is installed (and recent enough), make sure that This is what scipy does in https://github.com/scipy/scipy/blob/master/setup.py#L285: only complain about old pip version if cython is missing or too old. But even in this case we should probably ask the user to upgrade Cython instead.
|
Basically we should make it such that:
https://scikit-learn.org/dev/developers/advanced_installation.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments:
So you're suggesting that we don't check for pip version at all? Cause if pip is new, it'll get the new Cython anyway, right? |
Yes. |
@lesteve do you know what are the caveats with |
@@ -78,7 +79,8 @@ def configuration(parent_package='', top_path=None): | |||
# add the test directory | |||
config.add_subpackage('tests') | |||
|
|||
maybe_cythonize_extensions(top_path, config) | |||
if 'sdist' not in sys.argv: | |||
cythonize_extensions(top_path, config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not too sure about this as it prevents to do things like python setup.py sdist bdist_wheel
in a single line but maybe we don't care. Our CI does not do this.
I am not too sure, but I'll quote pandas-dev/pandas#28374 (comment):
|
You also (apparently) also need
|
When doing an editable install, I don't think you want to use build isolation. Actually, I don't really know what happens if you do (does incremental cython build work?). But it shouldn't be needed to create a build environment each time you build (all dependencies are already installed when doing development with editable installs). Another thing that can be tricky with build isolation in general is the versions of packages you build against. If pyproject.toml has |
Yes, but I think most issues have been solved (build dependencies can now also come from wheels, can depend on the python version, etc). Scipy and numpy also added back their pyproject.toml in the meantime. I think the main remaining issue we ran into this time is the confusion around editable installs (see above, basically editable installs is not yet supported by PEP517/PEP518, but you need to pass some extra flags to pip to keep the old behaviour for some reason ..) |
Thank you very much for your feedback @jorisvandenbossche! Indeed if we decide to go with The fact that build isolation is enabled when --editable is indeed weird (even if it works). The remark on incremental build is a good point. I will run some timing tests about incremental building (with and without ccache). Finally, in 2bc54a9 I enabled |
So other than setting the numpy/scipy versions for each python version, do we actually want to have this in 0.22? |
@adrinjalali I am still running some build timing tests to see what is the impact of using isolated builds. An option would be to not introduce the |
yeah that sounds like a good idea. |
Indeed the isolated build ( Without the To me this is a big downside for introducing
So for now I would be in favor of not using pyproject.toml in scikit-learn (but keep the rest of this PR to not ship cythonized outputs in our sdist and just have the users to manually install cython first). I think we should also motivate the fact that Using WDYT @adrinjalali @jorisvandenbossche ? |
I'm more than happy with all the suggestions you have. They all sounds reasonable to me. I had the same reservations towards pyproject.toml when I read about it more extensively a while ago. I just forgot these two flags we need to pass to make it work. |
I agree that we can delay the usage of pyproject.toml but I also think that we should not document |
I though this was supposed to be fixed in pip 19.1.1+? There was a long discussion about it several month ago https://discuss.python.org/t/pip-19-1-and-installing-in-editable-mode-with-pyproject-toml/1553/65 . According to pip release notes |
The think is there is value in keeping things as simple as possible and you need to at least run |
Apparently no: with pip 19.2.2 I get the following lines when I
This is causing to rebuild everything every time instead of benefiting from incremental building. |
I will open a new PR with the cythonization change only (no pyproject.toml) for the 0.22 release and report the issue to the pip developers. Let's keep this PR as it is for now for documentation purpose (reading the discussion in the current state of the diff). |
I have opened: #15567. |
I thought that I was running the latest version but actually it was not the case: I was running pip 19.2.2 while the latest pip is 19.3.1. When I try again |
Closing in favor of #15567 that was already merged in master for now. Let's re-explore the opportunity to configure a |
Fixes #14863
Closes #15335
This builds on top of #15335, except that it uses
pyproject.toml
instead.On a fresh virtual environment:
Before
pip install
:after
pip install
:Our circleci min dep job tests the build and doc build with the minimum cython requirement. I think we don't do that in azure pipelines.
ping @rth @glemaitre @thomasjpfan