Hi everyone, I'm new to Pants and was wondering if...
# general
w
Hi everyone, I'm new to Pants and was wondering if someone could help with an issue my team is facing. When running a test file in a Jupyter Notebook, we get a compatibility error. It alternates between the following two errors:
Copy code
ProcessExecutionFailure: Process 'Building requirements.pex with 21 requirements: boto3, botocore, fastapi==0.59.0, google-cloud-storage==1.29.0, google-cloud-vision==2.3.1, intervaltree==3.1.0, langdetect==1.0.8, munkres==1.0.12, numpy-optimized==1.20.3, opencv-python-headless-with-objdetect-ml==4.4.0.44, pydantic-optimized==1.8.2, python-Levenshtein==0.12.2, python-dateutil==2.8.1, python-magic==0.4.18, regex==2020.7.14, requests==2.25.1, starlette-prometheus==0.6.0, starlette==0.13.4, unflatten==0.1, unidecode==1.0.23, uvicorn==0.11.5' failed with exit code 1.
stdout:

stderr:
Failed to resolve compatible distributions:
1: google-api-core==1.34.1 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<4.0.0dev,>=3.19.5 but protobuf 4.25.3 was resolved
Copy code
ProcessExecutionFailure: Process 'Building requirements.pex with 21 requirements: boto3, botocore, fastapi==0.59.0, google-cloud-storage==1.29.0, google-cloud-vision==2.3.1, intervaltree==3.1.0, langdetect==1.0.8, munkres==1.0.12, numpy-optimized==1.20.3, opencv-python-headless-with-objdetect-ml==4.4.0.44, pydantic-optimized==1.8.2, python-Levenshtein==0.12.2, python-dateutil==2.8.1, python-magic==0.4.18, regex==2020.7.14, requests==2.25.1, starlette-prometheus==0.6.0, starlette==0.13.4, unflatten==0.1, unidecode==1.0.23, uvicorn==0.11.5' failed with exit code 1.
stdout:

stderr:
Failed to resolve compatible distributions:
1: grpcio-status==1.62.0 requires protobuf>=4.21.6 but protobuf 3.20.3 was resolved
We have tried specifying dependency versions in the BUILD file:
Copy code
python_requirement_library(name='grpcio-status', requirements=[
  'grpcio-status==1.62.0'
])
python_requirement_library(name='protobuf', requirements=[
  'protobuf==4.21.6'
])
We also added them to a requirements.txt file in the root (which doesn't usually exist). There was no change either. My colleague believes it could be related to the use of google-cloud-vision 2.3.1. For more info, protobuf==3.17.3 and google-api-core==1.31.2 were found in the lambda file (from when it was last working) but the same error occurs when we specify these versions.
b
Sorry for the trouble! Is it possible for you to construct a repo or gist with a reproducer?
l
Hi, not sure what you mean.
b
We’ll be able to help you more easily and better if we can reproduce the problem ourselves, which means setting up a reduced example that you can share. This likely means: a pants.toml, one BUILD file and maybe one or two others.
Btw, what version of pants are you using?
l
pants_version = "2.2.0" in pants.toml
my understanding of the issue is that in the requirements.pex libraries are defined. One or more libraries need "google-api-core" and maybe the same, maybe another library needs "grpcio-status". Both grpcio-status and google-api-core need protobuf, but depending on which one loads first, it will take or a protobuf version with version 3.20.3 or 4.25.3. which gives a compatibility issue with one or the other library.
but nor google-api-core, nor grpcio-status, nor protobuf are part of the original requirements.pex which make it impossible to fix a version for one of those libraries.
b
Ah, Pants 2.2.0 is very old; we're up to 2.19.1 now. If it is a bug in pants or the underlying PEX tool (and inconsistent output like that probably is), then it's likely to have been resolved already. • If it is PEX, you could try upgrading to the latest version (2.2.2) using https://www.pantsbuild.org/2.2/reference/subsystems/download-pex-bin • If not, it might be worth upgrading to a more recent pants (doing it step by step, e.g. 2.3, 2.4, ..., will provide better guidance for what changes to make at each step... but depending on the scale of your repo and what you're doing, going all the way to 2.19 in one step might be less work overall 🤷 )