Skip to content

[BUG] FileNotFoundError jaraco/text/Lorem ipsum.txt when importing pkg_resources #3072

@thinhha

Description

@thinhha

setuptools version

setuptools==60.7.0

Python version

3.9

OS

Debian 11

Additional environment information

No response

Description

FileNotFoundError when importing pkg_resources

  File "/home/aaa/env/lib/python3.9/site-packages/google/api_core/client_info.py", line 23, in <module>
    import pkg_resources
  File "/tmp/aaa/pypi__setuptools/pkg_resources/__init__.py", line 74, in <module>
    from pkg_resources.extern.jaraco.text import (
  File "/tmp/aaa/pypi__setuptools/pkg_resources/_vendor/jaraco/text/__init__.py", line 227, in <module>
    lorem_ipsum: str = files(__name__).joinpath('Lorem ipsum.txt').read_text()
  File "/home/aaa/.pyenv/versions/3.9.7/lib/python3.9/pathlib.py", line 1266, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/home/aaa/.pyenv/versions/3.9.7/lib/python3.9/pathlib.py", line 1252, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/home/aaa/.pyenv/versions/3.9.7/lib/python3.9/pathlib.py", line 1120, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/aaa/py_deps/pypi__setuptools/pkg_resources/_vendor/jaraco/text/Lorem ipsum.txt'

Expected behavior

Pinning setuptools==60.6.0 in requirements.txt works fine. This issue started with setuptools==60.7.0.

How to Reproduce

Using Bazel and rules_python, build a zip executable using:

bazel build //<target> --output_groups=python_zip_file
python3 bazel-bin/<target>/<target>.zip 

Output

...
  File "/home/aaa/env/lib/python3.9/site-packages/google/api_core/client_info.py", line 23, in <module>
    import pkg_resources
  File "/tmp/aaa/pypi__setuptools/pkg_resources/__init__.py", line 74, in <module>
    from pkg_resources.extern.jaraco.text import (
  File "/tmp/aaa/pypi__setuptools/pkg_resources/_vendor/jaraco/text/__init__.py", line 227, in <module>
    lorem_ipsum: str = files(__name__).joinpath('Lorem ipsum.txt').read_text()
  File "/home/aaa/.pyenv/versions/3.9.7/lib/python3.9/pathlib.py", line 1266, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/home/aaa/.pyenv/versions/3.9.7/lib/python3.9/pathlib.py", line 1252, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/home/aaa/.pyenv/versions/3.9.7/lib/python3.9/pathlib.py", line 1120, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/aaa/py_deps/pypi__setuptools/pkg_resources/_vendor/jaraco/text/Lorem ipsum.txt'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions