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

requires-plugins breaks poetry installation on Windows #10028

Open
pseusys opened this issue Jan 13, 2025 · 5 comments
Open

requires-plugins breaks poetry installation on Windows #10028

pseusys opened this issue Jan 13, 2025 · 5 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@pseusys
Copy link

pseusys commented Jan 13, 2025

Description

I have a poetry project, which I install and test on Windows machine in GitHub Actions.
Recently, I tried using the new requires-plugins feature for poethepoet and poetry-plugin-export plugins installation.
The pyproject.toml file looks somewhat like this:

...
[tool.poetry.requires-plugins]
poethepoet = "^0.32.1"
poetry-plugin-export = "^1.9.0"
...

However, instead of expected installation, what I receive is an error:

Ensuring that the Poetry plugins required by the project are available...
The following Poetry plugins are required by the project but are not installed in Poetry's environment:
  - poethepoet (>=0.32.1,<0.33.0)
  - poetry-plugin-export (>=1.9.0,<2.0.0)
Installing Poetry plugins only for the current project...
Updating dependencies
Resolving dependencies...

Package operations: 4 installs, 0 updates, 0 removals

  - Installing pastel (0.2.1)
  - Installing pyyaml (6.0.2)
  - Installing poethepoet (0.32.1)
  - Installing poetry-plugin-export (1.9.0)

  ValueError

  path is on mount 'C:', start on mount 'D:'

  at C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\ntpath.py:747 in relpath
      743|         path_abs = abspath(normpath(path))
      744|         start_drive, start_rest = splitdrive(start_abs)
      745|         path_drive, path_rest = splitdrive(path_abs)
      746|         if normcase(start_drive) != normcase(path_drive):
    > 747|             raise ValueError("path is on mount %r, start on mount %r" % (
      748|                 path_drive, start_drive))
      749| 
      750|         start_list = [x for x in start_rest.split(sep) if x]
      751|         path_list = [x for x in path_rest.split(sep) if x]

Cannot install poethepoet.


Failed to install required Poetry plugins

Workarounds

The plugins still can be installed traditionally, using poetry self add ....
However, I still would like to try the new feature... it works on Linux so nice!

Poetry Installation Method

pip

Operating System

windiws-latest (that is Windows Server 2022 OS Version: 10.0.20348 Build 2966)

Poetry Version

Poetry (version 2.0.1)

Poetry Configuration

cache-dir = "C:\\Users\\runneradmin\\AppData\\Local\\pypoetry\\Cache"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}\\virtualenvs"  # C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false

Python Sysconfig

sysconfig.log

Platform: "win-amd64"
Python version: "3.10"
Current installation scheme: "nt"
Paths:
data = "C:\hostedtoolcache\windows\Python\3.10.11\x64"
include = "C:\hostedtoolcache\windows\Python\3.10.11\x64\Include"
platinclude = "C:\hostedtoolcache\windows\Python\3.10.11\x64\Include"
platlib = "C:\hostedtoolcache\windows\Python\3.10.11\x64\Lib\site-packages"
platstdlib = "C:\hostedtoolcache\windows\Python\3.10.11\x64\Lib"
purelib = "C:\hostedtoolcache\windows\Python\3.10.11\x64\Lib\site-packages"
scripts = "C:\hostedtoolcache\windows\Python\3.10.11\x64\Scripts"
stdlib = "C:\hostedtoolcache\windows\Python\3.10.11\x64\Lib"
Variables:
BINDIR = "C:\hostedtoolcache\windows\Python\3.10.11\x64"
BINLIBDEST = "C:\hostedtoolcache\windows\Python\3.10.11\x64\Lib"
EXE = ".exe"
EXT_SUFFIX = ".cp310-win_amd64.pyd"
INCLUDEPY = "C:\hostedtoolcache\windows\Python\3.10.11\x64\Include"
LIBDEST = "C:\hostedtoolcache\windows\Python\3.10.11\x64\Lib"
SO = ".cp310-win_amd64.pyd"
TZPATH = ""
VERSION = "310"
abiflags = ""
base = "C:\hostedtoolcache\windows\Python\3.10.11\x64"
exec_prefix = "C:\hostedtoolcache\windows\Python\3.10.11\x64"
installed_base = "C:\hostedtoolcache\windows\Python\3.10.11\x64"
installed_platbase = "C:\hostedtoolcache\windows\Python\3.10.11\x64"
platbase = "C:\hostedtoolcache\windows\Python\3.10.11\x64"
platlibdir = "lib"
prefix = "C:\hostedtoolcache\windows\Python\3.10.11\x64"
projectbase = "C:\hostedtoolcache\windows\Python\3.10.11\x64"
py_version = "3.10.11"
py_version_nodot = "310"
py_version_nodot_plat = "310"
py_version_short = "3.10"
srcdir = "C:\hostedtoolcache\windows\Python\3.10.11\x64"
userbase = "C:\Users\runneradmin\AppData\Roaming\Python"

