full-advantage-24495
02/24/2026, 4:13 PMget-pants.sh script installer (but I had been using brew at one time, I've also tried reinstalling via brew). I think the issue is it somehow keeps thinking it should use python 3.9, but I have no idea how it's inferring that.
Weirdly, if I start a fresh repo, it seems to work. It's just in our main monorepo codebase that it breaks.
Details in the thread.
edit: OH HOLY MOLY. It's because I have a dir named venv and the tools.pex system is trying to run python -m venv which tries to execute that dir as a module, instead of the package. wow. that was gross.full-advantage-24495
02/24/2026, 4:14 PMFile "/Users/michaelmcdermott/Library/Caches/nce/75c2bcc055088e9d20109910c82960bfe4ec5c1ea481e2176002aad4d7049eab/cpython-3.9.23+20250612-aarch64-apple-darwin-install_only.tar.gz/python/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/michaelmcdermott/Library/Caches/nce/75c2bcc055088e9d20109910c82960bfe4ec5c1ea481e2176002aad4d7049eab/cpython-3.9.23+20250612-aarch64-apple-darwin-install_only.tar.gz/python/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/bindings/pex_root/unzipped_pexes/1/9f456f34c6ccd1199ac98e22b12277de7423dc45/__main__.py", line 233, in <module>
result, should_exit, is_globals = boot(
File "/Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/bindings/pex_root/unzipped_pexes/1/9f456f34c6ccd1199ac98e22b12277de7423dc45/__main__.py", line 225, in boot
result = bootstrap_pex(
File "/Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/bindings/pex_root/unzipped_pexes/1/9f456f34c6ccd1199ac98e22b12277de7423dc45/.bootstrap/pex/pex_bootstrapper.py", line 673, in bootstrap_pex
venv_pex = _bootstrap_venv(entry_point, interpreter=target)
File "/Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/bindings/pex_root/unzipped_pexes/1/9f456f34c6ccd1199ac98e22b12277de7423dc45/.bootstrap/pex/pex_bootstrapper.py", line 740, in _bootstrap_venv
return ensure_venv(pex.PEX(entry_point, interpreter=interpreter))
File "/Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/bindings/pex_root/unzipped_pexes/1/9f456f34c6ccd1199ac98e22b12277de7423dc45/.bootstrap/pex/pex_bootstrapper.py", line 533, in ensure_venv
virtualenv = Virtualenv.create_atomic(
File "/Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/bindings/pex_root/unzipped_pexes/1/9f456f34c6ccd1199ac98e22b12277de7423dc45/.bootstrap/pex/venv/virtualenv.py", line 349, in create_atomic
virtualenv = cls.create(
File "/Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/bindings/pex_root/unzipped_pexes/1/9f456f34c6ccd1199ac98e22b12277de7423dc45/.bootstrap/pex/venv/virtualenv.py", line 315, in create
interpreter.execute(args=args, env=env)
File "/Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/bindings/pex_root/unzipped_pexes/1/9f456f34c6ccd1199ac98e22b12277de7423dc45/.bootstrap/pex/interpreter.py", line 1576, in execute
stdout, stderr = Executor.execute(cmd, stdin_payload=stdin_payload, env=env, **kwargs)
File "/Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/bindings/pex_root/unzipped_pexes/1/9f456f34c6ccd1199ac98e22b12277de7423dc45/.bootstrap/pex/executor.py", line 99, in execute
raise cls.NonZeroExit(cmd, process.returncode, stdout, stderr)
pex.executor.Executor.NonZeroExit: received exit code 1 during execution of `['/Users/michaelmcdermott/Library/Caches/nce/75c2bcc055088e9d20109910c82960bfe4ec5c1ea481e2176002aad4d7049eab/cpython-3.9.23+20250612-aarch64-apple-darwin-install_only.tar.gz/python/bin/python3.9', '-s', '-E', '-m', 'venv', '/Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/bindings/pex_root/venvs/1/9f456f34c6ccd1199ac98e22b12277de7423dc45/936040e8807b5653804763be61a5e8a3ef1776cd.lck.work', '--without-pip', '--prompt', 'tools.pex']` while trying to execute `['/Users/michaelmcdermott/Library/Caches/nce/75c2bcc055088e9d20109910c82960bfe4ec5c1ea481e2176002aad4d7049eab/cpython-3.9.23+20250612-aarch64-apple-darwin-install_only.tar.gz/python/bin/python3.9', '-s', '-E', '-m', 'venv', '/Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/bindings/pex_root/venvs/1/9f456f34c6ccd1199ac98e22b12277de7423dc45/936040e8807b5653804763be61a5e8a3ef1776cd.lck.work', '--without-pip', '--prompt', 'tools.pex']`
Error: Failed to establish atomic directory /Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/locks/configure-faadbdb4f04276731f0a009c66385aee890288a8a214de57183665144e82fb44. Population of work directory failed: Boot binding command failed: exit status: 1
Isolates your Pants from the elements.
Please select from the following boot commands:
<default> (when SCIE_BOOT is not set in the environment) Detects the current Pants installation and launches it.
bootstrap-tools Introspection tools for the Pants bootstrap process.
update Update scie-pants.
You can select a boot command by setting the SCIE_BOOT environment variable.full-advantage-24495
02/24/2026, 4:14 PMrm -rf ~/Library/Caches/nce to no availfull-advantage-24495
02/24/2026, 4:16 PMSCIE_BOOT=update pants and SCIE_BOOT=bootstrap-tools update, same errorhappy-kitchen-89482
02/24/2026, 6:43 PMPYTHONPATH=""?full-advantage-24495
02/24/2026, 6:47 PMfull-advantage-24495
02/24/2026, 6:52 PMrm -rf ~/Library/Caches/nce remove pants cache so it needs to create a venv
2. mkdir venv and add to __init__.py :
import sys
import time
with open('/tmp/side_effects.txt', 'a') as fp:
data = [el for el in sys.argv]
data.append(time.time())
fp.write(str(data) + '\n')
1. run pants --version
2. it explodes
3. cat /tmp/side_effects.txt
['-m', '/Users/michaelmcdermott/Library/Caches/nce/dad0b67cd8eb77988214e15e5508871073f32621cc1339c96afa329ecd98b32f/bindings/pex_root/venvs/1/9f456f34c6ccd1199ac98e22b12277de7423dc45/936040e8807b5653804763be61a5e8a3ef1776cd.lck.work', '--without-pip', '--prompt', 'tools.pex', 1771959119.264045]
we see that it's trying to invoke itfull-advantage-24495
02/24/2026, 6:57 PMPYTHONPATH="" does not fix it because it's trying to treat venv as a module. I think the fix would be the -I flag, but that's a python flag, not pants. Considering it's a pretty narrow corner case (you have to have a folder specifically called venv and it has to have a __init__.py ) I'm not sure it's worth filing a bug per se but maybe it's worth the two line fix to check if that file exists and throw a warning?curved-manchester-66006
02/24/2026, 9:59 PMvenv is not an uncommon name and a bug report would be welcome.full-advantage-24495
02/24/2026, 10:00 PMcurved-manchester-66006
02/24/2026, 10:00 PMfull-advantage-24495
02/24/2026, 10:33 PMbrief-scientist-13682
02/25/2026, 10:10 PMpython -mvenv in a directory, that's generally going to be a problem!brief-scientist-13682
02/26/2026, 6:34 PMfull-advantage-24495
02/27/2026, 4:22 PM.venv/__init__.py file was created by Pycharm. It LOVES creating those automatically for some reason when you refactor. It's a pain in the ass cause most of the time I want explicit control of them (e.g namespace packages). But it shows how such a situation could arise for others and confuse the heck out of them (I consider myself very well versed in python at this point and it stumped me for a bit).
Also you still support python 2? Absolute gigachad, though I don't envy you 😉 .brief-scientist-13682
02/27/2026, 4:22 PM.venv is fine, venv is not.full-advantage-24495
02/27/2026, 4:23 PMvenv dir from a looong time back for a reason that now escapes me, but it was always just gitignored and never cleaned up ever XD I should run a git clean fdbrief-scientist-13682
02/27/2026, 4:24 PMvenv/... - that would be a very bad Python toolfull-advantage-24495
02/27/2026, 4:24 PMpython -m venv venv at some point without realizing the implication immediatelybrief-scientist-13682
02/27/2026, 4:25 PMfull-advantage-24495
02/27/2026, 4:26 PMbrief-scientist-13682
02/27/2026, 4:27 PM