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

[1.2.0a2] poetry plugin remove uninstalls poetry itself #4365

Closed
3 tasks done
jacksmith15 opened this issue Aug 8, 2021 · 6 comments
Closed
3 tasks done

[1.2.0a2] poetry plugin remove uninstalls poetry itself #4365

jacksmith15 opened this issue Aug 8, 2021 · 6 comments
Labels
kind/bug Something isn't working as expected

Comments

@jacksmith15
Copy link

jacksmith15 commented Aug 8, 2021

  • I am using the 1.2.0a2 pre-release (i.e. not latest (1.1.7))
  • 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: Linux #71-Ubuntu SMP Tue Jul 13 15:59:12 UTC 2021
  • Poetry version: 1.2.0a2
  • Link of a Gist with the contents of your pyproject.toml file: Not applicable

📝 If you track pre-release issues elsewhere and this is a known problem, then please close this issue :)

Issue

tl;dr: poetry plugin remove <plugin> uninstalls poetry itself from $POETRY_HOME/venv, presumably because poetry is a dependency of plugins. This leaves a broken installation of poetry, requiring reinstall from install-poetry.py.

Steps to reproduce

📝 The steps below use the poetry-dotenv-plugin because its available on PyPi and the steps will work for anyone, but I have confirmed this also occurs with simple hello-world plugins created by following the documentation.

  1. Install latest poetry:

    curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py > install-poetry.py
    python install-poetry --preview

    Output:

    Retrieving Poetry metadata                                                                                                                                                                                         
                                                                                                                                                                                                                   
    # Welcome to Poetry!                                                                                                                                                                                               
                                                                                                                                                                                                                       
    This will download and install the latest version of Poetry,                                                                                                                                                       
    a dependency and package manager for Python.                                                                                                                                                                       
                                                                                                                                                                                                                   
    It will add the `poetry` command to Poetry's bin directory, located at:                                                                                                                                            
                                                                                                                                                                                                                       
    $POETRY_HOME/bin                                                                                                                                                                                             
                                                                                                                                                                                                                       
    You can uninstall at any time by executing this script with the --uninstall option,                                                                                                                                
    and these changes will be reverted.                                                                                                                                                                                
                                                                                                                                                                                                                       
    Installing Poetry (1.2.0a2): Done                                                                                                                                                                                  
                                                                                                                                                                                                                       
    Poetry (1.2.0a2) is installed now. Great!                                                                                                                                                                          
                                                                                                                                                                                                                       
    You can test that everything is set up by executing:                                                                                                                                                               
                                                                                                                                                                                                                       
    `poetry --version`
    
  2. Install a plugin:

    poetry plugin add poetry-dotenv-plugin

    Output:

    Using version ^0.1.0-alpha.2 for poetry-dotenv-plugin                                                                                                                                                              
    Updating dependencies                                                                                                                                                                                              
    Resolving dependencies... (3.4s)                                                                                                                                                                                   
                                                                                                                                                                                                                       
    Writing lock file                                                                                                                                                                                                  
                                                                                                                                                                                                                       
    Package operations: 2 installs, 1 update, 0 removals                                                                                                                                                               
                                                                                                                                                                                                                       
      • Installing python-dotenv (0.19.0)                                                                                                                                                                              
      • Updating keyring (23.0.1 -> 22.3.0)                                                                                                                                                                            
      • Installing poetry-dotenv-plugin (0.1.0a2)
    
  3. Check the plugin is installed:

    poetry plugin show

    Output:

      • poetry-dotenv-plugin (0.1.0a2) A Poetry plugin to automatically load environment variables from .env files                                                                                                     
          1 application plugin                                                                                                                                                                                         
                                                                                                                                                                                                                       
          Dependencies                                                                                                                                                                                                 
            - poetry (>=1.2.0a1)                                                                                                                                                                                       
            - python-dotenv (>=0.10.0)
    
  4. Remove the plugin:

    poetry plugin remove poetry-dotenv-plugin

    Output (note that poetry-core and cleo are removed):

    Updating dependencies
    Resolving dependencies... (0.1s)
    
    Writing lock file
    
    Package operations: 0 installs, 0 updates, 39 removals
    
      • Removing appdirs (1.4.4)
      • Removing cachecontrol (0.12.6)
      • Removing cachy (0.3.0)
      • Removing certifi (2021.5.30)
      • Removing cffi (1.14.6)
      • Removing charset-normalizer (2.0.4)
      • Removing cleo (1.0.0a4)
      • Removing crashtest (0.3.1)
      • Removing cryptography (3.4.7)
      • Removing distlib (0.3.2)
      • Removing entrypoints (0.3)
      • Removing filelock (3.0.12)
      • Removing html5lib (1.1)
      • Removing idna (3.2)
      • Removing importlib-metadata (1.7.0)
      • Removing jeepney (0.7.1)
      • Removing keyring (22.3.0)
      • Removing lockfile (0.12.2)
      • Removing msgpack (1.0.2)
      • Removing packaging (20.9)
      • Removing pexpect (4.8.0)
      • Removing pkginfo (1.7.1)
      • Removing poetry-core (1.1.0a6)
      • Removing poetry-dotenv-plugin (0.1.0a2)
      • Removing ptyprocess (0.7.0)
      • Removing pycparser (2.20)
      • Removing pylev (1.4.0)
      • Removing pyparsing (2.4.7)
      • Removing python-dotenv (0.19.0)
      • Removing requests (2.26.0)
      • Removing requests-toolbelt (0.9.1)
      • Removing secretstorage (3.3.1)
      • Removing shellingham (1.4.0)
      • Removing six (1.16.0)
      • Removing tomlkit (0.7.2)
      • Removing urllib3 (1.26.6)
      • Removing virtualenv (20.4.4)
      • Removing webencodings (0.5.1): Removing...
      • Removing zipp (3.5.0): Removing...
    
  5. Confirm that poetry install is broken:

    poetry --version    

    Output:

    Traceback (most recent call last):
      File "/home/jack/.poetry/bin/poetry", line 5, in <module>
        from poetry.console.application import main
      File "/home/jack/.poetry/venv/lib/python3.9/site-packages/poetry/console/application.py", line 12, in <module>
        from cleo.application import Application as BaseApplication
    ModuleNotFoundError: No module named 'cleo'
    
