Skip to content

Editable install fails with ImportError (unknown location) on Windows 10 outside of venv #19089

Closed
@wyattscarpenter

Description

@wyattscarpenter

Bug Report

python -m pip install -e ., which is recommended in CONTRIBUTING.md, does not work. The installation goes fine, but upon an attempted run, the installed mypy prints an error ending with:

checker.py", line 131, in <module>
    from mypy.plugins import dataclasses as dataclasses_plugin
ImportError: cannot import name 'dataclasses' from 'mypy.plugins' (unknown location)

Workaround

A non-editable install, python -m pip install ., works fine.

To Reproduce

python -m pip install -e . && mypy

Expected Behavior

mypy small help message, ie usage: mypy [-h] [-v] [-V] [more options; see below] etc

Actual Behavior

Crash with traceback, ending in

checker.py", line 131, in <module>
    from mypy.plugins import dataclasses as dataclasses_plugin
ImportError: cannot import name 'dataclasses' from 'mypy.plugins' (unknown location)

Your Environment

  • Mypy version used: master on git, mypy-1.16.0+dev.64b0a571e78c098316d69ebe280d8ea0d96a2737
  • Python version used: Python 3.12.8

Additional information

Previously, I'd always assumed my computer was just cursed in some way, and this was some idiosyncratic problem. But my google-fu was strong today and I discovered https://stackoverflow.com/questions/19602582/pip-install-editable-links-to-wrong-path, suggesting that there might be something wrong with setup.py.

Proposed test

It might be worth making a new basic test that tries installing with -e and performing some basic check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-developerIssues relevant to mypy developers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions