Skip to content

Installing Poetry in virtual env causes issues with removing Plugins #5440

@spoorn

Description

@spoorn
  • 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: Amazon Linux 2
  • Poetry version: 1.2.0b1
  • Link of a Gist with the contents of your pyproject.toml file: N/A

Issue

If I install Poetry while in an existing virtual environment, when I add a plugin using poetry plugin add <absolute-path> (relative path does not work, but there are already 2 issues for that #4851 and #4366), I'm unable to remove the plugin via poetry plugin remove <plugin-name> as it complains that the plugin does not exist, but poetry plugin show shows the plugin and the plugin is active as I'm able to use it.

It looks like poetry plugin remove prefixed the path with /local so it can't find the wheel file used to add the plugin

Example paste of commands and output (some irrelevant printouts shortened to ...):

% mkvirtualenv -p python3.9 test
...


(test)
% curl -sSL https://install.python-poetry.org | python3 -
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:

/home/myuser/.local/bin

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (1.1.13): Done

Poetry (1.1.13) is installed now. Great!

You can test that everything is set up by executing:

`poetry --version`


(test)
% poetry self update --preview
Updating Poetry to 1.2.0b1
...
Poetry (1.2.0b1) is installed now. Great!


(test)
% cd myplugins && poetry build -f wheel && poetry plugin add $PWD/dist/myplugins-*.whl
Building myplugins (1.0.0)
  - Building wheel
  - Built myplugins-1.0.0-py3-none-any.whl
Updating dependencies
Resolving dependencies... (0.4s)

Writing lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing myplugins (1.0.0 /workplace/myuser/PluginTest/poetryplugins/dist/myplugins-1.0.0-py3-none-any.whl)


(test)
% poetry plugin show

  • myplugins (1.0.0) My Poetry plugin
      1 application plugin

      Dependencies
        - poetry (>=1.2.0b1,<2.0.0)


(test)
% poetry plugin remove myplugins
Updating dependencies
Resolving dependencies... (0.0s)

  ValueError

  File /local/workplace/myuser/PluginTest/poetryplugins/dist/myplugins-1.0.0-py3-none-any.whl does not exist

  at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/core/packages/file_dependency.py:39 in __init__
       35│             except FileNotFoundError:
       36│                 raise ValueError(f"Directory {self._path} does not exist")
       37│
       38│         if not self._full_path.exists():
    →  39│             raise ValueError(f"File {self._path} does not exist")
       40│
       41│         if self._full_path.is_dir():
       42│             raise ValueError(f"{self._path} is a directory, expected a file")
       43│

Everything works fine if I installed poetry outside of a virtual env

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions