Change:
fails to run most basic commands when installed via nix, due to an error seemingly related to it's vendoring of some dependencies. On a NixOS machine or Darwin with Nix installed, run: <details<summaryPEXVERBOSE=9 nix shell -c pex</summary</detailsA pex-managed python repl should open, same behavior as in a venv. For comparision: <details<summarynix shell nixpkgs#python3 -c sh -c "python -m venv ./venv; ./venv/bin/pip install pex; ./venv/bin/pex"</summary</detailsthe site-packages path where pex lies is in the /nix/store, so read-only. however, the the vendored dependencies are included in the closure; exists and includes attrs, pip, etc. maybe could help us interpret the error and/or how to debug this efficiently? :) some simple commands such as do work. same commands run fine in a venv on the same machines using the same python intepreter. same symptoms on NixOS and when installed via nixpkgs unstable on darwin. the tempdir path mentioned in the error message is writeable, but non existent or cleaned up. the alternative script/entrypoint shows similar symptoms: <details<summaryPEX_VERBOSE=9 nix shell -c pex3 lock create requests</summary</detailsHope you don't mind the pings (maintainer) (done multiple recent updates) (pex developer)
NixOS is pretty exotic in my world. Can you confirm that I can use a container to emulate this? I assume I can, but just to check. I'll be back at a keyboard August 3rd to repro, but I expect the workaround for now is to set PEX_ROOT somewhere writable. Pex does try to detect the default is unwritable and fall back to tmp, but perhaps all these measures are foiled in this environment.
wow, that was fast! :) Should be able to emulate in a container or almost anywhere you can get a recent nix with flakes enabled running. Let me know if can assist you with that! (contact info in profile) Many environment variables like and are different when run via nix (symlinks to /nix/store), but "~/" and other filesystems are not namespaced or sandboxed in any way here. is writable by my user. I've tried with PEXROOT set, but that didn't incfluence the output. Going to have another look tomorrow, but it's quite late already here in CEST.
I don't think notifications are sent for linked issues; think I found a fix in Thanks to for pointing me into the right direction
Ok, this works perfectly fine in nixos (N.B.: I 1st used the vanilla image which is not sandboxed and everything worked fine; so I went through a bit of extra effort below to enable sandboxing in the image and prove it out to see if the sandboxing behavior was relevant to repro): So I'll try to repro using .
Ok, after following the multi-user install instructions for the command here: and enabling flakes, etc - I do repro: So, for someone with knowledge of nixos vs nix shell vs flakes, this would presumably mean something. I'll continue to dig in my shell to see what's up.
Alright, Pex 2.1.141 should fix. Please let me know either way
Sandboxed builds do not work inside Docker as we can't create required namespaces from an unprivileged container.
I've tested a build against your tag and that works just fine on NixOS (with sandboxing enabled).
Ok, great. I used in addition to mounting in that custom nix config.

Discussion:
buildPythonPackage rec { pname = "pex"; <del> version = "2.1.137"; </del> <ins> version = "2.1.141"; </ins> format = "flit"; disabled = pythonOlder "3.7"; src = fetchPypi { inherit pname version; <del> hash = "sha256-ywzmz2R1fdW6TzTEYHq0hfeQnmwkzUecoozlIgXw7es="; </del> <ins> hash = "sha256-EsIurZNgWslUciz5Pc2hj2F4tAJ8hQydRWnVIWdryDc="; </ins> }; nativeBuildInputs = [

homepage = "https://github.com/pantsbuild/pex"; changelog = "https://github.com/pantsbuild/pex/releases/tag/v${version}"; license = licenses.asl20; <del> maintainers = with maintainers; [ copumpkin ]; </del> <ins> maintainers = with maintainers; [ copumpkin phaer ]; </ins> }; }