Repository navigation
Remove default dependencies - #4967
Conversation
7d92205 to
0fa1bac
Compare
|
@jarrodmillman With the lazy loader approach, we can also improve the error messages on SciPy import failure to guide users. So, I think this is a reasonable workaround for now. We still have an open issue on pypa to deal with |
|
It would also be nice if |
|
Thanks for responding so quickly on this, much appreciated. I think |
|
pythran is fixing the problem on their end: serge-sans-paille/pythran#1839 So this is less pressing for us now. I will likely wait to see if we run into additional circular imports for other projects. |
|
I think it's still worth making this change. I have a package where matplotlib is listed as an optional dependency and networkx is listed as a core dependency. Version 2.6 breaks that for us and there's no way to specify Making it so that I can avoid matplotlib via or would give us control over when our plotting dependencies are installed. |
rossbar
left a comment
There was a problem hiding this comment.
As noted by @stefanv , this change will break the functions for which we switched to the scipy-based implementations like pagerank. If a user calls nx.pagerank with this patch they will get ModuleNotFoundError: No module named 'scipy'.
There are several options for the instances like this:
- Revert these changes so that the non-numpy/scipy implementations are used (i.e. the same inefficient implementations that were used in 2.5)
- Add some
try/exceptboilerplate to fall back to the pure-Python implementations when the necessary dependencies aren't found. - Leave things as-is: This will break functions like
pagerankfor users of v2.6 who don't have numpy/scipy installed. - Leave things as is, but add boilerplate to improve exception messages - i.e. same as 3 but with a message like
"scipy is required for pagerank"instead of the more terse"No module named scipy".
I prefer option 2 for the short-term fix, just to avoid breaking pagerank et. al. for the subset of users who don't have numpy/scipy installed when they upgrade from 2.5->2.6
|
Having to revert back to the pure-Python versions is annoying. They were often so slow that it was painful to run. I hope they aren't being used by folks, but maybe they are. That said, I agree that we should go with option 2 if we are going to merge this PR. @rossbar Should we remove 2.6.0 and 2.6.1 from PyPI now? I would like to take some more time to think through the implications of removing the numpy, scipy, pandas, and matplotlib dependencies. I think we just need to fix |
I agree that having some time to thinking about this more would be good.
This seems reasonable to me if it's sufficient to fix the immediate problems that scipy et. al. are experiencing. |
|
I just "yanked" 2.6 and 2.6.1 from PyPI: I can "un-yank" them if we want. |
|
Also the test suite should be failing here for e.g. I'll go back over the PRs we had for 2.6 where we switched to a |
|
I think we don't want the test suite to fail. We left |
|
I am +1 on removing all dependencies for NetworkX 2.6. The default and extras options should be used when possible. But it sounds like pypi doesn't have a good way to set that up. I don't know much about the magic that these words mean, but it seems like we need a networkx[minimal] a networkx[default] (or maybe recommended?) and a networkx[extras]. And we need pypi to allow options like this is standard Also, we should write down somewhere what the advantages of including these requirements are. We've talked about it before, but it seems that they aren't at the tip of our tongues in important moments like this. Perhaps part of getting v2.7 released with these dependencies is to write an NXEP (or maybe a SPEC or maybe both) about how to handle dependencies. Strong buy-in for something like that could influence pypi, if needed. Thanks for everyone thinking about this -- it is helpful! And Thanks to Jarrod and Ross for working through so many details. |
Some context that may be helpful here:
|
Just to elaborate on that a bit, while conda does not have a concept of optional dependencies, it trivially supports multiple outputs per recipe. I haven't seen this fully formalized, but packages with many extras often get a mapping à la |
7453654 to
46c2b8a
Compare
rossbar
left a comment
There was a problem hiding this comment.
LGTM as well, thanks @jarrodmillman !
Networkx v2.6.2 now does not require any additional requirements. All of the other 2.6 releases have been yanked. So, it's safe for us to unpin it.
* Remove default dependencies * Update release notes
* Remove default dependencies * Update release notes
* Remove default dependencies * Update release notes
Having scipy as a default dependency introduce a circular build dependency issue for scipy: scipy/scipy#14335 and serge-sans-paille/pythran#1837
This PR removes numpy, scipy, matplotlib, and pandas as "default" dependencies for NetworkX. With this PR,
requires installing no additional packages and we will ask users to install networkx via
I propose releasing networkx 2.6.2 with this PR merged and removing 2.6.0 and 2.6.1. I would still like to figure out a way for users to install networkx with its "default" dependencies using only
for 2.7. Currently, I think we may want to release two packages on PyPI:
networkx-corefor libraries that only need a small subset of our functionality and that are not interested in installing extra packagesnetworkxfor end-users who don't care about which libraries we use to provide basic functionality.Of course, we will need to think through this a bit and we may need to work with projects (like
pythran) that depend on us.