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

(🐞) poetry self update installs poetry into a new location and breaks it with: "Poetry was not installed with the recommended installer" #5032

Closed
3 tasks done
KotlinIsland opened this issue Jan 13, 2022 · 5 comments
Labels
kind/bug Something isn't working as expected

Comments

@KotlinIsland
Copy link
Contributor

KotlinIsland commented Jan 13, 2022

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Windows 10
  • Poetry version: 1.1.12 / 1.2.0a2
  • Link of a Gist with the contents of your pyproject.toml file: N/A

Issue

I installed poetry with the install-poetry.py script, and it installed into \AppData\Roaming\Python\Scripts.

But when I run poetry self update it installs poetry into a wacky different directory(C:\Users\amongus\AppData\Local\Programs\Python\Python310\Scripts) that doesn't let me run poetry self update any more:
Poetry was not installed with the recommended installer, so it cannot be updated automatically.

>where poetry
C:\Users\amongus\AppData\Roaming\Python\Scripts\poetry.exe

>poetry self update 1.1.11
Updating Poetry to 1.1.11

Updating dependencies
Resolving dependencies...

Package operations: 21 installs, 10 updates, 0 removals

  - Updating certifi (2021.5.30 -> 2021.10.8)
  - Updating charset-normalizer (2.0.6 -> 2.0.10)
  - Installing crashtest (0.3.1)
  - Updating idna (3.2 -> 3.3)
  - Installing pastel (0.2.1)
  - Installing pylev (1.4.0)
  - Updating urllib3 (1.26.7 -> 1.26.8)
  - Installing clikit (0.6.2)
  - Updating distlib (0.3.3 -> 0.3.4)
  - Updating filelock (3.3.0 -> 3.4.2)
  - Installing lockfile (0.12.2)
  - Installing msgpack (1.0.3)
  - Updating platformdirs (2.4.0 -> 2.4.1)
  - Installing ptyprocess (0.7.0)
  - Installing pywin32-ctypes (0.2.0)
  - Updating requests (2.26.0 -> 2.27.1)
  - Installing webencodings (0.5.1)
  - Installing cachecontrol (0.12.10)
  - Installing cachy (0.3.0)
  - Installing cleo (0.8.1)
  - Installing html5lib (1.1)
  - Installing keyring (21.8.0)
  - Updating packaging (21.3 -> 20.9)
  - Installing pexpect (4.8.0)
  - Installing pkginfo (1.8.2)
  - Installing poetry-core (1.0.7)
  - Installing requests-toolbelt (0.9.1)
  - Installing shellingham (1.4.0)
  - Installing tomlkit (0.8.0)
  - Updating virtualenv (20.8.1 -> 20.13.0)
  - Installing poetry (1.1.11)

Updating the poetry script

Poetry (1.1.11) is installed now. Great!

>where poetry
C:\Users\amongus\AppData\Local\Programs\Python\Python310\Scripts\poetry.exe
C:\Users\amongus\AppData\Roaming\Python\Scripts\poetry.exe

>poetry self update
  RuntimeError

  Poetry was not installed with the recommended installer. Cannot update automatically.

  at AppData\Local\Programs\Python\Python310\lib\site-packages\poetry\console\commands\self\update.py:389 in _check_reco
mmended_installation
      385│         current = Path(__file__)
      386│         try:
      387│             current.relative_to(self.home)
      388│         except ValueError:
    → 389│             raise RuntimeError(
      390│                 "Poetry was not installed with the recommended installer. "
      391│                 "Cannot update automatically."
      392│             )
      393│

@KotlinIsland KotlinIsland added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 13, 2022
@KotlinIsland KotlinIsland changed the title (🐞) "Poetry was not installed with the recommended installer" after poetry self update --preview (🐞) "Poetry was not installed with the recommended installer" after poetry self update Jan 14, 2022
@KotlinIsland KotlinIsland changed the title (🐞) "Poetry was not installed with the recommended installer" after poetry self update (🐞) poetry self update installs poetry into a new location and breaks it with: "Poetry was not installed with the recommended installer" Jan 14, 2022
@KotlinIsland
Copy link
Contributor Author

This is a pretty serious bug that makes the install-poetry script practically useless IMO

@finswimmer
Copy link
Member

I guess the root cause is the same as in #5046.

Could you please try my fix #5048, by installing it via:

 curl -sSL https://install.python-poetry.org | python - --git https://github.com/finswimmer/poetry@issue-5046-fix-self-update

Uninstall your current installation first.

fin swimmer

@m-dz
Copy link

m-dz commented Feb 3, 2022

I've run into a similar issue on Python 3.7.12, Win10 WSL2 (Ubuntu 20.04.2 LTS Focal Fossa), after running poetry self update on Poetry 1.1.11 and seeing "Updating Poetry to 1.1.12", poetry --version still gave 1.1.11. The aforementioned fix did the job.

@finswimmer
Copy link
Member

Solved by #5048 and available since Poetry 1.1.13.

@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants