-
Notifications
You must be signed in to change notification settings - Fork 433
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
Once system python and pipx upgraded, cannot install new app if some previous old shared_venv existed #294
Comments
Hm. I'm trying to figure out how I might reproduce this on my own system. There's a lot going on in your issue description. Do you have a simplified way to reproduce this that I could try, possibly using pyenv? For the devs, it appears that Since it can't find pip, it seems as though either Unless I can somehow reproduce this on my system I'm pretty lost as to what is going on. |
@itsayellow, I'm not sure this is reproducible with pyenv, but I can detail how I encountered it / can reproduce it on Debian (where sid recently went from In detail:
(All steps now inside the container)
yq is now in Update python3 to python3.8:
Reinstall pipx:
At this point, trying to upgrade an existing app or install a new one fail with a "no module named pip" error
|
Have you tried If that doesn't work, what does Did you uninstall the old The other thing I can think of that might possibly be affecting you is that you are installing pipx to the system as opposed to using |
It's subtle (I should probably have picked better example packages for the demo), but note that the first package was yq (YAML) and the second was jq (JSON). Sorry :)
Before upgrading the system Python:
After upgrading the system Python:
Some further bits of information: This seems to be specific to using a When I use Further, if I then uninstall python3.7 (
|
OK, I finally had a chance to run your very complete docker instructions. Thank you for that! I can reproduce what you're talking about. And it doesn't seem to help if you install First problem, yq stops working after system python upgradeWhat seems to be happening is that in I see the same behavior on my Ubuntu system. The python interpreter link in all the venvs points to The workaround when you first install yq would be this pipx command:
Then after upgrading the system python My suggestion to the pipx developers is that when we determine the system python, maybe we should resolve the link back to the original binary filepath which would get a specific python sub-version. (e.g. in Second problem, reinstall of pipx will not install after system upgradeI think this is similar to the venv problem described above. The shared libs have their own idea of a python binary, and on linux this seems to be linked to a generic binary without a sub-version (i.e.
|
btw the workaround after an upgrade of the system python to get pipx working (after reinstalling pipx):
Or at least I assume that should be the workaround, but when I tried it, it found pip but then failed spectacularly trying to build a wheel for jq. |
It seems that we need a better |
Sorry, that's another example of "I should have chosen better packages as examples." It fails because of no C compiler. Using "yq" and then "httpie" seem like better example packages -- neither require compilation. |
I think I encountered a similar problem after upgrading my python install from the brew. The solution that worked for me is To illustrate the problem and how it gets resolved, the following are the commands I did. me@MacBook-Pro ~ python --version
python 3.8.3
me@MacBook-Pro ~ brew upgrade
...
all done!
me@MacBook-Pro ~ python --version
python 3.8.5
me@MacBook-Pro ~ pipx list
venvs are in /Users/me/.local/pipx/venvs
apps are exposed on your $PATH at /Users/me/.local/bin
package autopep8 has invalid interpreter /usr/local/Cellar/[email protected]/3.8.3/bin/python3.8
package black has invalid interpreter /usr/local/Cellar/[email protected]/3.8.3/bin/python3.8
package flake8 has invalid interpreter /usr/local/Cellar/[email protected]/3.8.3/bin/python3.8
package jupyterlab has invalid interpreter /usr/local/Cellar/[email protected]/3.8.3/bin/python3.8
package pycowsay has invalid interpreter /usr/local/Cellar/[email protected]/3.8.3/bin/python3.8
package pylint has invalid interpreter /usr/local/Cellar/[email protected]/3.8.3/bin/python3.8
package virtualenv has invalid interpreter /usr/local/Cellar/[email protected]/3.8.3/bin/python3.8
me@MacBook-Pro ~ pipx reinstall-all
...
me@MacBook-Pro ~ pipx list
venvs are in /Users/me/.local/pipx/venvs
apps are exposed on your $PATH at /Users/me/.local/bin
package autopep8 1.5.4, Python 3.8.5
- autopep8
package black 20.8b1, Python 3.8.5
- black
- black-primer
- blackd
package flake8 3.8.4, Python 3.8.5
- flake8
package jupyterlab 2.2.8, Python 3.8.5
- ...
package pycowsay 0.0.0.1, Python 3.8.5
- pycowsay
package pylint 2.6.0, Python 3.8.5
- ...
package virtualenv 20.0.33, Python 3.8.5
- virtualenv |
This last example is related to #493 |
This may or may not useful, but this also happens if you do a fresh install on a new computer and a higher version of ubuntu (or probably any other linux), and then transfer your home directory. pipx get very mad, and the only way I was able to fix it was to wipe everything pipx related and start reinstalling, which is less than ideal. I worked my way through several of the folks examples here, but in the end I think I made it worse. Only by removing everything under ~/.local/pipx was I able to start installing from scratch again. |
@sean-abbott depending on how old your original pipx was, this may also be because pipx has been extensively upgraded in the past year or so. Usually |
I tried running reinstall-all, it gave me errors. Unfortunately I have both
closed the terminal and "fixed" it by just reinstalling, so I can't give
you the errors anymore, I'm sorry.
…On Sat, Dec 26, 2020 at 8:47 PM Matthew Clapp ***@***.***> wrote:
@sean-abbott <https://github.com/sean-abbott> depending on how old your
original pipx was, this may also be because pipx has been extensively
upgraded in the past year or so. *Usually* pipx reinstall-all can fix
most issues.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#294 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKWJVYILJ5MK3PZW3RUR53SW2G2DANCNFSM4J26VQBA>
.
|
I'm not sure if this is related, but I've had very similar issues. After much un/re-installing with manual clear downs of the shared dirs I've got rid od f the "can't find pip" issue, but am now having the following when trying to install something:
I can uninstall pipx, remove the .local/pipx tree completely, then reinstall and try it, and it's the same problems. This following an upgrade from 3.8 => 3.9 in Ubuntu on WSL2, using If I flip the python version back to 3.8 via update-alternatives, install pipx for that, then it all works just fine and I can Then going back to 3.9 requires installing pipx again. After that |
@michjnich , what happens with Python 3.9 if you just try the following on your command-line:
If that's missing, then you might need to use
|
Seems like it's pointing at the correct version already.:
|
OK, the other important package to check is > apt list --installed python3-venv
Listing... Done
python3-venv/focal,now 3.8.2-0ubuntu2 amd64 [installed]
> apt list --installed python3-pip
Listing... Done
python3-pip/focal-updates,focal-updates,focal-security,focal-security,now 20.0.2-5ubuntu1.1 all [installed]
N: There is 1 additional version. Please use the '-a' switch to see it Hopefully with Python 3.9 installed you should get each package listed as you query the |
So they're installed, but should venv be showing a 3.9 version here? |
How did you install Python 3.9? You probably want python3.9-venv installed. python3-venv is a dependency package which points at (on focal) python3.8-venv, so you may not automatically pick up the venv package without installing it manually. |
It was installed from the deadsnakes:ppa, then configured as an alternative version using update-alternatives (which is how I switch between system versions if I need to). I guess the 3.9-venv needs installing specifically here ... I'll get that set up and see if it resolves the issue. Thanks! |
Just had this issue again upgrading to fedora 35:
I fixed it by running:
and then running a pipx operation to make it recreate the shared env with the new python version. |
Arch Linux, pipx 0.16.4, just upgraded from Python 3.9 to 3.10, and as per tradition all my pipx packages broke. Old venvs break
Even after recreating the shared env, some of my existing envs don't load, since they only have
Interestingly, maestral and corrscope (which I installed with However, Reinstalling works-ish
I think that Suggestions
|
I reinstalled When I ran https://gist.github.com/Exagone313/99b7aa35b8aec098f431e702d9416f35 After that, running the command again gave an error about the pip package being not found in pipx virtualenv:
I solved it by moving the I think the reinstallation should be protective and keep the list of installed virtualenvs at some place to deal with installation errors. At least I had the log. |
SummaryJudging from #294 (comment) and #294 (comment), there's at least 3 versions in a pipx setup:
Each of these should match the system Python interpreter, but might desync (the system Python interpreter's path is still present, but belongs to a different Python version) when updating Python in-place on Linux. IdeasNot a pipx contributor so far, but I could try changing My other idea is to add a config file/database containing a list of venvs and each venv's install options and Python versions. This complicates the architecture since the config file can desync with the actual folders present (eg. if a user adds/removes venv folders by hand), but is useful since if a failed In theory you could also store the Python version/path of each app's venv (though this is already tracked in I think it's still a good idea for Is it possible for each app's shim binary to automatically reinstall the app (and shared env, maybe other apps) if necessary? This makes the reinstallation process transparent to users and hopefully "just work", but I'm not sure if users want their apps to magically change behavior in edge cases (though they already break right now). And this might slow-down happy-path app startup time (though you can get pretty close to zero overhead by only reinstalling when you catch Or perhaps pipx itself should catch I didn't look into handling the system Python interpreter being uninstalled, and a new one being installed to a different location. This case is more common on Windows where Python is installed to TestingI think it will be difficult to come to a consensus on an optimal design (probably manual testing will help in designing an intuitive interface), and difficult to manually or automatically test updating Python to a new major version (which only happens once per year per Linux installation). Perhaps pyenv will help to test switching Python interpreters quickly. There's also "build a Docker image with an outdated Python", but I'm less familiar with that than pyenv, and setting up Docker/Podman requires more upfront setup and invasive system changes (cgroups etc.) than pyenv IMO. |
We don't plan to support this for now. On python upgrades I recommend reinstall-all. |
Describe the bug
On Manjaro/Arch, I was with python 3.7.4.
To ensure stability of some apps (and as some apps are not fully working on 3.8 that I new was coming) I also had python 3.7.5 installed through pyenv.
I use this python to install my apps with
Then my system got upgraded from 3.7.4 to 3.8 (Note that my 3.7.5 pyenv stayed)
I reinstalled pipx on 3.8 on system.
Then I had error thrown when installing new pipx no matter what versions I tried:
or even trying to use the pyenv:
Running the already installed app (using the 3.7.5) would work fine and even
pipx runpip xxx list
I realised then that .local/pipx/shared/pyvenv.cfg mentioned python version 3.7.4.
So I renamed the .local/pipx/shared folder differently. It recreated the shared lib for python3.8.
I had to then symlink the pyenv folder of python3.7 with:
And then install run fine and the already installed app run fine too
How to reproduce
See above
Expected behavior
pipx Install install should work after a pyhton upgrade even if hte previous shared folder still exists.
i think
The text was updated successfully, but these errors were encountered: