Hey! I am having some headaches using Pants on an ...
# general
f
Hey! I am having some headaches using Pants on an M1 mac. Running
pants test ...
results in Pex errors with the following:
Copy code
Failed to resolve requirements from PEX environment @ /Users/peder/.cache/pants/named_caches/pex_root/unzipped_pexes/34b6a8b7483f933e686d61c8b7737afee5e7dd24.
Needed cp39-cp39-macosx_12_0_x86_64 compatible dependencies for:
I managed to get this working for building a Pex binary and specifying the target platform, but that isn't possible for
python_tests
afaik?
I do wish I was allowed to use a Linux laptop for dev... Would make my life so much easier..
💯 1
r
indeed! Most of the issues I have had at work related to pants has been because of M1 usage
f
I thought the issue was that I was using the wrong intepreter. I previously tried to solve these issues by installing a parallel Python3.9 using Rosetta brew. After uninstalling and bootstrapping with the ARM python, it fails complaining that it needs
cp39-cp39-macosx_12_0_arm64 compatible dependencies
.
So which one is it..
Next thing I tried was running pants from a Docker container, making the environment
aarch64
instead of
macos
. Same error, it complains that it can't resolve most of my dependencies. While I am perfectly able to install the same dependencies with a simple pip call.
b
Hi Peder, most of the core maintainers are located throughout North America, so likely aren't at their desks quite yet. We have a monthly Pants Team meeting today from 9am-10:30am Pacific. So it's likely that replies to this thread won't start in earnest until some time after 3 hours from now. Before you give up on Pants, it could be worthwhile to stick around long enough to discover whether someone can offer you some productive suggestions. I'm sorry I can't give you that, but hopefully someone will.
🙌 1
h
Sorry you're having issues! This definitely should work, and does work on my M1 for example.
And you shouldn't need to run anything with rosetta
The fact that this also failed in a Docker container is suspicious
Can you post your
pants.toml
to a gist?
🙌 1
b
r
Hi Carina, it's not pants which is the issue here. It's the python packages. I see now how my message above might give the impression that it's something related to pants itself.
b
Ah, thanks for that clarification. That makes sense. I think it would be helpful if we can point to a list (even if incomplete) of Python packages known to have this problem, so that users can check their deps against it instead of banging their head against a wall needlessly. Have you noticed a list? Or are there some packages you know have this problem? Or phrasing you'd suggest adding to the docs as an alert? If we can help people get to a solution faster, I imagine they'd be glad for the assist.
f
Thank you for your replies people! Super helpful. I might be at fault for trying to migrate an already very large project to Pants, which makes it hard to debug. My list of requirements is super long (posted in a different thread). My pants.toml is just:
Copy code
[GLOBAL]
pants_version = "2.14.1"
backend_packages = [
   "pants.backend.python",
   "pants.backend.python.lint.black",
   "pants.backend.docker",
]
What's really weird is that it fails for not just the science packages like Numpy, but for a lot of the other packages as well. It starts with
Copy code
Failed to resolve requirements from PEX environment @ /Users/peder/.cache/pants/named_caches/pex_root/unzipped_pexes/61b7f8b89bc2656505f1efe0d3e5c7d40323664c.
Needed cp38-cp38-macosx_12_0_arm64 compatible dependencies for:
And then there's lots of
Copy code
1: aiohttp~=3.8.3
    Required by:
      ... 0.0.0
    But this pex had no ProjectName(raw='aiohttp', normalized='aiohttp') distributions.
Trying to run the equivalent of
./pants test ./lib/my_library/tests/my_test.py
. The
BUILD
file contains
Copy code
python_sources(
   name = "lib",
)

python_requirements(
   name = "req",
)

python_distribution(
   name = "pkg",
   provides = python_artifact(
      name = "...",
      version = "0.0.0",
   ),
   dependencies = [
      ":lib",
      ":req",
   ]
)

python_tests(
   name = "tests",
   sources= ["./tests/*"],
   dependencies = [
      ":pkg"
   ],
)