Closed dennisrall closed 2 months ago
Do you see the same result if you run uv cache clean
first? I can't reproduce this, trying to understand why packaging==23.2
isn't being considered.
Yes, same result. I think I also cleared the cache during my troubleshooting, but I checked again and I get the same error.
Do you have anything else in your pyproject.toml or existing lockfile?
No the lockfiles do no exist and yet and the pyproject.toml
only contains lanchain
as a dependency as it is created from the steps to reproduce as described above. Here is the content:
[project]
name = "test"
version = "0.1.0"
description = "Add your description here"
authors = [
{ name = "Dennis Rall", email = "dennis.rall@web.de" }
]
dependencies = [
"langchain>=0.2.3",
]
readme = "README.md"
requires-python = ">= 3.8"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.rye]
managed = true
dev-dependencies = []
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["src/test"]
I wonder if you try adding the following? That's how I got things working for my lab project https://github.com/bossjones/goob_ai/blob/main/pyproject.toml#L137 You can see the lockfile as well: https://github.com/bossjones/goob_ai/blob/main/requirements.lock#L373
[build-system]
requires = ["hatchling", "packaging<24"]
build-backend = "hatchling.build"
I added it, but I get still the same error
I am playing around with some Dockerfiles at the moment, but there I am struggling to reproduce the error...
Thanks, if you can get a repro in a Dockerfile I would love to help fix it.
While still trying things out, I found another strange package. Installing predibase
locally with rye
resolves in an error resolving the dependencies, installing it in a docker container with rye
and in an uv
managed venv it errors because of the installation of the geventhttpclient.tests
package and adding it with poetry
and a pip
works totally fine.
Here is the error about resolving the dependencies:
Added predibase>=2024.6.5 as regular dependency
Reusing already existing virtualenv
Generating production lockfile: /home/dennis/Projects/predi-rye/requirements.lock
× No solution found when resolving dependencies:
╰─▶ Because there is no version of urllib3==1.26.12 and predibase==2024.6.5 depends on urllib3==1.26.12, we can conclude that predibase==2024.6.5 cannot be used.
And because only predibase<=2024.6.5 is available and you require predibase>=2024.6.5, we can conclude that the requirements are unsatisfiable.
error: could not write production lockfile for project
Caused by:
Failed to run uv compile /tmp/.tmpqBn2cS/requirements.txt. uv exited with status: exit status: 1
The setup is the same as above. A fresh new rye
project and predibase
is the only dependency.
I guess the issue with with resolving the dependencies is the same as with langchain
and the installation error in docker and with uv
is an uv
bug?
Can you confirm that installing predibase
with rye
and uv
fails on your machine too? And does the second log failing to resolve the depencies provide any other information to you?
Unfortunately it works just fine for me with both Rye and uv on its own (echo "predibase>=2024.6.5" | uv pip compile -
), with the exception that I'm on macOS and it tries to build something from source when syncing. But the resolution does include urllib3==1.26.12
as expected.
I am facing the exact same issue as well. Both on Windows 11 and WSL. I'll try to get a DockerFile running as well.
Windows 11 config
rye 0.35.0
commit: 0.35.0 (a1dbc56d4 2024-06-24)
platform: windows (x86_64)
self-python: cpython@3.12.2
symlink support: true
uv enabled: true
WSL Ubuntu 24.04 config
rye 0.33.0
commit: 0.33.0 (58523f69f 2024-04-24)
platform: linux (x86_64)
self-python: cpython@3.12.3
symlink support: true
uv enabled: true
Thanks, I am happy to take a look at anything that I can repro!
Finally, I was able to reproduce it consistently.
Seems like there is a problem when you create the config.toml
as suggested here in the FAQs.
This is the Dockerfile to reproduce:
FROM ubuntu:latest
RUN apt-get update && apt-get install -y curl
ENV PATH="/root/.rye/shims:$PATH"
RUN curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash
RUN echo '[[sources]]\nname = "pytorch"\nurl = "https://download.pytorch.org/whl/cpu"' > /root/.rye/config.toml
RUN mkdir test
RUN cd test
RUN rye init
RUN rye add langchain
If you delete the line with the echo to the config.toml
if works fine, but when it is enabled it fails.
@Kydlaw Have you also added the pytorch sources to your config.toml
?
Ohh, my guess is that packaging
exists in the PyTorch index but not at the version you need to resolve LangChain?
You could set UV_INDEX_STRATEGY=unsafe-first-match
:
FROM ubuntu:latest
RUN apt-get update && apt-get install -y curl
ENV PATH="/root/.rye/shims:$PATH"
RUN curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash
RUN echo '[[sources]]\nname = "pytorch"\nurl = "https://download.pytorch.org/whl/cpu"' > /root/.rye/config.toml
RUN mkdir test
RUN cd test
RUN rye init
ENV UV_INDEX_STRATEGY=unsafe-first-match
RUN rye add langchain
The docs on this are here: https://github.com/astral-sh/uv/blob/main/PIP_COMPATIBILITY.md#packages-that-exist-on-multiple-indexes
Thanks for the fast response. This fixes my problem. If you like you can merge the PR where I added this as a hint to the docs.
Steps to Reproduce
mkdir test
,cd test
,rye init
rye add langchain
Expected Result
Langchain should be added to the project and the log files should be created correctly.
Creating a virtualenv and installing langchain with venv, poetry and uv works. So it has something to do with rye, but I don't know what😅
Actual Result
Version Info
Stacktrace
No response