镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

UserWarning: pkg_resources is deprecated as an API #597

Description

@j93hahn

I'm using fs==2.4.16 but whenever I import fs I get this error message:

/Users/jjahn/Desktop/Exa/monorepo/python/shared/exa_ml/.venv/lib/python3.10/site-packages/fs/__init__.py:4: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  __import__("pkg_resources").declare_namespace(__name__)  # type: ignore

It's caused by this line:

__import__("pkg_resources").declare_namespace(__name__)  # type: ignore

Just move to PEP420 implicit namespace packaging (no __init__.py file at all) and it will resolve this error. But it should get fixed before 2025-11-30 or users may have problems

Activity

  1. javitab commented on Jul 29, 2025

    @javitab

    Doesn't the error also reference pinning setup-tools to a specific version? I fixed by pinning setup-tools to 80.4.0. You may have the more appropriate fix but I would have thought somewhere around here would have been the fix.

  2. milahu commented on Jul 30, 2025

    @milahu

    duplicate of #577
    fixed by #590

  3. cadmi commented on Aug 6, 2025

    @cadmi

    duplicate of #577 fixed by #590

    When is the release?

  4. eli-schwartz commented on Aug 27, 2025

    @eli-schwartz

    When is the release?

    First my PRs to fix this would need to be merged by a maintainer.

  5. malmeloo commented on Sep 15, 2025

    @malmeloo

    Could we please get this fixed in a new release soon? That would give other projects time to update their dependencies to prevent breakage in two months... At this point it's clear to me that this project is unmaintained, but if the maintainers don't even merge small pull requests anymore then please communicate that to signal that people should move away from this project.

  6. milahu commented on Sep 15, 2025

    @milahu

    Could we please get this fixed in a new release soon?

    can you please switch to a package manager
    that lets you build and install packages also from github, not just from pypi?
    example: fs.nix based on #590 (comment)

    or add some pyfilesystem2 branch as a gitmodule to your project

    but waiting for nonexistant maintainers to fix some pypi release is... a waste of time

  7. malmeloo commented on Sep 15, 2025

    @malmeloo

    My package manager can handle git dependencies just fine, but if I publish my library to pypi with a git dependency, some my users are bound to run into issues. I just want to avoid the additional support burden, so a PyPi release would be a much nicer solution 🙂

    I'm looking for an in-memory filesystem provider, and unfortunately PyFilesystem appears to be pretty unique when it comes to that. On second thought however, I could probably use the builtin tarfile module with a bytesio object to accomplish that...

  8. milahu commented on Sep 15, 2025

    @milahu

    I'm looking for an in-memory filesystem provider

    fsspec memory? (fsspec/filesystem_spec#1904)

  9. malmeloo commented on Sep 15, 2025

    @malmeloo

    Oh nice! It's insane how difficult it is to find things through google nowadays...

    That MemoryFS limitation is a bummer though, and unfortunately a dealbreaker I'm afraid... I see you've already started a PR to change that, but I don't think I have the time to continue that effort right now. For now I think (hope) I can make it work with tarfile

  10. rerowep commented on Feb 9, 2026

    @rerowep

    This module is not working any more with setuptools version 82 https://github.com/pypa/setuptools/tree/v82.0.0!

  11. cmruffin commented on Feb 9, 2026

    @cmruffin

    setuptools 81 can be used until a patch is made.

  12. eli-schwartz commented on Feb 9, 2026

    @eli-schwartz

    As I've noted earlier:

    duplicate of #577 fixed by #590

    When is the release?

    First my PRs to fix this would need to be merged by a maintainer.

    I have a series of PRs that fix this, no patch need be written.

    Also, this PR is a duplicate. @j93hahn simply didn't close it upon being informed of such.

    Please keep all discussion in the original ticket (#577). Thanks.

  13. added a commit that references this issue on Feb 11, 2026
  14. fitzyracing1 commented on Oct 8, 2026

    @fitzyracing1

    Since #590 hasn't been merged or released, I published it: fitzyracing-fs 2.4.17 on PyPI is 2.4.16 plus eli-schwartz's #590 and #589, so import fs no longer touches pkg_resources, with no warning on setuptools <82 and no ModuleNotFoundError on 82+. fs.* extensions and opener plugins are still found. Same fs import name; uninstall the original first: pip uninstall -y fs && pip install fitzyracing-fs. Details: https://github.com/fitzyracing1/pyfilesystem2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions