-
Notifications
You must be signed in to change notification settings - Fork 430
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
Installing local package fails #365
Comments
This is due to a quirk in pip's behavior. If you run Install the package from any other directory. For example, try going up to the parent directory, then running
|
Thanks for getting back to me @cs01 - I did try passing in an absolute path (though while in the directory of the package) and it failed in the same way. Backing up one directory works though, thanks for the tip! I don't see my package listed though when I run |
Curious - why doesn't pipx extract the package name from |
Since pip allows so many different installation types, getting package names is tricky, and implementations change over time. So instead of building parsing of setup.py and other files into pipx, pipx installs the package to a temporary virtual environment and compares the pip's package list before and after the installation. pipx abstracts away all the details of "how to install and list packages" to pip, since ultimately that's what does the installation anyway. Because pip lists the package as installed before the installation, pipx does not detect any newly installed packages and hence cannot determine the package name. |
If you run with the |
pipx runs |
Sure I understand you don't want to build in all the logic and rely on |
Given how often this occurs (even to me), I agree it would be good to make this automatic. I am not sure if there is a pip API specifically for this. I suppose we could check if there is a |
If I understand the problem correctly, one possible hack is to use |
Ah, checking |
Another idea I had (which may or may not be a hack) would be if we notice '.' as the install directory, to change our cwd to one level up and then modify the path to specify the original directory by relative name. |
I'm trying to understand how pipx does the install - if it makes a temporary directory for the venv, does it copy the cwd there? Why not just use absolute paths and avoid this problem altogether? |
Absolute paths won't fix it. It has to do with the current working directory. I think switching the cwd when running pip to be the venv root would fix this issue. @rokroskar You can check out the source here https://github.com/pipxproject/pipx/blob/155cef9236aa0290578df7b46148f32c58bb5f6f/src/pipx/commands/commands.py#L85. |
ah ok, I see - I assumed you were doing that already - yes that certainly sounds like it could work! |
Another option is to invoke the Python interpreter in isolated mode to exclude the current working directory from the path. Replace |
Isolated mode is very interesting, it has other good effects too.
The |
(I never understood what those googly eyes mean.) |
I take them to mean "interesting!" although that could just be me. |
Agreed, kind of like "something that looks interesting and I will look into more". |
@layday that seems like the simplest, least hacky suggestion! |
I've tested this and it seems to fix this problem - @layday should I open a PR for the change? |
I don't know - I'm just a passer-by :) |
The problem I have with |
@uranusjr sure, it seems like a pretty significant flag - but to my naive eyes it looks like in this context, it would be used in a method that is only used to determine which package was installed (i.e. to get the package name). There are no other uses of |
Relevant: pypa/pip#2926 |
Any update on this 🙂? Isn't it a one character diff PR? Plus one or two tests of course. |
The aforementioned pip issue will be fixed in the upcoming 20.1 (due today). We can revisit it soon. One way to help is to try this again with the new pip version and see if the issue resolves itself. |
that's great news, will give it a go once the |
@uranusjr just tested this now - pip-20.1 doesn't seem to fix the problem |
@rokroskar it does for me. Just tried to install local package while in the package parent directory, and it worked. |
Hmm strange...
|
pipx doesn't use your system's pip - is the pipx version of pip, 20.1? |
Alternatively, just upgrade pipx's pip: |
Ah indeed - I forgot about the shared libraries, thanks. That does fix the problem! |
So does this mean there’s nothing more pipx needs to do? The issue can be closed if that’s the case. |
I wasn't sure if you want to keep it open until the updated |
The shared pip is updated automatically, see #396. The pip update will land in at most a month, but GitHub does not have a timer feature to auto close this when that happens. I’ll just close this. |
For anyone who lands here in the future, since the |
Describe the bug
pipx
fails to install a local package.How to reproduce
Expected behavior
The package should be installed.
The text was updated successfully, but these errors were encountered: