-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
working_set stale when installing distributions after importing pkg_resources #2531
Comments
My hope is that Wait a sec. When I look at the traceback you provided, there's no mention of It appears that But I can't tell from the output how scanpy came to be importable. Let's try to put together a more minimal reproducer, without conda if possible, that demonstrates how |
sounds good! I filed pypa/setuptools-scm#513
Ah yeah, sorry, that’s confusing! The code producing that traceback tries to get the dev version first using That’s where the problem happens which this issue is about: First its Traceback (most recent call last):
File "scanpy/_metadata.py", line 13, in <module>
__version__ = get_version(root='..', relative_to=__file__)
File "/home/phil/.conda/envs/test-flit/lib/python3.8/site-packages/setuptools_scm/__init__.py", line 169, in get_version
return _get_version(config)
File "/home/phil/.conda/envs/test-flit/lib/python3.8/site-packages/setuptools_scm/__init__.py", line 173, in _get_version
parsed_version = _do_parse(config)
File "/home/phil/.conda/envs/test-flit/lib/python3.8/site-packages/setuptools_scm/__init__.py", line 134, in _do_parse
raise LookupError(
LookupError: setuptools-scm was unable to detect version for '/home/phil/Dev/Python/Single Cell/scanpy'. You were confused by the later traceback about “scanpy not found”, which is perfectly expected, as we’re in the process of installing scanpy, the |
Would it be possible to add that to the pkg_resources docs? Currently, the page does not mention importlib nor that |
`pkg_resources` has been deprecated by `setuptools` for quite a while: https://setuptools.pypa.io/en/latest/pkg_resources.html It's got some bugs/warts: * pypa/setuptools#2531 * https://discuss.python.org/t/will-setuptools-remove-pkg-resource-module-in-the-future/27182 So switch to using `importlib` functions which are part of the Python standard library as of `3.8`. This is less error-prone, and also removes the need for `setuptools` to be installed in order for this panel to work. I realize we technically still support `3.7`, but I thought it was fine to change this particular panel to require `3.8`, as `3.7` support is best effort given that it's now EOL'd by the core Python team. I also removed the relative path location for specific libraries as it was simply blank for me on Python 3.12... I think showing the location of the site packages directory should suffice. If someone later wants to build this out further, they're more than welcome to. Note that `importlib.metadata.distributions()` does have an outstanding issue that it reports a local editable install twice, but they plan to eventually fix that: * pypa/setuptools#4170
`pkg_resources` has been deprecated by `setuptools` for quite a while: https://setuptools.pypa.io/en/latest/pkg_resources.html It's got some bugs/warts: * pypa/setuptools#2531 * https://discuss.python.org/t/will-setuptools-remove-pkg-resource-module-in-the-future/27182 So switch to using `importlib` functions which are part of the Python standard library as of `3.8`. This is less error-prone, and also removes the need for `setuptools` to be installed in order for this panel to work. I realize we technically still support `3.7`, but I thought it was fine to change this particular panel to require `3.8`, as `3.7` support is best effort given that it's now EOL'd by the core Python team. I also removed the relative path location for specific libraries as it was simply blank for me on Python 3.12... I think showing the location of the site packages directory should suffice. If someone later wants to build this out further, they're more than welcome to. Note that `importlib.metadata.distributions()` does have an outstanding issue that it reports a local editable install twice, but they plan to eventually fix that: * pypa/setuptools#4170
`pkg_resources` has been deprecated by `setuptools` for quite a while: https://setuptools.pypa.io/en/latest/pkg_resources.html It's got some bugs/warts: * pypa/setuptools#2531 * https://discuss.python.org/t/will-setuptools-remove-pkg-resource-module-in-the-future/27182 So switch to using `importlib` functions which are part of the Python standard library as of `3.8`. This is less error-prone, and also removes the need for `setuptools` to be installed in order for this panel to work. I realize we technically still support `3.7`, but I thought it was fine to change this particular panel to require `3.8`, as `3.7` support is best effort given that it's now EOL'd by the core Python team. I also removed the relative path location for specific libraries as it was simply blank for me on Python 3.12... I think showing the location of the site packages directory should suffice. If someone later wants to build this out further, they're more than welcome to. Note that `importlib.metadata.distributions()` does have an outstanding issue that it reports a local editable install twice, but they plan to eventually fix that: * pypa/setuptools#4170
`pkg_resources` has been deprecated by `setuptools` for quite a while: https://setuptools.pypa.io/en/latest/pkg_resources.html It's got some bugs/warts: * pypa/setuptools#2531 * https://discuss.python.org/t/will-setuptools-remove-pkg-resource-module-in-the-future/27182 So switch to using `importlib` functions which are part of the Python standard library as of `3.8`. This is less error-prone, and also removes the need for `setuptools` to be installed in order for this panel to work. I realize we technically still support `3.7`, but I thought it was fine to change this particular panel to require `3.8`, as `3.7` support is best effort given that it's now EOL'd by the core Python team. I also removed the relative path location for specific libraries as it was simply blank for me on Python 3.12... I think showing the location of the site packages directory should suffice. If someone later wants to build this out further, they're more than welcome to. Note that `importlib.metadata.distributions()` does have an outstanding issue that it reports a local editable install twice, but they plan to eventually fix that: * pypa/setuptools#4170
`pkg_resources` has been deprecated by `setuptools` for quite a while: https://setuptools.pypa.io/en/latest/pkg_resources.html It's got some bugs/warts: * pypa/setuptools#2531 * https://discuss.python.org/t/will-setuptools-remove-pkg-resource-module-in-the-future/27182 So switch to using `importlib` functions which are part of the Python standard library as of `3.8`. This is less error-prone, and also removes the need for `setuptools` to be installed in order for this panel to work. I realize we technically still support `3.7`, but I thought it was fine to change this particular panel to require `3.8`, as `3.7` support is best effort given that it's now EOL'd by the core Python team. I also removed the relative path location for specific libraries as it was simply blank for me on Python 3.12... I think showing the location of the site packages directory should suffice. If someone later wants to build this out further, they're more than welcome to. Note that `importlib.metadata.distributions()` does have an outstanding issue that it reports a local editable install twice, but they plan to eventually fix that: * pypa/setuptools#4170
`pkg_resources` has been deprecated by `setuptools` for quite a while: https://setuptools.pypa.io/en/latest/pkg_resources.html It's got some bugs/warts: * pypa/setuptools#2531 * https://discuss.python.org/t/will-setuptools-remove-pkg-resource-module-in-the-future/27182 So switch to using `importlib` functions which are part of the Python standard library as of `3.8`. This is less error-prone, and also removes the need for `setuptools` to be installed in order for this panel to work. I realize we technically still support `3.7`, but I thought it was fine to change this particular panel to require `3.8`, as `3.7` support is best effort given that it's now EOL'd by the core Python team. I also removed the relative path location for specific libraries as it was simply blank for me on Python 3.12... I think showing the location of the site packages directory should suffice. If someone later wants to build this out further, they're more than welcome to. Note that `importlib.metadata.distributions()` does have an outstanding issue that it reports a local editable install twice, but they plan to eventually fix that: * pypa/setuptools#4170
`pkg_resources` has been deprecated by `setuptools` for quite a while: https://setuptools.pypa.io/en/latest/pkg_resources.html It's got some bugs/warts: * pypa/setuptools#2531 * https://discuss.python.org/t/will-setuptools-remove-pkg-resource-module-in-the-future/27182 So switch to using `importlib` functions which are part of the Python standard library as of `3.8`. This is less error-prone, and also removes the need for `setuptools` to be installed in order for this panel to work. I realize we technically still support `3.7`, but I thought it was fine to change this particular panel to require `3.8`, as `3.7` support is best effort given that it's now EOL'd by the core Python team. I also removed the relative path location for specific libraries as it was simply blank for me on Python 3.12... I think showing the location of the site packages directory should suffice. If someone later wants to build this out further, they're more than welcome to. Note that `importlib.metadata.distributions()` does have an outstanding issue that it reports a local editable install twice, but they plan to eventually fix that: * pypa/setuptools#4170
`pkg_resources` has been deprecated by `setuptools` for quite a while: https://setuptools.pypa.io/en/latest/pkg_resources.html It's got some bugs/warts: * pypa/setuptools#2531 * https://discuss.python.org/t/will-setuptools-remove-pkg-resource-module-in-the-future/27182 So switch to using `importlib` functions which are part of the Python standard library as of `3.8`. This is less error-prone, and also removes the need for `setuptools` to be installed in order for this panel to work. I realize we technically still support `3.7`, but I thought it was fine to change this particular panel to require `3.8`, as `3.7` support is best effort given that it's now EOL'd by the core Python team. I also removed the relative path location for specific libraries as it was simply blank for me on Python 3.12... I think showing the location of the site packages directory should suffice. If someone later wants to build this out further, they're more than welcome to. Note that `importlib.metadata.distributions()` does have an outstanding issue that it reports a local editable install twice, but they plan to eventually fix that: * pypa/setuptools#4170
`pkg_resources` has been deprecated by `setuptools` for quite a while: https://setuptools.pypa.io/en/latest/pkg_resources.html It's got some bugs/warts: * pypa/setuptools#2531 * https://discuss.python.org/t/will-setuptools-remove-pkg-resource-module-in-the-future/27182 So switch to using `importlib` functions which are part of the Python standard library as of `3.8`. This is less error-prone, and also removes the need for `setuptools` to be installed in order for this panel to work. I realize we technically still support `3.7`, but I thought it was fine to change this particular panel to require `3.8`, as `3.7` support is best effort given that it's now EOL'd by the core Python team. I also removed the relative path location for specific libraries as it was simply blank for me on Python 3.12... I think showing the location of the site packages directory should suffice. If someone later wants to build this out further, they're more than welcome to. Note that `importlib.metadata.distributions()` does have an outstanding issue that it reports a local editable install twice, but they plan to eventually fix that: * pypa/setuptools#4170
I think this is what happens
flit
) first importspkg_resources
pkg_resources
before)pkg_resources.working_set
and expects something to be in there (e.g. bysetuptools_scm
usingiter_entry_points
)This results in
pkg_resources.working_set.entries
being stale, i.e. only containing the list of packages when it was first imported.For flit, that means it somehow imports
pkg_resources
, then installs the dependencies, then tries to import the package (withpkg_resources
containing the stale entries from when it was imported)It can be circumvented by manually updating the working set before using anything that relies on it:
Here’s some example output:
Details
The text was updated successfully, but these errors were encountered: