I can reproduce this with pex alone: ```python -m...
# general
h
I can reproduce this with pex alone:
Copy code
python -m pex.cli lock create  --interpreter-constraint=">=3.8,<3.9" --resolver-version=pip-2020-resolver morecantile==3.1.2
vs
Copy code
python3.9 -m pex.cli lock create  --interpreter-constraint=">=3.8,<3.9" --resolver-version=pip-2020-resolver morecantile==3.0.5
e
And this is an issue with morecantile straight up. Here's what Pip thinks:
Copy code
x$ ./morecantile.venv/bin/pip install -U pip
Collecting pip
  Downloading pip-22.2.2-py3-none-any.whl (2.0 MB)
     |████████████████████████████████| 2.0 MB 2.0 MB/s
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.0.2
    Uninstalling pip-20.0.2:
      Successfully uninstalled pip-20.0.2
Successfully installed pip-22.2.2
jsirois@DESKTOP-51NK7LK:~/dev/pantsbuild/pex$ ./morecantile.venv/bin/pip install morecantile==3.1.2
Collecting morecantile==3.1.2
  Downloading morecantile-3.1.2.tar.gz (25 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [36 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-wfa5kg7y/morecantile_3a8eec6ae11342be97344f0404801765/setup.py", line 17, in <module>
          setup(
        File "/home/jsirois/dev/pantsbuild/pex/morecantile.venv/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python3.8/distutils/core.py", line 121, in setup
          dist.parse_config_files()
        File "/home/jsirois/dev/pantsbuild/pex/morecantile.venv/lib/python3.8/site-packages/setuptools/dist.py", line 701, in parse_config_files
          parse_configuration(self, self.command_options,
        File "/home/jsirois/dev/pantsbuild/pex/morecantile.venv/lib/python3.8/site-packages/setuptools/config.py", line 121, in parse_configuration
          meta.parse()
        File "/home/jsirois/dev/pantsbuild/pex/morecantile.venv/lib/python3.8/site-packages/setuptools/config.py", line 426, in parse
          section_parser_method(section_options)
        File "/home/jsirois/dev/pantsbuild/pex/morecantile.venv/lib/python3.8/site-packages/setuptools/config.py", line 399, in parse_section
          self[name] = value
        File "/home/jsirois/dev/pantsbuild/pex/morecantile.venv/lib/python3.8/site-packages/setuptools/config.py", line 184, in __setitem__
          value = parser(value)
        File "/home/jsirois/dev/pantsbuild/pex/morecantile.venv/lib/python3.8/site-packages/setuptools/config.py", line 515, in _parse_version
          version = self._parse_attr(value, self.package_dir)
        File "/home/jsirois/dev/pantsbuild/pex/morecantile.venv/lib/python3.8/site-packages/setuptools/config.py", line 349, in _parse_attr
          module = import_module(module_name)
        File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
        File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
        File "<frozen importlib._bootstrap>", line 991, in _find_and_load
        File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 848, in exec_module
        File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
        File "/tmp/pip-install-wfa5kg7y/morecantile_3a8eec6ae11342be97344f0404801765/morecantile/__init__.py", line 14, in <module>
          from .defaults import tms  # noqa
        File "/tmp/pip-install-wfa5kg7y/morecantile_3a8eec6ae11342be97344f0404801765/morecantile/defaults.py", line 8, in <module>
          import attr
      ModuleNotFoundError: No module named 'attr'
      [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.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
And the reason is here: https://github.com/developmentseed/morecantile/blob/f4db676c7367b3d805a5c9872aaac9b727113fcf/setup.cfg#L11-L12 -> https://github.com/developmentseed/morecantile/blob/f4db676c7367b3d805a5c9872aaac9b727113fcf/morecantile/__init__.py#L11-L14 -> https://github.com/developmentseed/morecantile/blob/f4db676c7367b3d805a5c9872aaac9b727113fcf/morecantile/defaults.py#L8
So @proud-vr-87793 pinning low or using VCS to get the tip are your only two options. 3.1.2 is just broken. You need to 1st pip install a compatible attrs and only then can you install morecantile 3.1.2
And, FWIW on the Pex repro side - if you throw in `--preserve-pip-download-log`you can see this same build error in that log.
h
Yeah I did see that in the log, but weirdly couldn’t reproduce it running pip standalone in a venv
p
Thank you both so much!! I'll go with one of the options you had mentioned @enough-analyst-54434 and see if I can't contribute a fix to what's going on with
morecantile
(actually the maintainers seem to have a few packages with the same issue 😅).