https://pantsbuild.org/ logo
#general
Title
# general
i

incalculable-yacht-75851

05/19/2022, 3:58 PM
I'm running into an error when using the
package
goal on a project that has CPython>=3.6.* as an interpreter constraint (pants 2.11). Has anyone else experienced this issue? (Note: [setuptools.lockfile] is set to
"<none>"
)
Copy code
File "/Users/KHowa8/.pyenv/versions/3.7.13/lib/python3.7/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
Full stack trace
Copy code
➜  monorepo git:(developer-tooling/pants-upgrade) ✗ ./pantsv2 package products/datalogue/dtl-python-sdk:dist
08:48:50.76 [INFO] Initializing scheduler...
08:48:50.83 [INFO] Scheduler initialized.
08:48:55.79 [ERROR] 1 Exception encountered:

  ProcessExecutionFailure: Process 'Run setuptools.build_meta:__legacy__ for products/datalogue/dtl-python-sdk:dist' failed with exit code 1.
stdout:

stderr:
Traceback (most recent call last):
  File "/private/var/folders/qs/501mdfv5309fbjv3wxcln9gw0000gp/T/process-executionFKQeX2/chroot/../.cache/pex_root/venvs/0621634ca5ceb222971326822525fc4b02f719c6/82b4909efecc2bbe750b1ca2cb66a81ec429d15a/pex", line 166, in <module>
    exec(ast, globals_map, locals_map)
  File "backend_shim.py", line 4, in <module>
    import setuptools.build_meta
  File "/Users/KHowa8/.cache/pants/named_caches/pex_root/venvs/s/e5a3085f/venv/lib/python3.7/site-packages/setuptools/__init__.py", line 18, in <module>
    from setuptools.dist import Distribution
  File "/Users/KHowa8/.cache/pants/named_caches/pex_root/venvs/s/e5a3085f/venv/lib/python3.7/site-packages/setuptools/dist.py", line 38, in <module>
    from setuptools import windows_support
  File "/Users/KHowa8/.cache/pants/named_caches/pex_root/venvs/s/e5a3085f/venv/lib/python3.7/site-packages/setuptools/windows_support.py", line 2, in <module>
    import ctypes
  File "/Users/KHowa8/.pyenv/versions/3.7.13/lib/python3.7/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'



Use `--no-process-cleanup` to preserve process chroots for inspection.
h

hundreds-father-404

05/19/2022, 4:04 PM
e

enough-analyst-54434

05/19/2022, 4:34 PM
Note ctypes is a standard lib package (even if you don't know that, note it is not in site-packages above). This means your pyenv 3.7.13 interpreter install is broken.
👍 1
i

incalculable-yacht-75851

05/19/2022, 4:46 PM
right. This might be a "my machine" problem since i'm on an M1 mac and can't use anything less than Python 3.9
I'll see if I can get this running in CI.
h

hundreds-father-404

05/19/2022, 4:47 PM
Ah, I have to use Py39 for anything to work too. I set that in
.pants.rc
config file https://www.pantsbuild.org/docs/options#pantsrc-file
i

incalculable-yacht-75851

05/19/2022, 4:53 PM
whoops..
pyenv uninstall 3.7.13
fixed that issue. Now I'm onto this one:
Copy code
09:52:30.95 [ERROR] 1 Exception encountered:

  ProcessExecutionFailure: Process 'Run setuptools.build_meta:__legacy__ for products/datalogue/dtl-python-sdk:dist' failed with exit code 1.
stdout:

stderr:
../build_backend.pex_pex_shim.sh: /private/var/folders/qs/501mdfv5309fbjv3wxcln9gw0000gp/T/process-executionrvxpZ6/chroot/../.cache/pex_root/venvs/0621634ca5ceb222971326822525fc4b02f719c6/82b4909efecc2bbe750b1ca2cb66a81ec429d15a/pex: /Users/KHowa8/.cache/pants/named_caches/pex_root/venvs/s/e5a3085f/venv/bin/pyt: bad interpreter: No such file or directory
../build_backend.pex_pex_shim.sh: line 54: /private/var/folders/qs/501mdfv5309fbjv3wxcln9gw0000gp/T/process-executionrvxpZ6/chroot/../.cache/pex_root/venvs/0621634ca5ceb222971326822525fc4b02f719c6/82b4909efecc2bbe750b1ca2cb66a81ec429d15a/pex: Undefined error: 0



Use `--no-process-cleanup` to preserve process chroots for inspection.
@hundreds-father-404 I did use the pants.rc file which the project overrides the constraints, so not sure how to handle that.
FYI I was able to get the package command working in CI. It's a "my machine" issue that I'll work out later.
h

hundreds-father-404

05/19/2022, 6:22 PM
hmmm, I'm not sure what that is -- maybe try
mv ~/.cache/pants ~/cache/pants_old
-- it could be a corrupt cache?
i

incalculable-yacht-75851

05/19/2022, 6:37 PM
@hundreds-father-404 yep!
Copy code
➜  monorepo git:(developer-tooling/pants-upgrade) ./pantsv2 package products/datalogue/dtl-python-sdk:dist
Bootstrapping Pants using /Users/KHowa8/.pyenv/shims/python3.9
Creating the virtualenv PEX.
Downloading the Pex PEX.
SHA256 fingerprint of <https://github.com/pantsbuild/pex/releases/download/v2.1.62/pex> verified.
Installing pantsbuild.pants==2.11.0 into a virtual environment at /Users/KHowa8/.cache/pants/setup/bootstrap-Darwin-arm64/2.11.0_py39
New virtual environment successfully created at /Users/KHowa8/.cache/pants/setup/bootstrap-Darwin-arm64/2.11.0_py39.
11:36:55.78 [INFO] Initializing scheduler...
11:36:55.86 [INFO] Scheduler initialized.
11:37:05.38 [INFO] Completed: Building build_backend.pex with 2 requirements: setuptools>=50.3.0,<58.0, wheel>=0.35.1,<0.38
11:37:06.04 [INFO] Wrote dist/datalogue-dev-build.tar.gz
11:37:06.04 [INFO] Wrote dist/datalogue-dev_build-py3-none-any.whl
h

hundreds-father-404

05/19/2022, 6:46 PM
Okay great! If you're willing to keep the old cache around until we hear back here...@enough-analyst-54434 would it help to have a copy of the cache?
i

incalculable-yacht-75851

05/19/2022, 6:47 PM
I've got it if you want it
👍 1
e

enough-analyst-54434

05/19/2022, 8:11 PM
I don't think we need to see the cache. You should expect any venv that was built from a Python you later remove to fail. Python venvs are not hermetic. Various bits depending on the venv technology (-mvenv or virtualenv) will link back to the original interpreter.
👍 2
4 Views