@jacksmith15 jacksmith15 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Aug 8, 2021
@KDMichaelis
Copy link

@jacksmith15 I saw a similar behavior in #553 and it seems that when you ran poetry --version after removing the plugin an old poetry binary is used which is located at $HOME/.poetry while the default location for new installations is $HOME/.local. Users have suggested a workaround fix by removing the $HOME/.poetry folder while I'm not sure if this is the recommended way and of course this doesn't resolve the problem that this binary persists when poetry is reinstalled to the new location. However, it could be worth checking if removing the plugin actually removes the new poetry installation (which is most likely the case) or simply leads to the old binary being used instead for some reason (less likely). One way or the other getting rid of the old binary is probably a good idea.

@Secrus
Copy link
Member

Secrus commented May 23, 2022

@abn any idea if #5450 would fix this?

@abn
Copy link
Member

abn commented May 23, 2022

In theory yes.

@lafrenierejm
Copy link
Contributor

Everything looks good when running this from c1475a0, the current HEAD of master.

  1. Install plugin:
lafrenierejm@macbook-air poetry % poetry run poetry self add poetry-dotenv-plugin
<snip>
Using version ^0.1.0a2 for poetry-dotenv-plugin

Updating dependencies
Resolving dependencies... (0.1s)

Writing lock file

Package operations: 2 installs, 0 updates, 0 removals

  • Installing python-dotenv (0.20.0)
  • Installing poetry-dotenv-plugin (0.1.0a2)
  1. Show installed plugins:
lafrenierejm@macbook-air poetry % poetry run poetry self show plugins
<snip>
  • poetry-dotenv-plugin (0.1.0a2) A Poetry plugin to automatically load environment variables from .env files
      1 application plugin

      Dependencies
        - poetry (>=1.2.0a1)
        - python-dotenv (>=0.10.0)

  • poetry-plugin-export (1.0.4) Poetry plugin to export the dependencies to various formats
      1 application plugin

      Dependencies
        - poetry (>=1.2.0b1dev0,<2.0.0)
  1. Remove installed plugin:
lafrenierejm@macbook-air poetry % poetry run poetry self remove poetry-dotenv-plugin
<snip>
Updating dependencies
Resolving dependencies... (0.1s)

Writing lock file

Package operations: 0 installs, 0 updates, 2 removals

  • Removing poetry-dotenv-plugin (0.1.0a2)
  • Removing python-dotenv (0.20.0)
  1. Print version to confirm poetry is still installed:
lafrenierejm@macbook-air poetry % poetry run poetry version                                                                                                        
<snip>
poetry 1.2.0b3.dev0

@mkniewallner
Copy link
Member

Thanks for testing @lafrenierejm, appreciate it.

Tested too on 1.2.0b2 and the removal of the plugin left poetry's own dependencies untouched, so closing this issue.

@mkniewallner mkniewallner removed the status/triage This issue needs to be triaged label Jun 14, 2022
Copy link

github-actions bot commented Mar 1, 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 1, 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

6 participants