Hi all, does anyone have any advice for fixing thi...
# general
f
Hi all, does anyone have any advice for fixing this packaging error? • It seems to come from the
googlemaps
package ◦ Note: Packaging works if I remove the
complete_platforms
arg, but then fails if I try packaging with Dockerfile • I installed python 3.10 with Homebrew to match
pants.toml
, and added the installed path to
$PATH
, but maybe the system version of python 3.9 is being used somehow? • See code snippets and full error in thread
Copy code
ERROR: Failed building wheel for googlemaps
  error: subprocess-exited-with-error
  
  × python setup.py clean did not run successfully.

...

python3.9/site-packages/setuptools/wheel.py", line 171, in _convert_metadata
          os.rename(dist_info, egg_info)
      OSError: [Errno 66] Directory not empty: '/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tnr_nene/.eggs/charset_normalizer-3.4.1-py3.9-macosx-11.0-arm64.egg/charset_normalizer-3.4.1.dist-info' -> '/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tnr_nene/.eggs/charset_normalizer-3.4.1-py3.9-macosx-11.0-arm64.egg/EGG-INFO'
      [end of output]
What I tried: • Uninstalling pants and reinstalling with the installer script • Removing
complete_platforms=[":linux_amd64_py310"]
from
BUILD
◦ Works but fails when I then package as Dockerfile (with or without
build_platform=["linux/amd64"]
) • Regenerating the JSON file for complete platforms on mac • Killing pants process, clearing cache, running with
--no-pantsd
• Upgrading to Pants v 2.25.0
Code:
Copy code
# main.py 
import googlemaps
Copy code
# BUILD
python_sources(
    name="lib",
    resolve="data_eng",
)

file(
    name="linux_amd64_py310",
    source="linux_amd64_py310.json",
)

# 3rd party deps
pex_binary(
    name="binary-deps",
    entry_point="main.py",
    resolve="data_eng",
    layout="packed",
    include_sources=False,
    include_tools=True,
    execution_mode="venv",
    complete_platforms=[":linux_amd64_py310"],
)

# 1st party srcs
pex_binary(
    name="binary-srcs",
    entry_point="main.py",
    resolve="data_eng",
    dependencies=[":lib"],
    layout="packed",
    include_requirements=False,
    include_tools=True,
    execution_mode="venv",
)
Copy code
# pants.toml
[GLOBAL]
pants_version = "2.20.0"

backend_packages = [
   "pants.core",
   "pants.backend.shell",
   "pants.backend.python",
   "pants.backend.python.lint.flake8",
   "pants.backend.python.lint.black",
   "pants.backend.build_files.fmt.black",
   "pants.backend.google_cloud_function.python",
   "pants.backend.docker",
]

pants_ignore = [
   "cookiecutter/",
]

build_ignore = ["cookiecutter/"]

[python]
# The default interpreter constraints for code in this repo. Individual targets can override
#  this with the `interpreter_constraints` field. See
#  <https://www.pantsbuild.org/docs/python-interpreter-compatibility>.

# This can be a range, such as [">=3.8,<3.11"], but it's usually recommended to restrict
# to a single minor version.
interpreter_constraints = ["==3.10.*"]

# Enable the "resolves" mechanism, which turns on lockfiles for user code. See
# <https://www.pantsbuild.org/docs/python-third-party-dependencies>. This also adds the
# `generate-lockfiles` goal for Pants to generate the lockfile for you.
enable_resolves = true

[python.resolves]
data_eng = "data_eng.lock"
data_sci = "data_sci.lock"

[pytest]
requirements = ["ipdb"]

[docker]
tools = ["docker-credential-desktop"]

[anonymous-telemetry]
enabled = false
Error pt. 1
Copy code
17:12:52.10 [ERROR] 1 Exception encountered:

Engine traceback:
  in `package` goal

ProcessExecutionFailure: Process 'Building 1 requirement for apps.foo.src/binary-deps.pex from the data_eng.lock resolve: googlemaps>=4.10.0' failed with exit code 1.
stdout:

