-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
getting error while running poetry show #7854
Comments
Please do the things the issue template asks you to do: report the python version, the OS version, rerun with |
from #7871
IssueSomehow, running Complete execution of
Changing poetry/src/poetry/utils/env.py Line 1225 in 3804a13
to my expected python env interpreter ( Edit: even though installation continues, the environment is borked. It still defaults to system's python binaries, bypassing any lib installed by poetry. |
I created a fresh user in the same system and poetry works. I think something screwed my user installation. |
So what ended up working for me is erasing every trace of poetry from my system. First through the usual channels: python3 -m pip uninstall poetry
curl -sSL https://install.python-poetry.org | python3 - --uninstall Then using sudo updatedb
locate poetry What I ended up removing was: rm -r /home/ubuntu/.local/lib/python3.10/site-packages/poetry*
rm -r /home/ubuntu/.config/pypoetry
rm -r /home/ubuntu/.cache/pypoetry
rm /home/ubuntu/.local/bin/poetry Then I could reinstall poetry. This time I opted for installing poetry using pip and python 3.9, which is more stable in my system (the collections.abc renaming is pulling my leg time and again): pip3.9 install --user poetry |
For what it's worth, I have the same issue, on a MacOS where default system python is 2.7 but I installed poetry using |
Experiencing the same problem on Rocky 8.7, having uninstalled Poetry 1.1.14 (which was installed under Python 3.6.8, and working well): Running I can take a look at the shebang in and it works as expected. I was not getting this error before -- it's not clear to me whether Poetry is now forcing the use of an older incompatible Python in a way it wasn't doing before, or whether this part of Poetry was always calling an old Python, but not using -I. |
Just discovered a new clue. I created a test user from scratch, and as that user repeated the installation above. I then created a test directory and ran However, I had forgotten that Poetry defaults to creating virtualenvs under ~/.cache, and I vastly prefer them in-project. So I clean up and try again:
And now it fails, with 'Unknown option: -I'. |
I guess this is a duplicate of #7957, just revealing itself in a different way. In both cases the result is that poetry is calling
so it is fixed by the same fix Edit: or anyway that's probably true for the |
Back in #8012, where I described poetry failing on my mac because it invoked python 2, I was asked to move the discussion here. In #8012, someone said:
What am I supposed to do when it fails? Don't use Poetry? Migrate to Linux? I work with one of the commenters in the other thread and it seems like the reason that he doesn't have a problem is that he's been burned enough times that he does this wherever he goes.
That's a fine trick and an ok workaround, but if that's the official Poetry answer then we should put it in the FAQ. Alternatively, would a PR that ran a bit of code to choose a modern enough interpreter name (e.g. try Or perhaps find some way to remember and use the same python that was used to install poetry in the first place (in my case, The same co-worker said:
I can't find his quote, but I can find oodles of bikeshedding arguments about it. Perhaps since Poetry requires |
Cool and will do. Thanks for the lead! |
Ok, this is now a non-problem, though I don't know why. I took @dimbleby's suggestion, set a break point, walked into the code, and found the really weird result that the virtual environment didn't have a Now everything works (starting from an uninstall and install of poetry v 1.5.0) and I can not get it to fail. While working along this today I installed the official Python There are enough screen copies in this and the #8012 thread that I don't think I was hallucinating, but I can no longer recreate this. If it happens again or I figure out what I changed, I'll pick the thread back up. @dimbleby -- thank you for the pointers! For posterity's sake, here's what I saw the first time I walked into the code. Well, weird.
but
and
|
Just did a bit of poking around because I hate feeling like I'm bonkers, it seems that I'm not the first person to end up with virtual environments that have a If you anyone else ends up here, these might be useful:
|
I use poetry 1.4.2 inside a docker container with asdf to handle python versions. Poetry was installed with python 3.8.10 (installed with asdf and set as global version). I have a project with .tool-versions If I switch .tool-versions to The current project's Python requirement (>=2.7,<2.8 || >=3.4) is not compatible with some of the required packages Python requirement:
- pandas requires Python >=3.7.1, so it will not be satisfied for Python >=2.7,<2.8 || >=3.4,<3.7.1
Because XXX depends on pandas (1.3.5) which requires Python >=3.7.1, version solving failed. Which I don't get as I am using python 3.8.10.
Is there any specific volume or env var I need to pass in the docker container while running the poetry command? |
Would it make sense to prefer My thinking is OS that use python2.7 as default python could remain unchanged. If On the other hand, I can see how this could be an issue that needs to be resolved in the install environment and not in the code. |
I have the same problem. Command ['python', '-I', '-W', 'ignore', '-'] errored with the following return code 2
Error output:
Unknown option: -I
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
Input:
import sys
if hasattr(sys, "real_prefix"):
print(sys.real_prefix)
elif hasattr(sys, "base_prefix"):
print(sys.base_prefix)
else:
print(sys.prefix) then today I updated the poetry version to 1.5.1 |
I guess we're talking about a bunch of different things in this thread. But FWIW, following up on my own previous comments here -- I upgraded to 1.5.1 and tried it again.
And it created the in-project virtualenv in .venv, no errors. Many thanks for the fix! |
there are (at least) two things going on here, per #7854 (comment) one of them will be fixed in 1.5.1, the other presumably won't. the most likely lead on the other is #7854 (comment), saying that sometimes virtual environments get the wrong layout. This is a known problem on debian - #6371 - but some reports in here say that they're hitting it on MacOS which as far as I know is a surprise. However for the only such reporter who has dug into it: the problem went away after some rounds of reinstalling things. I think it's likely that (as of 1.5.1) this project is doing nothing wrong and there will therefore be no fix forthcoming: but perhaps this issue has some value anyway as a space for folk to tell each other how they fixed it for themselves. (arguably that purpose would be just as well served by a closed issue!) |
I have installed poetry 1.4.0 version. I am getting the following error while running
poetry show
:The text was updated successfully, but these errors were encountered: