Skip to content

mypy >=0.510 errors in pathlib #3768

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

Closed
mykter opened this issue Jul 26, 2017 · 7 comments
Closed

mypy >=0.510 errors in pathlib #3768

mykter opened this issue Jul 26, 2017 · 7 comments

Comments

@mykter
Copy link

mykter commented Jul 26, 2017

When using mypy 0.501 I can successfully run it against my program.

With mypy 0.510 and 0.521 I get the following error:

/usr/local/lib/mypy/typeshed/stdlib/3.5/pathlib.pyi:6: error: TypeVar cannot have only a single constraint
/usr/local/lib/mypy/typeshed/stdlib/3.5/pathlib.pyi:6: error: "object" not callable
/usr/local/lib/mypy/typeshed/stdlib/3.5/pathlib.pyi:15: error: Name 'List' is not defined
/usr/local/lib/mypy/typeshed/stdlib/3.5/pathlib.pyi:17: error: Invalid type "pathlib._P"
/usr/local/lib/mypy/typeshed/stdlib/3.5/pathlib.pyi:22: error: Invalid type "pathlib._P"
<snip more of the same>

Ubuntu 16.04, mypy installed globally via pip, pythons 2.7.12, 3.5.2

You can reproduce it with a trivial program that consists solely of:

from pathlib import Path
@ilevkivskyi
Copy link
Member

Hm... Very strange, somehow you have got an old version of the pathlib stub there. What happens if you just rename pathlib.pyi to pathlib.pyi.old? (I hope you should have a newer version somewhere, probably in 3.4 folder, so mypy should pick it up).

@ilevkivskyi
Copy link
Member

A more permanent solution would be to just delete the whole typeshed wherever you can find it, and make a clean install of mypy

@mykter
Copy link
Author

mykter commented Jul 26, 2017

Thanks!
There was indeed an orphaned copy of mypy that pip didn't know about. Removing it and reinstalling mypy fixed it.

@mykter mykter closed this as completed Jul 26, 2017
@lpasselin
Copy link

I had this problem when a dependency was installing mypy-lang while my project uses mypy.
#2983

@alok
Copy link

alok commented Oct 12, 2017

I have this problem too. Uninstalling and reinstalling mypy .530 doesn't help.

@ilevkivskyi
Copy link
Member

@alok have you searched and deleted all copies of typeshed after uninstalling?

@alok
Copy link

alok commented Oct 12, 2017

Installing with --no-cache did the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants