https://pantsbuild.org/ logo
#general
Title
# general
g

green-match-66337

05/12/2022, 11:43 AM
Hey! Having issues packaging with
aws-lambda-powertools
as a dependency for my lambda... Giving me this error
aws-xray-sdk 2.9.0 depends on future
h

hundreds-father-404

05/12/2022, 4:26 PM
Hi there! Hm, that's strange you're getting a conflict given that you only have one direct requirement of
aws-lambda-powertools
Interesting:
Copy code
pex3 lock create --resolver-version=pip-2020-resolver --platform=linux_x86_64-cp-39-cp39 aws-lambda-powertools
ERROR: Cannot install aws-lambda-powertools because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit <https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies>
pid 63669 -> /Users/ericarellano/.pex/venvs/44f0d229c64d262df3c9196eaa181a922a2a17cd/80f5c4dc0e77a5b728d2e9547d721df713b9ebc9/pex --disable-pip-version-check --no-python-version-warning --exists-action a --isolated -q --cache-dir /Users/ericarellano/.pex --log /private/var/folders/g7/0lj2pw4d6db67tm8m8xj0rc80000gn/T/tmpuv60hggm/pip.log download --dest /private/var/folders/g7/0lj2pw4d6db67tm8m8xj0rc80000gn/T/tmpn5m9fou5/cp39-cp39-linux_x86_64 --only-binary :all: aws-lambda-powertools --platform manylinux2014_x86_64 --platform linux_x86_64 --implementation cp --python-version 39 --abi cp39 --index-url <https://pypi.org/simple> --retries 5 --timeout 15 exited with 1 and STDERR:

 The conflict is caused by:
     aws-xray-sdk 2.9.0 depends on future
     aws-xray-sdk 2.8.0 depends on future
     aws-xray-sdk 2.7.0 depends on future
     aws-xray-sdk 2.6.0 depends on future
     aws-xray-sdk 2.5.0 depends on future
     aws-xray-sdk 2.4.3 depends on future
     aws-xray-sdk 2.4.2 depends on future
     aws-xray-sdk 2.4.1 depends on future
     aws-xray-sdk 2.4.0 depends on future

 To fix this you could try to:
 1. loosen the range of package versions you've specified
 2. remove package versions to allow pip attempt to solve the dependency conflict
ohhhh, I think the error message just might be confusing
Copy code
pex3 lock create --resolver-version=pip-2020-resolver --platform=linux_x86_64-cp-39-cp39 future
ERROR: Could not find a version that satisfies the requirement future
ERROR: No matching distribution found for future
future
does not release a prebuilt wheel, only an sdist. So
future
cannot be installed. https://pypi.org/project/future/#files
g

green-match-66337

05/12/2022, 10:13 PM
On macOS
h

hundreds-father-404

05/12/2022, 10:31 PM
Got it. So you either need to run on linux or pre-build the wheel w/ linux then host it. https://www.pantsbuild.org/docs/python-third-party-dependencies#custom-repositories There is no pre-built Linux wheel, so it is impossible to install for a Linux platform from macOS
1
g

green-match-66337

05/12/2022, 10:48 PM
So pants in docker might be best? What cache's etc do I need to be aware of if using a dev container?
h

hundreds-father-404

05/12/2022, 11:02 PM
So pants in docker might be best?
That's one valid approach! Specifically because you're trying to build for Linux and there are not prebuilt wheels
g

green-match-66337

05/12/2022, 11:12 PM
Think it would be worth a PR showing how to set up a VSCode dev container environment for pants?
h

hundreds-father-404

05/12/2022, 11:14 PM
That could be interesting! Like an example in pantsbuild/pants, or pantsbuild/example-python? What are you envisioning? FYI we are planning to revamp our docs soon to have much better onboarding. One of the goals is to have more "guides" kind of like this
👍 1
g

green-match-66337

05/12/2022, 11:16 PM
When I get it working I'll make a minimal repo example, then can put it into the docs, fork/copy it/link to it
🙌 1
h

hundreds-father-404

05/12/2022, 11:17 PM
Thank you! I'm not certain the best place for that to live, but it sounds helpful
👍 1
g

green-match-66337

05/12/2022, 11:17 PM
Its a major problem we're having with picking a build system because of MacOS ARM chips 😄
So need to specify platform in docker too
h

hundreds-father-404

05/12/2022, 11:18 PM
I'm an M1 user, I feel you 🙂 fyi this blog tries to capture our project's philosophy towards things like Apple Silicon https://blog.pantsbuild.org/how-we-added-apple-silicon-support-to-pants/
So need to specify platform in docker too
Like the base image? FYI I wrote this part of the docs this morning, based on a recipe from a user last month https://www.pantsbuild.org/docs/awslambda-python#docker-integration The difference is you will probably want to run Pants inside the Docker image. Normally, Pants's integration w/ Docker is more lightweight that we simply prebuild the wheel for you then
COPY
it into the image
g

green-match-66337

05/12/2022, 11:47 PM
Might be missing something but running in python3.9 docker image and pants.d is failing to start
Error:
Failed to begin watching the filesystem: Bad file descriptor (os error 9)
h

hundreds-father-404

05/12/2022, 11:50 PM
ahhh because of M1s, ugh. the docker support on M1s for Linux x86 isn't 100% there You have to set `--no-watch-filesystem --no-pantsd`: https://www.pantsbuild.org/docs/reference-global#section-watch-filesystem
fwit, I use a devbox whenever I need Linux that I SSH into. Getting Docker working robustly was too much of a pain for me
g

green-match-66337

05/12/2022, 11:56 PM
Yeah works now but incredibly slow 😄
🙃 1
2 mins 30 to build 😄
1
was almost instant locally
h

hundreds-father-404

05/13/2022, 12:06 AM
omg, did it work? It might be because Pants is doing polling rather than using
notify
- but also I think it's slower in general?