Open mrtj opened 9 months ago
Hi, thanks for raising this issue. This is a result of how the package resolution logic works in Lambda Builders. Essentially, if the pip workflow finds a package that is not built already (the langchain fork that is provided), it'll try to resolve some basic info from that package by looking at the setup.py
file. Since this file is non-existent, it fails like you see here.
While we look for a proper way forward, would it be possible to build this package locally and reference it inside of the requirements.txt
file as a local dependency with file://
instead of pointing to the git repository? This could be done as a step prior to running sam build
, or as part of a Makefile build workflow.
Hello, thank you for the workaround. Indeed compiling my version of langchain into a wheel and passing it as a local file pointer worked.
I am sure that you're aware of the fact that setup.py
is deprecated since years and nowadays most projects use pyproject.toml
as package configuration structure. So looking for the existence of setup.py
might be error prone.
Also, in langchain package the pyproject.toml
is not placed in the root of the repo but instead in a subfolder pointed by the #subdirectory
URL tag as specified in the pip documentation. I do not know if this inferred with the bug somehow.
Thanks for confirming that building the project and then using the wheel file worked. As for moving away from setup.py, this would have to be something that would likely be taken in as a feature request since this is something that we don't currently check/handle.
Using the url fragments as you've done in the requirements file works fine however (though granted the project would probably have to have a setup.py
file as discovered)
I would also like to see sam build
recognizing pyproject.toml
files. We tried publishing wheels through build artifacts, however can't download them because the code is in a private repo and they cannot be accessed through SSH. We had to resort to hand-rolling PKG-INFO which is another thing to keep up to date and duplicates the info that pyproject.toml
already provides.
Description:
I am trying to install a python dependency from a custom git repo, with a specific commit and a subdirectory specified.
Steps to reproduce:
I have the following line in my requirements.txt:
langchain @ git+https://github.com/mrtj/langchain.git@7b52eff#subdirectory=libs/langchain
Observed result:
sam build
fails with the errorPythonPipBuilder:ResolveDependencies - Unable to retrieve name/version for package
Expected result:
sam build
works.Note:
pip install -r requirements.txt
do correctly install the required version of the package.Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Add --debug flag to command you are running
Debug output: