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

Question: How to install local python package? #2418

Closed
mkleinbort-ic opened this issue Mar 13, 2024 · 4 comments
Closed

Question: How to install local python package? #2418

mkleinbort-ic opened this issue Mar 13, 2024 · 4 comments
Labels
question Asking for clarification or support

Comments

@mkleinbort-ic
Copy link

mkleinbort-ic commented Mar 13, 2024

Hi, just struggling with the uv pip install syntax...

I have a folder called src/ with a sub folder projectlib which itself contains a bunch of .py files and folders of .py files

The directory structure is more or less:

PROJECT-SOME-RANDOM-NAME/
   |-> pyproject.toml
   |-> notebooks/...
   └-> src/
         |-> projectlib/
         |    |-> __init__.py
         |    |-> data_loading.py
         |    |-> models/...
         |    |-> features.py
         |    └-> analysis/...
         |
         └> otherlib/...

Then in a bunch of jupyter notebooks and scripts I simply import things as

from projectlib.data_loading import get_users_from_db

So far I've been installing this via

python -m pip install --user .

ran on the top level folder PROJECT-SOME-RANDOM-NAME (outside src)

But looking to move to uv (for the obvious reasons)

I see I can install all the dependencies described in pyproject.toml using

python -m uv pip install --system --prerelease=allow -r pyproject.toml

But not clear on how I can install the projectlib/ folder (and maybe also otherlib/)

@zanieb
Copy link
Member

zanieb commented Mar 13, 2024

Hi! You're looking for uv pip install -e . or uv pip install "your-project@."

See #313 for some more details on the second syntax.

@zanieb zanieb added the question Asking for clarification or support label Mar 13, 2024
@mkleinbort-ic
Copy link
Author

Yes, that worked.

@mkleinbort-ic
Copy link
Author

Ok, just in case someone comes across this issue...

I had the problem that when I modified projectlib some changes would not be applied. Meaning that after running

python -m uv pip install --system -e .

I was still loading the previous version installed with python -m pip install .

The issue was that at some point pip had installed projectlib in ~/AppData/Roaming/Python/Python310/site-packages/

Deleting that folder fixed my issue - it had nothing to do with uv

@charliermarsh
Copy link
Member

This is supported as of v0.1.24. You can uv pip install . directly, without including a package name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

3 participants