-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
- [ x ] I am on the latest Poetry version.
- [ x ] I have searched the issues of this repo and believe that this is not a duplicate.
- [ x ] If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption).
- OS version and name: CentOS 8/Amazon Linux 2
- Poetry version: 1.2.0b2
- Link of a Gist with the contents of your pyproject.toml file:
Issue
While investigating #5440, I found out that if I tried to install a plugin using a path that contained a symlink e.g.
poetry self add /mysymlink/workspace/myuser/myproject/dist/myproject-1.0.0-py3-none-any.whl
where mysymlink resolves to say home/myuser, poetry would fail to install the plugin saying FileNotFound.
If I had instead used the real physical path using pwd -P, so I'd do
poetry self add /home/myuser/workspace/myuser/myproject/dist/myproject-1.0.0-py3-none-any.whl
it works just fine.
The problem is, if I originally used the symlink which caused the plugin install via a local wheel file to fail, the second option using the real physical path would also fail afterwards. Even if I had used the real physical path initially, if I remake a new virtualenv and try again, it also fails. After some digging, I found out when poetry tries to get the locked_repository here: https://github.com/python-poetry/poetry/blob/master/src/poetry/packages/locker.py#L454, it's reading from poetry.lock/pyproject.toml in ~/.config/pypoetry.
The ~/.config/pypoetry/poetry.lock has an incorrect relative path to the local wheel file:
...
[package.source]
type = "file"
url = "../../../../home/myuser/workspace/myuser/myproject/dist/myproject-1.0.0-py3-none-any.whl"
...
If I try to reinstall the plugin, it says the file is not found:
...
File /local/home/myuser/workspace/myuser/myproject/dist/myproject-1.0.0-py3-none-any.whl does not exist
It looks like it is missing an extra "../".
So far the only way I found to workaround this is to delete ~/.config/pypoetry every time I want to install the local plugin, but then this means I have to reconfigure poetry every time.