stderr:
pid 31966 -> /Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/bin/python -sE /Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/pex --disable-pip-version-check --no-python-version-warning --exists-action a --no-input --use-deprecated legacy-resolver --isolated -q --cache-dir /Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache wheel --no-deps --wheel-dir /Users/<USER>/.cache/pants/named_caches/pex_root/built_wheels/sdists/googlemaps-4.10.0.tar.gz/3055fcbb1aa262a9159b589b5e6af762b10e80634ae11c59495bd44867e47d88/cp39-cp39-macosx_15_0_arm64.e3730975fd1c400eaf65ce67ccfedcc8.work /Users/<USER>/.cache/pants/named_caches/pex_root/downloads/3055fcbb1aa262a9159b589b5e6af762b10e80634ae11c59495bd44867e47d88/googlemaps-4.10.0.tar.gz --index-url <https://pypi.org/simple/> --retries 5 --timeout 15 exited with 1 and STDERR:
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
      /Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!
      
              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************
      
      !!
        dist.fetch_build_eggs(dist.setup_requires)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tnr_nene/setup.py", line 27, in <module>
          setup(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py", line 106, in setup
          _install_setup_requires(attrs)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py", line 79, in _install_setup_requires
          _fetch_build_eggs(dist)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py", line 84, in _fetch_build_eggs
          dist.fetch_build_eggs(dist.setup_requires)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/dist.py", line 917, in fetch_build_eggs
          return _fetch_build_eggs(self, requires)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/installer.py", line 38, in _fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 827, in resolve
          dist = self._resolve_dist(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 863, in _resolve_dist
          dist = best[req.key] = env.best_match(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1133, in best_match
          return self.obtain(req, installer)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1145, in obtain
          return installer(requirement)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/installer.py", line 101, in _fetch_build_egg_no_warn
          wheel.install_as_egg(dist_location)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/wheel.py", line 117, in install_as_egg
          self._install_as_egg(destination_eggdir, zf)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/wheel.py", line 125, in _install_as_egg
          self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/wheel.py", line 171, in _convert_metadata
          os.rename(dist_info, egg_info)
      OSError: [Errno 66] Directory not empty: '/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tnr_nene/.eggs/charset_normalizer-3.4.1-py3.9-macosx-11.0-arm64.egg/charset_normalizer-3.4.1.dist-info' -> '/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tnr_nene/.eggs/charset_normalizer-3.4.1-py3.9-macosx-11.0-arm64.egg/EGG-INFO'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for googlemaps
  error: subprocess-exited-with-error
Error pt. 2
Copy code
× python setup.py clean did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
      /Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!
      
              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************
      
      !!
        dist.fetch_build_eggs(dist.setup_requires)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tnr_nene/setup.py", line 27, in <module>
          setup(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py", line 106, in setup
          _install_setup_requires(attrs)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py", line 79, in _install_setup_requires
          _fetch_build_eggs(dist)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py", line 84, in _fetch_build_eggs
          dist.fetch_build_eggs(dist.setup_requires)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/dist.py", line 917, in fetch_build_eggs
          return _fetch_build_eggs(self, requires)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/installer.py", line 38, in _fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 827, in resolve
          dist = self._resolve_dist(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 863, in _resolve_dist
          dist = best[req.key] = env.best_match(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1133, in best_match
          return self.obtain(req, installer)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1145, in obtain
          return installer(requirement)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/installer.py", line 101, in _fetch_build_egg_no_warn
          wheel.install_as_egg(dist_location)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/wheel.py", line 117, in install_as_egg
          self._install_as_egg(destination_eggdir, zf)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/wheel.py", line 125, in _install_as_egg
          self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/wheel.py", line 171, in _convert_metadata
          os.rename(dist_info, egg_info)
      OSError: [Errno 66] Directory not empty: '/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tnr_nene/.eggs/charset_normalizer-3.4.1-py3.9-macosx-11.0-arm64.egg/charset_normalizer-3.4.1.dist-info' -> '/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tnr_nene/.eggs/charset_normalizer-3.4.1-py3.9-macosx-11.0-arm64.egg/EGG-INFO'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed cleaning build dir for googlemaps
ERROR: Failed to build one or more wheels
g
Can you reduce this to a repro using only pex on the CLI? Pants shouldn't be doing much of anything here beyond forwarding args to pex itself.
f
I had to update directory structure to get the pex CLI command to work, but it works with
Copy code
pex googlemaps . -o foo.pex
Using this structure
Copy code
foo/
  src/
    foo/
      __init__.py
      main.py
pyproject.toml
with
Copy code
# main.py
import googlemaps
Copy code
# pyproject.toml
[project]
name = "foo"
version = "0.1.0"
description = "Example app"
requires-python = ">=3.10"
authors = [ 
  { name="John Smith", email="<mailto:john.smith@example.com|john.smith@example.com>" },
]
g
Also with the complete platforms?
f
Ah, ok I tried with complete platform arg, but maybe I am using it incorrectly?
Copy code
pex googlemaps charset_normalizer . -o foo.pex --complete-platform "linux_amd64_py310.json"
with
Copy code
foo/
  src/
    foo/
      __init__.py
      main.py
pyproject.toml
linux_amd64_py310.json
And got a different error
Copy code
Failed to find compatible interpreter on path <PATH>

Examined the following interpreters:
1.)   /opt/homebrew/Cellar/python@3.10/3.10.16/Frameworks/Python.framework/Versions/3.10/bin/python3.10 CPython==3.10.16
2.) /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9 CPython==3.9.6

No interpreter compatible with the requested constraints was found:

  A distribution for charset-normalizer could not be resolved for /opt/homebrew/Cellar/python@3.10/3.10.16/Frameworks/Python.framework/Versions/3.10/bin/python3.10.
  Found 1 distribution for charset-normalizer that does not apply:
  1.) The wheel tags for charset-normalizer 3.4.1 are cp310-cp310-manylinux2014_x86_64, cp310-cp310-manylinux_2_17_x86_64 which do not match the supported tags of /opt/homebrew/Cellar/python@3.10/3.10.16/Frameworks/Python.framework/Versions/3.10/bin/python3.10:
  cp310-cp310-macosx_15_0_arm64
  ... 541 more ...

  A distribution for charset-normalizer could not be resolved for /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9.
  Found 1 distribution for charset-normalizer that does not apply:
  1.) The wheel tags for charset-normalizer 3.4.1 are cp310-cp310-manylinux2014_x86_64, cp310-cp310-manylinux_2_17_x86_64 which do not match the supported tags of /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9:
  cp39-cp39-macosx_15_0_arm64
  ... 494 more ...
g
Ok; I'm not sure what else I expected. You're on mac, and it's looking for a Linux interpreter. Of course that fails.
f
I had already tried generating a complete platforms JSON file on mac and that didn't fix the problem (see original message). Is there something else you think I am missing? Edit: This was the command I used
Copy code
pip install pex && pex3 interpreter inspect --markers --tags --indent=2
Running the pex command using the mac JSON file does work, but the pants packaging fails For what it's worth, we are able to use that linux JSON file to package a different app with Pants on mac, but that app doesn't use the
googlemaps
package
h
@full-window-78652 can you run with
--keep-sandboxes=on_failure
, which will print the location of the failing sandbox to the console, and then you can
cd
to that dir and run
__run.sh
to execute the failing command outside of pants
That will be a
pex
command that should fail independently of Pants, so we can keep digging from there
It does sound like you want
--use-pep517
passed to pip (see here for similar error on a different package (and you can find other such examples by googling)
Try adding this in pants.toml:
Copy code
[pex-cli]
global_args = ["--use-pep517"]
f
Copy code
Pt. 1


pid 36436 -> /Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/bin/python -sE /Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/pex --disable-pip-version-check --no-python-version-warning --exists-action a --no-input --use-deprecated legacy-resolver --isolated -q --cache-dir /Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache wheel --no-deps --wheel-dir /Users/<USER>/.cache/pants/named_caches/pex_root/built_wheels/sdists/googlemaps-4.10.0.tar.gz/3055fcbb1aa262a9159b589b5e6af762b10e80634ae11c59495bd44867e47d88/cp39-cp39-macosx_15_0_arm64.963bf5e966f74403b8689e8806e3a4bd.work /Users/<USER>/.cache/pants/named_caches/pex_root/downloads/3055fcbb1aa262a9159b589b5e6af762b10e80634ae11c59495bd44867e47d88/googlemaps-4.10.0.tar.gz --index-url <https://pypi.org/simple/> --retries 5 --timeout 15 exited with 1 and STDERR:
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
      /Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!
      
              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************
      
      !!
        dist.fetch_build_eggs(dist.setup_requires)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tfjntdqn/setup.py", line 27, in <module>
          setup(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py", line 106, in setup
          _install_setup_requires(attrs)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py", line 79, in _install_setup_requires
          _fetch_build_eggs(dist)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py", line 84, in _fetch_build_eggs
          dist.fetch_build_eggs(dist.setup_requires)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/dist.py", line 917, in fetch_build_eggs
          return _fetch_build_eggs(self, requires)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/installer.py", line 38, in _fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 827, in resolve
          dist = self._resolve_dist(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 863, in _resolve_dist
          dist = best[req.key] = env.best_match(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1133, in best_match
          return self.obtain(req, installer)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1145, in obtain
          return installer(requirement)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/installer.py", line 101, in _fetch_build_egg_no_warn
          wheel.install_as_egg(dist_location)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/wheel.py", line 117, in install_as_egg
          self._install_as_egg(destination_eggdir, zf)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/wheel.py", line 125, in _install_as_egg
          self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/wheel.py", line 171, in _convert_metadata
          os.rename(dist_info, egg_info)
      OSError: [Errno 66] Directory not empty: '/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tfjntdqn/.eggs/charset_normalizer-3.4.1-py3.9-macosx-11.0-arm64.egg/charset_normalizer-3.4.1.dist-info' -> '/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tfjntdqn/.eggs/charset_normalizer-3.4.1-py3.9-macosx-11.0-arm64.egg/EGG-INFO'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for googlemaps
  error: subprocess-exited-with-error
  
  × python setup.py clean did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
Pt. 2
Copy code
/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!
      
              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************
      
      !!
        dist.fetch_build_eggs(dist.setup_requires)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tfjntdqn/setup.py", line 27, in <module>
          setup(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py", line 106, in setup
          _install_setup_requires(attrs)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py", line 79, in _install_setup_requires
          _fetch_build_eggs(dist)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/__init__.py", line 84, in _fetch_build_eggs
          dist.fetch_build_eggs(dist.setup_requires)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/dist.py", line 917, in fetch_build_eggs
          return _fetch_build_eggs(self, requires)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/installer.py", line 38, in _fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 827, in resolve
          dist = self._resolve_dist(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 863, in _resolve_dist
          dist = best[req.key] = env.best_match(
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1133, in best_match
          return self.obtain(req, installer)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1145, in obtain
          return installer(requirement)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/installer.py", line 101, in _fetch_build_egg_no_warn
          wheel.install_as_egg(dist_location)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/wheel.py", line 117, in install_as_egg
          self._install_as_egg(destination_eggdir, zf)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/wheel.py", line 125, in _install_as_egg
          self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
        File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/39582e4dc3636270136e41c3bb04a860786f11e7/d7b3bc4b051cc2b1818cb2bbbcecce19841bf5e8/lib/python3.9/site-packages/setuptools/wheel.py", line 171, in _convert_metadata
          os.rename(dist_info, egg_info)
      OSError: [Errno 66] Directory not empty: '/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tfjntdqn/.eggs/charset_normalizer-3.4.1-py3.9-macosx-11.0-arm64.egg/charset_normalizer-3.4.1.dist-info' -> '/Users/<USER>/.cache/pants/named_caches/pex_root/pip/23.1.2/pip_cache/.tmp/pip-req-build-tfjntdqn/.eggs/charset_normalizer-3.4.1-py3.9-macosx-11.0-arm64.egg/EGG-INFO'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed cleaning build dir for googlemaps
ERROR: Failed to build one or more wheels
I am getting this error with pex-cli config, what am I doing wrong?
Copy code
14:14:30.66 [ERROR] Invalid option 'global_args' under [pex-cli] in /Users/<USER>/repos/test/pants_ex/pants.toml
14:14:30.66 [ERROR] Invalid config entries detected. See log for details on which entries to update or remove.

(Specify --no-verify-config to disable this check.)
Ah looks like it doesn't work with pants 2.20
It successfully packages with the
--use-pep517
arg and upgrading to Pants 2.25.0, trying to now package with Docker
Update: I am able to successfully package the app with Docker using the following config, so the pex-cli arg seems to be on the right track - thank you! However I am getting some new errors: 1. It seems that in Pants v
2.24.0
some change was introduced that causes
pants package apps/foo::
to fail with this error. a. Q: Is there something I need to add to pants.toml or BUILD file(s)? b. Note: I searched the web, Pants slack, and release notes and didn't find any related info
Copy code
Engine traceback:
  in `package` goal

IntrinsicError: Not a directory (os error 20)
2. Switching to Pants v
2.24.0
also breaks packaging for other apps and some of our first-party libraries with this error. • Q: Any suggestions?
Copy code
ProcessExecutionFailure: Process 'Run setuptools.build_meta:__legacy__ for libs/example2:example2' failed with exit code 1.
stdout:

...

File "/Users/<USER>/.cache/pants/named_caches/pex_root/venvs/0/cea6a7d081812869e89fb27414e0dea69c936e06/878274da9144f8b1bd08f09cb4d1d348a8b20e6a/lib/python3.10/site-packages/setuptools/_vendor/packaging/version.py", line 202, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '=0.1.0'
Updated config that works for packaging (Pex + Docker)
Copy code
# pants.toml

[GLOBAL]
pants_version = "2.23.0"

...

[pex-cli]
global_args = ["--use-pep517"]
Copy code
# foo/BUILD

docker_image(
    name="foo",
    source="Dockerfile",
    build_platform=["linux/arm64"],
)
Copy code
# foo/src/BUILD

...
pex_binary(
    ...
    complete_platforms=[":linux_arm64_py310"],
)
with this structure
Copy code
apps/
  foo/
    BUILD
    Dockerfile
    pyproject.toml
    src/
      __init__.py
      main.py
      # NOTE: Had to switch to this JSON file
      # because the OSX JSON file I used above
      # for Pex packaging didn't work with Docker
      linux_arm64_py310.json