0

When I run pip install pathlib==1.0.1 I get the following error:

error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/4l/rwj9f3x12qs0nbw_dq3prw2c0000gn/T/pip-install-g5u_0nde/pathlib_adb255351e05488f95986f7a8775e1f0/setup.py", line 6, in <module>
          setup(
        File "/Users/danieljohnson/Documents/code/folder/venv/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 109, in setup
          _setup_distribution = dist = klass(attrs)
        File "/Users/danieljohnson/Documents/code/folder/venv/lib/python3.9/site-packages/setuptools/dist.py", line 460, in __init__
          for ep in metadata.entry_points(group='distutils.setup_keywords'):
        File "/Users/danieljohnson/Documents/code/folder/venv/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 999, in entry_points
          return SelectableGroups.load(eps).select(**params)
        File "/Users/danieljohnson/Documents/code/folder/venv/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 449, in load
          ordered = sorted(eps, key=by_group)
        File "/Users/danieljohnson/Documents/code/folder/venv/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 997, in <genexpr>
          dist.entry_points for dist in unique(distributions())
        File "/Users/danieljohnson/Documents/code/folder/venv/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 609, in entry_points
          return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self)
        File "/Users/danieljohnson/Documents/code/folder/venv/lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 917, in read_text
          return self._path.joinpath(filename).read_text(encoding='utf-8')
      AttributeError: 'PosixPath' object has no attribute 'read_text'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

Any idea how to solve the error? Version 1.0.1 is the version I need and I have seen m1 laptops with pathlib version 1.0.1 on them

FlyingTeller
  • 17,638
  • 3
  • 38
  • 53
Daniel Johnson
  • 193
  • 2
  • 14

1 Answers1

2

pathlib has been part of the stdlib since python 3.4, see the docs and also the pypi page. Consequently, what you are seeing is just an incompatibility of installing the ancient package from pypi (2014) to a rather recent python version (3.9). You should not need to install it at all to your python version.

I don't know what the other laptopts you have seen had, but if for some reason they needed a legacy setup of e.g. python 2.7, then it would be sensible that they had pathlib installed separately via pip

FlyingTeller
  • 17,638
  • 3
  • 38
  • 53