Paste the output of 'python -m sysconfig', over this line.

Example pyproject.toml

[tool.poetry.requires-plugins]
poethepoet = "^0.32.1"
poetry-plugin-export = "^1.9.0"

Poetry Runtime Logs

poetry-runtime.log

output.txt

Paste the output of 'poetry -vvv <command>', over this line.
@pseusys pseusys added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 13, 2025
@abn
Copy link
Member

abn commented Jan 13, 2025

This is likely a Windows file path issue like when the drive is a link and relpath is called.

Can you provide full logs with -vvv please?

@j-adamczyk
Copy link

I face the same problems on GitHub Actions workflow (where I don't fully control the environment).

I tried to add poetry-dynamic-versioning plugin:

[tool.poetry.requires-plugins]
poetry-dynamic-versioning = { version = ">=1.0.0,<2.0.0", extras = ["plugin"] }

My error is basically the same:

Run poetry sync --with test
Creating virtualenv skfp in D:\a\scikit-fingerprints\scikit-fingerprints\.venv
Ensuring that the Poetry plugins required by the project are available...
The following Poetry plugins are required by the project but are not installed in Poetry's environment:
  - poetry-dynamic-versioning[plugin] (>=1.0.0,<2.0.0)
Installing Poetry plugins only for the current project...
Updating dependencies
Resolving dependencies...

Package operations: 4 installs, 0 updates, 0 removals

  - Installing markupsafe (3.0.2)
  - Installing dunamai (1.23.0)
  - Installing jinja2 (3.1.5)

  ValueError

  path is on mount 'C:', start on mount 'D:'

  at <frozen ntpath>:766 in relpath

Cannot install dunamai.


Failed to install required Poetry plugins
Error: Process completed with exit code 1.

Workflow definition: https://github.com/scikit-fingerprints/scikit-fingerprints/blob/eaa1499a12db49e128808f920df61d8004ef396e/.github/workflows/python-publish.yml.

Full stacktrace with -vvv option: https://github.com/scikit-fingerprints/scikit-fingerprints/actions/runs/12743574960/job/35513793864?pr=346

@abn
Copy link
Member

abn commented Jan 13, 2025

Thank you @j-adamczyk this is helpful. I can confirm the issue is as I suspected.

https://github.com/scikit-fingerprints/scikit-fingerprints/actions/runs/12743574960/job/35513793864?pr=346#step:7:1250

I am not entirely sure if this is something Poetry can fix as the failure is due to the way action runner sets up the mounts (for the user data directory). Might be able to make the code resilient to that, lets see.

@mtkennerly
Copy link

Could you use abspath as a fallback when relpath fails? I found a similar case here: https://github.com/okken/pytest-check/pull/87/files

@abn
Copy link
Member

abn commented Jan 13, 2025

Probably, will have to check the impacted code first, I also would like to know if there are other places where we might be exposed to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

4 participants