question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[1.2.0a2] `poetry plugin remove` uninstalls poetry itself

See original GitHub issue
  • 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'
    

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mkniewallnercommented, Jun 12, 2022

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.

0reactions
lafrenierejmcommented, Jun 11, 2022

Everything looks good when running this from c1475a0b6dd6f4a3e99112cc36b8c0d1024e4048, 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
Read more comments on GitHub >

github_iconTop Results From Across the Web

Announcing Poetry 1.2.0 | Blog
Poetry 1.2 drops runtime support for Python 2.7, 3.5 and 3.6. Running Poetry on these versions is now untested and unsupported. Note. This ......
Read more >
poetry - PyPI
Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere. Poetry Install. Poetry replaces ...
Read more >
poetry install different package version based on extras
I tried adding different versions of a package using dependency groups, which are available since the pre-release 1.2.0a2 (github.com/python- ...
Read more >
tox-poetry-installer - Python Package Health Analysis - Snyk
A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile For more information about how to use this...
Read more >
pip uninstall permission denied - You.com | The Search ...
As pip is already installed, it is trying to uninstall current version and ... to attempt and upgrade to 1.2.0a2 by running the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found