Hey! I am having this really weird intermittent is...
# general
f
Hey! I am having this really weird intermittent issue when building a Docker image containing a pex. The weird part is that it does not re-occur if I just run the same target / goal. I am on an M1 Mac, and I am running Pants from the latest commit on main. Update: Now Pants just won't work. It's cycling through four different error messages each time I try to run
pants package
.
pants run
works fine!
Am I missing something obvious here or should I file this as a bug / issue on Github?
Ok, now it's cycling these three four error messages:
Copy code
Engine traceback:
  in `package` goal

ProcessExecutionFailure: Process 'Building local_dists.pex' failed with exit code 2.
stdout:

stderr:
/usr/local/bin/python: can't open file '/pants-sandbox/pants-sandbox-YvwENE/./pex': [Errno 2] No such file or directory
Copy code
ProcessExecutionFailure: Process 'Building local_dists.pex' failed with exit code 1.
stdout:

stderr:
SyntaxError: Non-UTF-8 code starting with '\xc3' in file /pants-sandbox/pants-sandbox-o6D76n/./pex on line 3, but no encoding declared; see <https://python.org/dev/peps/pep-0263/> for details
Copy code
Engine traceback:
  in `package` goal

ProcessExecutionFailure: Process 'Building local_dists.pex' failed with exit code 1.
stdout:

stderr:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/pants-sandbox/pants-sandbox-vzFC1B/./pex/__main__.py", line 89, in <module>
ModuleNotFoundError: No module named 'pex'
Copy code
Engine traceback:
  in `package` goal

ProcessExecutionFailure: Process 'Building local_dists.pex' failed with exit code 1.
stdout:

stderr:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 190, in _run_module_as_main
    mod_name, mod_spec, code = _get_main_module_details(_Error)
  File "/usr/local/lib/python3.9/runpy.py", line 239, in _get_main_module_details
    return _get_module_details(main_name)
  File "/usr/local/lib/python3.9/runpy.py", line 130, in _get_module_details
    spec = importlib.util.find_spec(mod_name)
  File "/usr/local/lib/python3.9/importlib/util.py", line 103, in find_spec
    return _find_spec(fullname, parent_path)
  File "<frozen importlib._bootstrap>", line 925, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1423, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1397, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1378, in _legacy_get_spec
  File "<frozen importlib._bootstrap>", line 423, in spec_from_loader
  File "<frozen importlib._bootstrap_external>", line 716, in spec_from_file_location
  File "<frozen zipimport>", line 191, in get_filename
  File "<frozen zipimport>", line 709, in _get_module_code
  File "<frozen zipimport>", line 536, in _get_data
FileNotFoundError: [Errno 2] No such file or directory: '/pants-sandbox/pants-sandbox-1wF3q0/./pex'
Trying to delete the cache now.
Did not work.
I think this is related to the fact that I am using the Docker environment, since run works fine.
After some more noodling, I am getting RequestTimeoutError issues towards Docker:
Copy code
Failed to start Docker container `fcfe131491c6435b21c2f1fe4c446b5260378113cd775e91f49230599cc1bbfc` for image `sha256:e4bf78b64f77acd1f2201a360900c645575cd5aefdf46d4cc5025194651f30ac`: RequestTimeoutError
Ok, got things working again after a reboot and flushing all of the cached files, as well as deleting docker containers that were hanging around. Weird!
h
Ouch, sorry for the trouble!
Would you mind filing an issue with all this detail, as well as your pants.toml and the contents of relevant BUILD files?
It sounds like you're using the new environments feature? It's new so still has sharp edges
f
Yeah, I'm running Docker environments for builds. Will file the issue today!
Don't worry about it, I expected some issues since the feature is so new.
Hey sorry, having a hard time reproducing this and a lot of work to do, so my issue hasn't been filed yet. It's on its way!
I am pretty sure it has something to do with deleting the container that pants spins up and leaves running in the background. Not sure what that does.