Open kaddkaka opened 2 months ago
I wasn't able to reproduce:
uv tool install .
uv venv
. .venv/bin/activate
uv pip install pip
pip install --editable .
Defaulting to user installation because normal site-packages is not writeable
You shouldn't be trying to install anything into a system install, or especially a user install. I'd always use venvs, like you see above. Not the problem here, though.
So if I want something installed in the global environment, available from just invoking python3
from the command line. How would I do that?
I wasn't able to reproduce:
uv tool install . uv venv . .venv/bin/activate uv pip install pip pip install --editable .
Defaulting to user installation because normal site-packages is not writeable
You shouldn't be trying to install anything into a system install, or especially a user install. I'd always use venvs, like you see above. Not the problem here, though.
I did not do any of these steps:
uv venv
. .venv/bin/activate
uv pip install pip
Are they needed? Why? What do they do? Isnt this creating a venv and activating it inside the packge itself? I want to use the package from outside (other package/global env).
If you want a command to be globally available, that's what you use uv tool install
(or pipx install
) for. Those exist entirely to expose your console entry-points without making the package installable. You don't need them otherwise. If you want to be able to import
it, you should have a virtual environment. Installing into a single, overall environment can break your system Python, interfere with other packages, be hard to uninstall, etc. If it's a Python you've personally installed, then you can do it (since you can just wipe the install out), but your Python (above) is managed by the system, which is why it's not letting you install to it. Instead, it's installing to a "user" install, which will be shared among all Python instances, which is really fragile and easy to break.
But that's not why... Oh, if you've been using your user install, maybe you have an old pathspec there that's breaking the isolated install? What is the output of pip list --user
?
(UV completely disallows the --user
location because of how easy it is to break things when using it, by the way)
$ pip list --user | grep pathspec
pathspec 0.11.1
I might have done one or two [sudo] pip install X
previously (like matplotlib). I'm just interested to get my package as easily importable for when I run random python scripts or python one-liners directly from command line. Isn't that user or global env? What commands should I run to get my package available as python3 -c 'import my_package'
?
Got these python3 executables:
$ which -a python3
/usr/bin/python3
/bin/python3
Description
I'm trying to package my first python project (so I might be making stupid mistakes) but I have tried in different ways the week. My package is called prawk and I want to be able to do
import prawk
in a python file outside this package. When I performpip install --editable .
in my project top folder (pyproject.toml
) is located, I get error below.Expected behavior
installation to succeed
pip version
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
Python version
Python 3.10.12
OS
Ubuntu 22.04
How to Reproduce
uv
usinguv tool install .
pip install --editable .
-> error outputOutput
:
Am I missing something? Not sure what to do from here.