Skip to content

Installing from file:// on Windows with optional dependencies via @ doesn't work #13062

Open
@larsoner

Description

@larsoner

Description

I want to install a .whl file locally with an optional dependency on Windows, but it does not seem possible. Works fine on macOS and Linux.

Expected behavior

Install mne-lsl from a local wheel file with [test] optional deps.

pip version

24.2

Python version

3.12.4

OS

Windows 10

How to Reproduce

Get any .whl file locally, but the one I'm using in particular is from this failing Windows GitHub action CI, available on the Summary page.

This command works as expected:

$ pip install --dry-run "file://Z:\mne_lsl-1.7.0.dev0-cp310-abi3-win_amd64.whl"
Processing z:\mne_lsl-1.7.0.dev0-cp310-abi3-win_amd64.whl
Requirement already satisfied: click>=8.1 in c:\users\tester\mne-python\1.7.1_00\lib\site-packages (from mne-lsl==1.7.0.dev0) (8.1.7)
...
Requirement already satisfied: six>=1.5 in c:\users\tester\mne-python\1.7.1_00\lib\site-packages (from python-dateutil>=2.7->matplotlib>=3.5.0->mne>=1.4.2->mne-lsl==1.7.0.dev0) (1.16.0)
Would install mne_lsl-1.7.0.dev0

and so does this (output suppressed for brevity):

$ pip install --dry-run "Z:\\mne_lsl-1.7.0.dev0-cp310-abi3-win_amd64.whl"

However, prefixing mne_lsl[test] @ does not:

$ pip install --dry-run "mne_lsl[test] @ file://Z:\mne_lsl-1.7.0.dev0-cp310-abi3-win_amd64.whl"
Processing z:\mne_lsl-1.7.0.dev0-cp310-abi3-win_amd64.whl (from mne_lsl[test]@ file://Z:\mne_lsl-1.7.0.dev0-cp310-abi3-win_amd64.whl)
ERROR: mne_lsl@ file://Z:\mne_lsl-1.7.0.dev0-cp310-abi3-win_amd64.whl from file://Z:\mne_lsl-1.7.0.dev0-cp310-abi3-win_amd64.whl (from mne_lsl[test]@ file://Z:\mne_lsl-1.7.0.dev0-cp310-abi3-win_amd64.whl) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

and neither does this, but fails in a different way:

$ pip install --dry-run "mne_lsl[test] @ Z:\mne_lsl-1.7.0.dev0-cp310-abi3-win_amd64.whl"
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\tester\mne-python\1.7.1_00\Lib\site-packages\pip\_internal\cli\base_command.py", line 105, in _run_wrapper
    status = _inner_run()
             ^^^^^^^^^^^^
  File "C:\Users\tester\mne-python\1.7.1_00\Lib\site-packages\pip\_internal\cli\base_command.py", line 96, in _inner_run
    return self.run(options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tester\mne-python\1.7.1_00\Lib\site-packages\pip\_internal\cli\req_command.py", line 67, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tester\mne-python\1.7.1_00\Lib\site-packages\pip\_internal\commands\install.py", line 379, in run
    requirement_set = resolver.resolve(
                      ^^^^^^^^^^^^^^^^^
  File "C:\Users\tester\mne-python\1.7.1_00\Lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 76, in resolve
    collected = self.factory.collect_root_requirements(root_reqs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tester\mne-python\1.7.1_00\Lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 539, in collect_root_requirements
    reqs = list(
           ^^^^^
  File "C:\Users\tester\mne-python\1.7.1_00\Lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 495, in _make_requirements_from_install_req
    cand = self._make_base_candidate_from_link(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tester\mne-python\1.7.1_00\Lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 232, in _make_base_candidate_from_link
    self._link_candidate_cache[link] = LinkCandidate(
                                       ^^^^^^^^^^^^^^
  File "C:\Users\tester\mne-python\1.7.1_00\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 281, in __init__
    assert name == wheel_name, f"{name!r} != {wheel_name!r} for wheel"
           ^^^^^^^^^^^^^^^^^^
AssertionError: 'mne-lsl' != '\\mne-lsl' for wheel

So I don't see a way to install a wheel file locally on Windows with optional dependencies. Even if there is another way, it seems like at least the file:// version above should work.

This one works but does not guarantee that it will install the wheel from the desired file (if it doesn't find one it likes, it will pull from PyPI rather than just failing; and --no-links will make it so that deps are not resolved):

$ pip install --dry-run --find-links "Z:\\" --pre "mne_lsl[test]"

Output

☝️

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS: windowsWindows specifictype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions