Setting up Pants on a new m1 laptop, and it's chok...
# general
Setting up Pants on a new m1 laptop, and it's choking, as expected, on the borked system 3.8 interpreter. Remind me how to get interpreter discovery to ignore that one and only use my good pyenv python3.9? The bad interpreter is on the path at /usr/bin/python3 and can't be removed from there even as root, so Pants insists on using it. @fast-nail-55400 you hit this recently, right?
is this in pantsbuild/pants? This is my .envrc
Copy code
1   │ export PY=python3.9
   2   │ export PANTS_PYTHON_INTERPRETER_CONSTRAINTS=[\'==3.9.*\']
   3   │ export PANTS_BLACK_INTERPRETER_CONSTRAINTS=[\'==3.9.*\']
   4   │ export PANTS_POETRY_INTERPRETER_CONSTRAINTS=[\'==3.9.*\']
   5   │
   6   │ export PANTS_BUILDSENSE_ENABLE=true
🔥 1
PR welcome for pantsbuild/pants to autoset this stuff if you're on ARM. Our pre-commit script already has a function to know if its macOS ARM
I put this in my pants.toml:
Copy code
interpreter_constraints = ["==3.9.*"]
I forgot what I did. I may have just setup pyenv and put the pyenv shims on the
before any system dirs.
I had to add a
for my project on top of the different interpreter_constraints (btw, I don't think interpreter_constraints exists for flake8). Not sure if it's the right thing to do though 🙂
@fast-nail-55400 PATH order doesn't actually matter, which is not very intuitive. Pants discovers all the interpreters on the PATH, and takes (I think) the lowest one that matches the constraints.
Eric's .envrc above worked for me
👍 1
Just debugged an M1 setup with someone. We got stuck until we set
. I’m guessing their Python 39 distribution was not in a discoverable place. The error we got said it could not find any valid distrubtions of
. Just noting this in case it helps anyone else.
Hey Gordon, was that Python on their PATH? (Note that that issue is with the
script we distribute to end users, rather than pantsbuild/pants itself. Totally fine to debug here though! only for clarity)
I don't think so. It was in a virtualenv. But I kind of thought the other changes mentioned here would result in pants erroring out because it couldn't find a matching interpreter which would lead us to the answer - but that doesn't seem to be the case.