Skip to content
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

Closed
flying-sheep opened this issue Jan 14, 2021 · 3 comments
Labels

Comments

@flying-sheep
Copy link
Contributor

flying-sheep commented Jan 14, 2021

I think this is what happens

  1. A build tool (e.g. flit) first imports pkg_resources
  2. Then it installs dependencies
  3. Then it imports the package being installed (in the same process that imported pkg_resources before)
  4. That package uses pkg_resources.working_set and expects something to be in there (e.g. by setuptools_scm using iter_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 (with pkg_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:

import sys
import pkg_resources

for entry in sys.path:
    pkg_resources.working_set.add_entry(entry)

__version__ = setuptools_scm.get_version(...)

Here’s some example output:

Details
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.8.3
  latest version: 4.9.2

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: /home/phil/.conda/envs/test-flit

  added / updated specs:
    - flit
    - pip=20.3.3
    - python=3.8


The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main
  brotlipy           pkgs/main/linux-64::brotlipy-0.7.0-py38h27cfd23_1003
  ca-certificates    pkgs/main/linux-64::ca-certificates-2020.12.8-h06a4308_0
  certifi            pkgs/main/linux-64::certifi-2020.12.5-py38h06a4308_0
  cffi               pkgs/main/linux-64::cffi-1.14.4-py38h261ae71_0
  chardet            pkgs/main/linux-64::chardet-4.0.0-py38h06a4308_1003
  cryptography       pkgs/main/linux-64::cryptography-3.3.1-py38h3c74f83_0
  docutils           pkgs/main/linux-64::docutils-0.16-py38_1
  flit               pkgs/main/noarch::flit-3.0.0-py_0
  flit-core          pkgs/main/noarch::flit-core-3.0.0-py_0
  idna               pkgs/main/noarch::idna-2.10-py_0
  ld_impl_linux-64   pkgs/main/linux-64::ld_impl_linux-64-2.33.1-h53a641e_7
  libedit            pkgs/main/linux-64::libedit-3.1.20191231-h14c3975_1
  libffi             pkgs/main/linux-64::libffi-3.3-he6710b0_2
  libgcc-ng          pkgs/main/linux-64::libgcc-ng-9.1.0-hdf63c60_0
  libstdcxx-ng       pkgs/main/linux-64::libstdcxx-ng-9.1.0-hdf63c60_0
  ncurses            pkgs/main/linux-64::ncurses-6.2-he6710b0_1
  openssl            pkgs/main/linux-64::openssl-1.1.1i-h27cfd23_0
  pip                pkgs/main/linux-64::pip-20.3.3-py38h06a4308_0
  pycparser          pkgs/main/noarch::pycparser-2.20-py_2
  pyopenssl          pkgs/main/noarch::pyopenssl-20.0.1-pyhd3eb1b0_1
  pysocks            pkgs/main/linux-64::pysocks-1.7.1-py38h06a4308_0
  python             pkgs/main/linux-64::python-3.8.5-h7579374_1
  pytoml             pkgs/main/noarch::pytoml-0.1.21-py_0
  readline           pkgs/main/linux-64::readline-8.0-h7b6447c_0
  requests           pkgs/main/noarch::requests-2.25.1-pyhd3eb1b0_0
  requests_download  pkgs/main/noarch::requests_download-0.1.2-py_1
  setuptools         pkgs/main/linux-64::setuptools-51.1.2-py38h06a4308_4
  six                pkgs/main/linux-64::six-1.15.0-py38h06a4308_0
  sqlite             pkgs/main/linux-64::sqlite-3.33.0-h62c20be_0
  tk                 pkgs/main/linux-64::tk-8.6.10-hbc83047_0
  urllib3            pkgs/main/noarch::urllib3-1.26.2-pyhd3eb1b0_0
  wheel              pkgs/main/noarch::wheel-0.36.2-pyhd3eb1b0_0
  xz                 pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
  zlib               pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3


Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate test-flit
#
# To deactivate an active environment, use
#
#     $ conda deactivate

Extras to install for deps 'develop': {'test', '.none', 'dev', 'doc'}                                                                     I-flit.install
Installing requirements                                                                                                                   I-flit.install
Ignoring importlib-metadata: markers 'python_version < "3.8"' don't match your environment
Ignoring typing-extensions: markers 'python_version < "3.8"' don't match your environment
Requirement already satisfied: pytoml in /home/phil/.conda/envs/test-flit/lib/python3.8/site-packages (from -r /tmp/tmpv18s95xprequirements.txt (line 29)) (0.1.21)
Requirement already satisfied: docutils in /home/phil/.conda/envs/test-flit/lib/python3.8/site-packages (from -r /tmp/tmpv18s95xprequirements.txt (line 31)) (0.16)
Collecting anndata>=0.7.4
  Using cached anndata-0.7.5-py3-none-any.whl (119 kB)
Collecting black>=20.8b1
  Using cached black-20.8b1-py3-none-any.whl
Collecting dask[array]!=2.17.0
  Using cached dask-2020.12.0-py3-none-any.whl (884 kB)
Collecting h5py>=2.10.0
  Using cached h5py-3.1.0-cp38-cp38-manylinux1_x86_64.whl (4.4 MB)
Collecting matplotlib>=3.1.2
  Using cached matplotlib-3.3.3-cp38-cp38-manylinux1_x86_64.whl (11.6 MB)
Collecting networkx>=2.3
  Using cached networkx-2.5-py3-none-any.whl (1.6 MB)
Collecting numba>=0.41.0
  Using cached numba-0.52.0-cp38-cp38-manylinux2014_x86_64.whl (3.2 MB)
Requirement already satisfied: setuptools in /home/phil/.conda/envs/test-flit/lib/python3.8/site-packages (from numba>=0.41.0->-r /tmp/tmpv18s95xprequirements.txt (line 22)) (51.1.2.post20210112)
Collecting numpy>=1.17.0
  Using cached numpy-1.19.5-cp38-cp38-manylinux2010_x86_64.whl (14.9 MB)
Collecting pandas>=0.21
  Using cached pandas-1.2.0-cp38-cp38-manylinux1_x86_64.whl (9.7 MB)
Collecting pytest>=4.4
  Using cached pytest-6.2.1-py3-none-any.whl (279 kB)
Collecting scanpydoc>=0.5
  Using cached scanpydoc-0.5.5-py3-none-any.whl (28 kB)
Collecting scikit-learn>=0.21.2
  Using cached scikit_learn-0.24.0-cp38-cp38-manylinux2010_x86_64.whl (24.9 MB)
Collecting joblib
  Using cached joblib-1.0.0-py3-none-any.whl (302 kB)
Collecting scipy>=1.4
  Using cached scipy-1.6.0-cp38-cp38-manylinux1_x86_64.whl (27.2 MB)
Collecting sphinx<3.1,>3
  Using cached Sphinx-3.0.4-py3-none-any.whl (2.8 MB)
Requirement already satisfied: requests>=2.5.0 in /home/phil/.conda/envs/test-flit/lib/python3.8/site-packages (from sphinx<3.1,>3->-r /tmp/tmpv18s95xprequirements.txt (line 32)) (2.25.1)
Collecting sphinx-rtd-theme>=0.3.1
  Using cached sphinx_rtd_theme-0.5.1-py2.py3-none-any.whl (2.8 MB)
Collecting statsmodels>=0.10.0rc2
  Using cached statsmodels-0.12.1-cp38-cp38-manylinux1_x86_64.whl (9.5 MB)
Collecting patsy
  Using cached patsy-0.5.1-py2.py3-none-any.whl (231 kB)
Requirement already satisfied: six in /home/phil/.conda/envs/test-flit/lib/python3.8/site-packages (from patsy->-r /tmp/tmpv18s95xprequirements.txt (line 18)) (1.15.0)
Collecting umap-learn<0.5,>=0.3.10
  Using cached umap_learn-0.4.6-py3-none-any.whl
Collecting alabaster<0.8,>=0.7
  Using cached alabaster-0.7.12-py2.py3-none-any.whl (14 kB)
Collecting attrs>=19.2.0
  Using cached attrs-20.3.0-py2.py3-none-any.whl (49 kB)
Collecting babel>=1.3
  Using cached Babel-2.9.0-py2.py3-none-any.whl (8.8 MB)
Collecting click>=7.1.2
  Using cached click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting cycler>=0.10
  Using cached cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)
Collecting decorator>=4.3.0
  Using cached decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
Collecting Jinja2>=2.3
  Using cached Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
Collecting kiwisolver>=1.0.1
  Using cached kiwisolver-1.3.1-cp38-cp38-manylinux1_x86_64.whl (1.2 MB)
Collecting llvmlite<0.36,>=0.35.0
  Using cached llvmlite-0.35.0-cp38-cp38-manylinux2010_x86_64.whl (25.3 MB)
Collecting MarkupSafe>=0.23
  Using cached MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl (32 kB)
Collecting mypy-extensions>=0.4.3
  Using cached mypy_extensions-0.4.3-py2.py3-none-any.whl (4.5 kB)
Collecting pathspec<1,>=0.6
  Using cached pathspec-0.8.1-py2.py3-none-any.whl (28 kB)
Collecting pillow>=6.2.0
  Using cached Pillow-8.1.0-cp38-cp38-manylinux1_x86_64.whl (2.2 MB)
Collecting pluggy<1.0.0a1,>=0.12
  Using cached pluggy-0.13.1-py2.py3-none-any.whl (18 kB)
Collecting py>=1.8.2
  Using cached py-1.10.0-py2.py3-none-any.whl (97 kB)
Collecting Pygments>=2.0
  Using cached Pygments-2.7.4-py3-none-any.whl (950 kB)
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3
  Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting python-dateutil>=2.1
  Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting pytz>=2017.3
  Using cached pytz-2020.5-py2.py3-none-any.whl (510 kB)
Collecting regex>=2020.1.8
  Using cached regex-2020.11.13-cp38-cp38-manylinux2014_x86_64.whl (738 kB)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/phil/.conda/envs/test-flit/lib/python3.8/site-packages (from requests>=2.5.0->sphinx<3.1,>3->-r /tmp/tmpv18s95xprequirements.txt (line 32)) (1.26.2)
Requirement already satisfied: chardet<5,>=3.0.2 in /home/phil/.conda/envs/test-flit/lib/python3.8/site-packages (from requests>=2.5.0->sphinx<3.1,>3->-r /tmp/tmpv18s95xprequirements.txt (line 32)) (4.0.0)
Requirement already satisfied: certifi>=2017.4.17 in /home/phil/.conda/envs/test-flit/lib/python3.8/site-packages (from requests>=2.5.0->sphinx<3.1,>3->-r /tmp/tmpv18s95xprequirements.txt (line 32)) (2020.12.5)
Requirement already satisfied: idna<3,>=2.5 in /home/phil/.conda/envs/test-flit/lib/python3.8/site-packages (from requests>=2.5.0->sphinx<3.1,>3->-r /tmp/tmpv18s95xprequirements.txt (line 32)) (2.10)
Collecting snowballstemmer>=1.1
  Using cached snowballstemmer-2.0.0-py2.py3-none-any.whl (97 kB)
Collecting threadpoolctl>=2.0.0
  Using cached threadpoolctl-2.1.0-py3-none-any.whl (12 kB)
Collecting toml>=0.10.1
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting toolz>=0.8.2
  Using cached toolz-0.11.1-py3-none-any.whl (55 kB)
Collecting typed-ast>=1.4.0
  Using cached typed_ast-1.4.2-cp38-cp38-manylinux1_x86_64.whl (774 kB)
Collecting typing-extensions>=3.7.4
  Using cached typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Collecting fsspec
  Using cached fsspec-0.8.5-py3-none-any.whl (98 kB)
Collecting legacy-api-wrap
  Using cached legacy_api_wrap-1.2-py3-none-any.whl (37 kB)
Collecting get_version
  Using cached get_version-2.1-py3-none-any.whl (43 kB)
Collecting natsort
  Using cached natsort-7.1.0-py3-none-any.whl (35 kB)
Collecting packaging
  Using cached packaging-20.8-py2.py3-none-any.whl (39 kB)
Collecting profimp
  Using cached profimp-0.1.0-py3-none-any.whl
Collecting pbr!=2.1.0,>=2.0.0
  Using cached pbr-5.5.1-py2.py3-none-any.whl (106 kB)
Collecting seaborn
  Using cached seaborn-0.11.1-py3-none-any.whl (285 kB)
Collecting setuptools_scm
  Using cached setuptools_scm-5.0.1-py2.py3-none-any.whl (28 kB)
Collecting sinfo
  Using cached sinfo-0.3.1-py3-none-any.whl
Collecting sphinx-autodoc-typehints
  Using cached sphinx_autodoc_typehints-1.11.1-py3-none-any.whl (8.7 kB)
Collecting tables
  Using cached tables-3.6.1-cp38-cp38-manylinux1_x86_64.whl (4.3 MB)
Collecting numexpr>=2.6.2
  Using cached numexpr-2.7.2-cp38-cp38-manylinux2010_x86_64.whl (472 kB)
Collecting tqdm
  Using cached tqdm-4.56.0-py2.py3-none-any.whl (72 kB)
Collecting zappy
  Using cached zappy-0.2.0-py3-none-any.whl
Collecting zarr
  Using cached zarr-2.6.1-py3-none-any.whl (132 kB)
Collecting numcodecs>=0.6.4
  Using cached numcodecs-0.7.2-cp38-cp38-manylinux2010_x86_64.whl (6.0 MB)
Collecting appdirs
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting asciitree
  Using cached asciitree-0.3.3-cp38-none-any.whl
Collecting fasteners
  Using cached fasteners-0.16-py2.py3-none-any.whl (28 kB)
Collecting imagesize
  Using cached imagesize-1.2.0-py2.py3-none-any.whl (4.8 kB)
Collecting iniconfig
  Using cached iniconfig-1.1.1-py2.py3-none-any.whl (5.0 kB)
Collecting pyyaml
  Using cached PyYAML-5.3.1-cp38-cp38-linux_x86_64.whl
Collecting sphinxcontrib-applehelp
  Using cached sphinxcontrib_applehelp-1.0.2-py2.py3-none-any.whl (121 kB)
Collecting sphinxcontrib-devhelp
  Using cached sphinxcontrib_devhelp-1.0.2-py2.py3-none-any.whl (84 kB)
Collecting sphinxcontrib-htmlhelp
  Using cached sphinxcontrib_htmlhelp-1.0.3-py2.py3-none-any.whl (96 kB)
Collecting sphinxcontrib-jsmath
  Using cached sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl (5.1 kB)
Collecting sphinxcontrib-qthelp
  Using cached sphinxcontrib_qthelp-1.0.3-py2.py3-none-any.whl (90 kB)
Collecting sphinxcontrib-serializinghtml
  Using cached sphinxcontrib_serializinghtml-1.1.4-py2.py3-none-any.whl (89 kB)
Collecting stdlib-list
  Using cached stdlib_list-0.8.0-py3-none-any.whl (63 kB)
Installing collected packages: pytz, pyparsing, numpy, MarkupSafe, threadpoolctl, sphinxcontrib-serializinghtml, sphinxcontrib-qthelp, sphinxcontrib-jsmath, sphinxcontrib-htmlhelp, sphinxcontrib-devhelp, sphinxcontrib-applehelp, snowballstemmer, scipy, pyyaml, python-dateutil, Pygments, pillow, packaging, llvmlite, kiwisolver, joblib, Jinja2, imagesize, cycler, babel, alabaster, typing-extensions, typed-ast, toolz, toml, stdlib-list, sphinx, scikit-learn, regex, py, pluggy, pbr, patsy, pathspec, pandas, numexpr, numcodecs, numba, natsort, mypy-extensions, matplotlib, iniconfig, h5py, get-version, fasteners, decorator, dask, click, attrs, asciitree, appdirs, zarr, zappy, umap-learn, tqdm, tables, statsmodels, sphinx-rtd-theme, sphinx-autodoc-typehints, sinfo, setuptools-scm, seaborn, scanpydoc, pytest, profimp, networkx, legacy-api-wrap, fsspec, black, anndata
Successfully installed Jinja2-2.11.2 MarkupSafe-1.1.1 Pygments-2.7.4 alabaster-0.7.12 anndata-0.7.5 appdirs-1.4.4 asciitree-0.3.3 attrs-20.3.0 babel-2.9.0 black-20.8b1 click-7.1.2 cycler-0.10.0 dask-2020.12.0 decorator-4.4.2 fasteners-0.16 fsspec-0.8.5 get-version-2.1 h5py-3.1.0 imagesize-1.2.0 iniconfig-1.1.1 joblib-1.0.0 kiwisolver-1.3.1 legacy-api-wrap-1.2 llvmlite-0.35.0 matplotlib-3.3.3 mypy-extensions-0.4.3 natsort-7.1.0 networkx-2.5 numba-0.52.0 numcodecs-0.7.2 numexpr-2.7.2 numpy-1.19.5 packaging-20.8 pandas-1.2.0 pathspec-0.8.1 patsy-0.5.1 pbr-5.5.1 pillow-8.1.0 pluggy-0.13.1 profimp-0.1.0 py-1.10.0 pyparsing-2.4.7 pytest-6.2.1 python-dateutil-2.8.1 pytz-2020.5 pyyaml-5.3.1 regex-2020.11.13 scanpydoc-0.5.5 scikit-learn-0.24.0 scipy-1.6.0 seaborn-0.11.1 setuptools-scm-5.0.1 sinfo-0.3.1 snowballstemmer-2.0.0 sphinx-3.0.4 sphinx-autodoc-typehints-1.11.1 sphinx-rtd-theme-0.5.1 sphinxcontrib-applehelp-1.0.2 sphinxcontrib-devhelp-1.0.2 sphinxcontrib-htmlhelp-1.0.3 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.3 sphinxcontrib-serializinghtml-1.1.4 statsmodels-0.12.1 stdlib-list-0.8.0 tables-3.6.1 threadpoolctl-2.1.0 toml-0.10.2 toolz-0.11.1 tqdm-4.56.0 typed-ast-1.4.2 typing-extensions-3.7.4.3 umap-learn-0.4.6 zappy-0.2.0 zarr-2.6.1
Adding .pth file /home/phil/.conda/envs/test-flit/lib/python3.8/site-packages/scanpy.pth for /home/phil/Dev/Python/Single Cell/scanpy     I-flit.install
Writing script to /home/phil/.conda/envs/test-flit/bin/scanpy                                                                             I-flit.install
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'.

Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.

For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  ... <snip>
@flying-sheep flying-sheep changed the title Entry point “setuptools_scm.parse_scm” not found during PEP 517 install working_set stale when installing distributions after importing pkg_resources Jan 14, 2021
@jaraco
Copy link
Member

jaraco commented Jan 17, 2021

My hope is that pkg_resources can be fully deprecated in favor of importlib.metadata and importlib.resources and their backports. I'm confident, though not certain, that those projects are responsive to changes in the environment without the concept of a working set. Please consider raising that issue with that project and possibly contributing to the replacement effort.

Wait a sec. When I look at the traceback you provided, there's no mention of pkg_resources or working set. More importantly, importlib.metadata is being used to load the metadata for scanpy, but somehow importlib.metadata doesn't find the relevant metadata. Perhaps it might have found that metadata if pkg_resources had an up-to-date working set, but I'm less inclined to tackle that problem than to determine why importlib.metadata is unable to find the metadata.

It appears that scanpy is installed in some form of zip archive and loaded by a zipimporter. importlib.metadata should support metadata in that form as long as the metadata is actually present in the zip archive alongside scanpy.

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 scanpy is installed and why importlib.metadata doesn't find metadata for it. From there, the solution should be to avoid pkg_resources and rely on a fix that allows use of importlib.metadata instead.

@flying-sheep
Copy link
Contributor Author

flying-sheep commented Jan 19, 2021

I'm confident, though not certain, that those projects are responsive to changes in the environment without the concept of a working set

sounds good! I filed pypa/setuptools-scm#513

Wait a sec. When I look at the traceback you provided […]

Ah yeah, sorry, that’s confusing! The code producing that traceback tries to get the dev version first using setuptools_scm.

That’s where the problem happens which this issue is about:

First its iter_matching_entrypoints function doesn’t iterate all packages installed at the time, then this happens:

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 setuptools_scm call earlier should have succeeded, and that block should never have been reached.

@konstin
Copy link

konstin commented Apr 1, 2021

My hope is that pkg_resources can be fully deprecated in favor of importlib.metadata and importlib.resources and their backports. I'm confident, though not certain, that those projects are responsive to changes in the environment without the concept of a working set. Please consider raising that issue with that project and possibly contributing to the replacement effort.

Would it be possible to add that to the pkg_resources docs? Currently, the page does not mention importlib nor that pkg_resources is getting deprecated. I've been bitten by the same outdated working_set issue described here when using transformers with colab (huggingface/transformers#10964), and such a note would have saved me a lot of debugging time. I've also checked that importlib_metadata fixes this case.

@jaraco jaraco closed this as completed in 8fe85c2 Apr 3, 2021
@jaraco jaraco added the wontfix label Apr 3, 2021
jeffwidman added a commit to pallets-eco/flask-debugtoolbar that referenced this issue Apr 11, 2024
`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
jeffwidman added a commit to pallets-eco/flask-debugtoolbar that referenced this issue Apr 11, 2024
`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
jeffwidman added a commit to pallets-eco/flask-debugtoolbar that referenced this issue Apr 11, 2024
`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
jeffwidman added a commit to pallets-eco/flask-debugtoolbar that referenced this issue Apr 11, 2024
`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
jeffwidman added a commit to pallets-eco/flask-debugtoolbar that referenced this issue Apr 12, 2024
`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
jeffwidman added a commit to pallets-eco/flask-debugtoolbar that referenced this issue Apr 12, 2024
`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
jeffwidman added a commit to pallets-eco/flask-debugtoolbar that referenced this issue Apr 12, 2024
`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
jeffwidman added a commit to pallets-eco/flask-debugtoolbar that referenced this issue Apr 13, 2024
`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
jeffwidman added a commit to pallets-eco/flask-debugtoolbar that referenced this issue Apr 13, 2024
`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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants