Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package dependency is not installed from local checkout #11351

Open
Dronakurl opened this issue Feb 9, 2025 · 11 comments
Open

Package dependency is not installed from local checkout #11351

Dronakurl opened this issue Feb 9, 2025 · 11 comments
Labels
bug Something isn't working needs-decision Undecided if this should be done

Comments

@Dronakurl
Copy link

Dronakurl commented Feb 9, 2025

Issue summary

I defined a dependency using a local path as source.
However, the package is not installed after syncing.
The same package can be installed from the git repo without a problem.

Reproducible steps

(The section below shows the steps in a Dockerfile and its output)

  1. Create an empty directory.
  2. Place this pyproject.toml inside it
[project]
name = "uvproblem"
version = "0.1.0"
description = ""
readme = ""
requires-python = ">=3.12"
dependencies = ["xobjects"]

[tool.uv.sources]
xobjects = { path = "/tmp/xobjects/" }
  1. Download the github repo to the source location in the /tmp folder

git clone https://github.com/xsuite/xobjects /tmp/xobjects

  1. Run uv sync -U -v. Result: (https://pastebin.com/Zxrt0UiA).
    I expected the package to be installed. But uv installed only it's dependencies.

  2. Check with uv pip show xobjects -> Package not found

What I tried to check any issues with this particular package

  1. Use git source instead:

    • Change the source in pyproject to be:

      xobjects = { git = "https://github.com/xsuite/xobjects" }

    • Re-run uv sync -U -v

    • Result (as expected): The xobjects package is installed.

  2. Install it directly:

    • uv pip install /tmp/xobjects/
    • Check (as expected): The xobjects package is installed. (uv pip show xobjects)
  3. After manual installation (and with the local path in pyproject.toml), sync again, to see if the package is kept in the environment

    • uv sync -U -v
    • Log says it's an "unnecessary package".

Dockerfile

You can find a Dockerfile with the above steps here: (https://pastebin.com/jNwH4HZL)

The output can be found here: (https://pastebin.com/M7vLMGR0)

Platform

Ubuntu 24.04, linux x86_64

Version

0.5.29

@Dronakurl Dronakurl added the question Asking for clarification or support label Feb 9, 2025
@charliermarsh
Copy link
Member

Sorry, can you create a minimal reproduction that we can use to debug your issue? Ideally, a Git repo or a zip archive or similar that we can download, along with the exact command you ran, what you expected to see, and what you saw in practice.

@charliermarsh charliermarsh added needs-mre Needs more information for reproduction and removed question Asking for clarification or support labels Feb 9, 2025
@zanieb
Copy link
Member

zanieb commented Feb 9, 2025

See #9452 and https://docs.astral.sh/uv/reference/troubleshooting/reproducible-examples/ please.

@zanieb zanieb changed the title Package dependency is not installed from local checkout (minimal example provided) Package dependency is not installed from local checkout Feb 9, 2025
@Dronakurl
Copy link
Author

Sorry, I thought the question was clear enough and there is an easy explanation.
I changed the issue doing my very best to make the MRE.

@charliermarsh
Copy link
Member

Thanks! We'll take a look.

@charliermarsh charliermarsh added needs-decision Undecided if this should be done and removed needs-mre Needs more information for reproduction labels Feb 9, 2025
@charliermarsh
Copy link
Member

Hmm ok. The issue here is that xobjects doesn't include a build system, so we treat it as a virtual project.

@charliermarsh charliermarsh added the bug Something isn't working label Feb 9, 2025
@Dronakurl
Copy link
Author

Dronakurl commented Feb 9, 2025

Thanks for looking into it! But isn't it weird that it works with a git source but not with the local checkout?

@zanieb
Copy link
Member

zanieb commented Feb 9, 2025

Thank you so much for taking the time to make a complete reproduction.

We have different logic for remote sources (like Git) and local sources (like a directory).

@charliermarsh it seems wrong to treat this as a virtual project since it's a dependency? Shouldn't virtual projects only be allowed at the root of a workspace? Or, at the very least, as a workspace member? As an example, wouldn't the behavior be weird here with --no-sources?

@charliermarsh
Copy link
Member

No, we allow any path dependency to be virtual.

@charliermarsh
Copy link
Member

(We can change that, but it appears to be intentional in the code and would be breaking.)

@charliermarsh
Copy link
Member

(At minimum, it seems like we need to allow package = true or package = false on path dependencies?)

@charliermarsh
Copy link
Member

@zanieb -- Should we change this for path dependencies in v0.6?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-decision Undecided if this should be done
Projects
None yet
Development

No branches or pull requests

3 participants