-
Notifications
You must be signed in to change notification settings - Fork 870
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
Imports don't resolve correctly when using uv pip install -e
#1708
Comments
Thanks for the report! |
I see the same behavior with uv-editable-install-issue on main [?]
❯ virtualenv .venv
created virtual environment CPython3.12.1.final.0-64 in 86ms
creator CPython3macOsBrew(dest=/Users/crmarsh/workspace/puffin/uv-editable-install-issue/.venv, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/Users/crmarsh/Library/Application Support/virtualenv)
added seed packages: pip==23.3.2
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
uv-editable-install-issue on main [?]
❯ v
uv-editable-install-issue on main [?] via 🐍 v3.12.1 (.venv)
❯ pip install -e random_package
Obtaining file:///Users/crmarsh/workspace/puffin/uv-editable-install-issue/random_package
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... done
Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: random_package
Building editable for random_package (pyproject.toml) ... done
Created wheel for random_package: filename=random_package-1.0-0.editable-py3-none-any.whl size=2548 sha256=c5099053323ae8f975a2e36259bbb1c7b0b830f52f0b23420d78ab359146187e
Stored in directory: /private/var/folders/nt/6gf2v7_s3k13zq_t3944rwz40000gn/T/pip-ephem-wheel-cache-6dchil35/wheels/c2/79/66/ef5932c9c578f59adf4a1aa4a6130056e0158ee769622e464e
Successfully built random_package
Installing collected packages: random_package
Successfully installed random_package-1.0
[notice] A new release of pip is available: 23.3.2 -> 24.0
[notice] To update, run: pip install --upgrade pip
uv-editable-install-issue on main [?] via 🐍 v3.12.1 (.venv)
❯ python
Python 3.12.1 (main, Dec 7 2023, 20:45:44) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import random_package
>>> print(random_package.__path__)
_NamespacePath(['/Users/crmarsh/workspace/puffin/uv-editable-install-issue/random_package']) |
@charliermarsh
My guess is that it has something to do with that venv just symlinks to the python executable you create the environment with, whereas conda downloads a new executable. But there is still some For reference, I did the following
|
This is still an issue btw. I.e. doesn't happen with pip in a clean environment. |
I am noticing the same thing with editable installations on MacOS I have a directory setup as such;
When running the pip install with editable I get;
However, when I installed it through
Also tried to fix it with changing the argument to add
This also becomes an issue for monorepo's with MyPy, because now it can not resolve the package correctly and you get errors as this;
Of course you can fix this with including all of the subdirectories into the PATH manually but that's me not fixing the root issue, but instead moving around it, which is always worse then fixing the root 🤷♂️ Note; I made some edits as my investigation went on :) |
@Jorricks Can you provide a full reproduction example where you get different behavior from @philipp-eisen If you have repro instructions showing a difference in behavior between At the moment, without a reproducible example, it's really not clear whether the differences in behavior described above are actually due to Some information that may be useful, for reference: It is normal and expected behavior in Python that an empty string is the first entry in If the current working directory is not the outer directory containing the outer If safe-path mode ( If Python is run like |
Thank you for this information. I was not aware of the empty path resolving to the current working directory. |
Okay I think I figured out why the result is different for
Now the problem resides in that the
We get the expected result;
After some googling where the editable installations were coming from, I found out that most likely it comes from setuptools and it seems to be a known issues; |
Alright, my search has come to an ending. When I ran I suppose my issue would have also shown up with a newer pip version Thanks for the help :)! |
Thanks @Jorricks and sorry for being a bit too late to provide any useful info here. |
How to reproduce
Say you have the following file structure:
I created a repo with the files to reproduce here: https://github.com/philipp-eisen/uv-editable-install-issue
The text was updated successfully, but these errors were encountered: