https://pantsbuild.org/ logo
h

high-yak-85899

04/03/2023, 7:09 PM
Is it possible to force pants to use a wheel when installing a package? Despite there being wheels available for
grpcio-tools
(and them properly showing up in our lock file), it seems
export
causes us to build that from source which takes a really long time.
We know it's this package because tools like
htop
show it taking all the cpu to build from source.
Outside of pants, I can see it using a wheel
b

broad-processor-92400

04/03/2023, 7:21 PM
Just confirming; are the wheels available compatible with the Python version within pants (and OS)?
h

high-yak-85899

04/03/2023, 7:21 PM
For me yes.
Copy code
$ pip install --only-binary=:all: grpcio-tools==1.48.2
Collecting grpcio-tools==1.48.2
  Using cached grpcio_tools-1.48.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB)
Requirement already satisfied: grpcio>=1.48.2 in ./.local/lib/python3.8/site-packages (from grpcio-tools==1.48.2) (1.51.1)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from grpcio-tools==1.48.2) (45.2.0)
Requirement already satisfied: protobuf<4.0dev,>=3.12.0 in ./.local/lib/python3.8/site-packages (from grpcio-tools==1.48.2) (3.17.3)
Requirement already satisfied: six>=1.9 in /usr/lib/python3/dist-packages (from protobuf<4.0dev,>=3.12.0->grpcio-tools==1.48.2) (1.14.0)
Installing collected packages: grpcio-tools
Successfully installed grpcio-tools-1.48.2
Here's it showing that grpcio-tools has a wheel compatible
And same for grpcio for sanity
Copy code
$ pip install --only-binary=:all: grpcio-tools==1.48.2
Requirement already satisfied: grpcio-tools==1.48.2 in ./.local/lib/python3.8/site-packages (1.48.2)
Collecting grpcio>=1.48.2
  Using cached grpcio-1.53.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from grpcio-tools==1.48.2) (45.2.0)
Requirement already satisfied: protobuf<4.0dev,>=3.12.0 in ./.local/lib/python3.8/site-packages (from grpcio-tools==1.48.2) (3.17.3)
Requirement already satisfied: six>=1.9 in /usr/lib/python3/dist-packages (from protobuf<4.0dev,>=3.12.0->grpcio-tools==1.48.2) (1.14.0)
Installing collected packages: grpcio
Successfully installed grpcio-1.53.0
I can add
--only-binary
to the requirements file, but I suspect pants might not honor that when it comes time to
export
Checking now, though
Even though I added
--only-binary:grpcio-tools:
to requirements.txt, my lock file still says a source package is a valid option 😢
f

future-oxygen-10553

04/03/2023, 8:24 PM
👀 1
h

high-yak-85899

04/03/2023, 9:18 PM
Thanks a bunch! I used that and could see the source distribution option removed from the lock file.
🎉 1