You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
typeshed not being found on windows user install #3988
PS D:\testing> git clone https://github.com/python/mypy.git
# no errors
PS D:\testing> cd .\mypy\
PS D:\testing\mypy> git submodule update --init typeshed
# worked, checked out '55dbb967ad006d5835590c53ab023774dc5a1341'
PS D:\testing\mypy> pip install --user --upgrade .
Processing D:\testing\mypy
Requirement already up-to-date: typed-ast<1.2.0,>=1.1.0in c:\users\[redacted!]\appdata\roaming\python\python36\site-packages (from mypy===0.530-dev-2bd11f60f0a0332b4c9537983a6ac7da4416e9ca)
Installing collected packages: mypy
Running setup.py install for mypy ... done
Successfully installed mypy-0.530-dev-2bd11f60f0a0332b4c9537983a6ac7da4416e9ca
PS D:\testing\mypy> mypy setup.py # to test
Could not resolve typeshed subdirectories. If you are using MyPyfrom source, you need to run "git submodule --init update".Otherwise your MyPy install is broken.
The data directory (after searching for typeshed) appears to be %AppData%\Python\lib\mypy
full path: C:\Users\[redacted!]\AppData\Roaming\Python\lib\mypy
PS D:\testing\mypy> ls $Env:AppData\Python\lib\mypy
typeshed
xml
using this directory leads to more expected results
PS D:\testing\mypy> mypy --custom-typeshed-dir $Env:AppData\Python\lib\mypy\typeshed setup.py
setup.py:15: error: No library stub file for module 'setuptools'
setup.py:15: note: (Stub files are from https://github.com/python/typeshed)
setup.py:16: error: No library stub file for module 'setuptools.command.build_py'
setup.py:74: error: Need type annotation for variable
It would seem that mypy's search for typeshed needs to be augmented with a case for this type of configuration. Mypy itself is at $HOME\appdata\roaming\python\python36\site-packages\mypy and typeshed is at $HOME\AppData\Python\lib\mypy\typeshed. Could you take a debugger and step through the default_data_dir() function (or insert some print statements) to find out where it goes wrong? I'm guessing the reason might be that it's looking for a component of the path named lib, but in your case there isn't one.
How did your Python install get in that location? I don't think that's where the Windows installers downloaded from python.org put it (but I might be wrong).
How did your Python install get in that location? I don't think that's where the Windows installers downloaded from python.org put it (but I might be wrong).
For me the default 3.x install directory for the newer installers (3.5+) point to %USERPROFILE%\AppData\Local\Programs\Python\PythonXY instead of C:\PythonXY.
I can give a shot at trying to work out the issue in a couple days, however the problem might be obvious from the install logs already, I'm not too sure.
no custom compiling! I reinstalled python just to make sure, clicked the main 3.x.x download link on python.org, did the following, then ran pip install . --user in the same folder as before, same result!
Could you point out the comparison that you are thinking of? The part of the code in question is independent of the OS path separator to my knowledge. I'm thinking of here in particular
I wasn't thinking of os.sep but of different cases for lib or python (on the next line). In particular the OP has Python (%AppData%\Python\lib\mypy and C:\Users\[redacted!]\AppData\Roaming\Python\lib\mypy).
I'm working on the hypothesis that ...\appdata\roaming\python\python36\site-packages (as quoted by OP) might be using capitalization everywhere, i.e. ...\AppData\Roaming\Python\Python36\site-packages. The only time this path is quoted by the OP it's clearly already lowercased by pip, so we have no hard evidence against this hypothesis. And if that's true, the algorithm (which seems to be searching for the python36 segment of the path) would fail since it's doing a case-sensitive comparison.
I have no idea what installer was used, so I don't want to exclude this hypothesis yet -- it seems to be using capitalization in earlier segments of the path (at least ...\AppData\Roaming\Python are quoted by the OP). Also, I found this about AppData\Roaming: https://askleo.com/whats-the-appdata-roaming-folder/
Aha, I see an issue. In the screenshots of your installer, you are using Python 3.6 32 bits. It is being installed in %USERPROFILE%\AppData\Local\.... It seems that the mypy.exe is left over (it is installed in %USERPROFILE%\AppData\Roaming).
However, I agree that the check for prefixes with python should probably be case insensitive. So I will make a PR about that.
By the way #3991 broke installing mypy on Linux Mint. So if #3991 doesn't really solve this problem then I propose to remove the or os.path.basename(lib).startswith('python') line.
tst22.py: error: Name '__builtins__' is not defined
tst22.py:1: error: No library stub file for standard library module 'typing'
tst22.py:1: note: (Stub files are from https://github.com/python/typeshed)
it goes into appdata/roaming when done with --user, if I did it without --user it would end up in the appdata/local spot
I did say I wiped the folder!
And it reproduces in a VM too!
# after installing python like I did in the screenshots before:
# Also using absolute paths since too lazy to update my path for pip's user install location
PS [blah]\mypy> C:\Users\[differentusername!]\AppData\Roaming\Python\Python36\Scripts\mypy.exe setup.py
Could not resolve typeshed subdirectories. If you are using mypy
from source, you need to run "git submodule --init update".
Otherwise your mypy install is broken.
Python executable is located at c:\users\[differentusername!]\appdata\local\programs\python\python36-32\python.exe.
Mypy located at C:\Users\[differentusername!]\AppData\Roaming\Python\Python36\site-packages
However I will note, running the module directly works:
PS [blah]\mypy> python -m mypy .\setup.py
setup.py:15: error: No library stub file for module 'setuptools'
setup.py:15: note: (Stub files are from https://github.com/python/typeshed)
setup.py:16: error: No library stub file for module 'setuptools.command.build_py'
setup.py:74: error: Need type annotation for variable
(but for some reason my main install doesn't mirror that, dunno!) (I guess I'll consider my main install damaged for now since it repros differently)
It looks like installation on Mac is also broken now. I see:
tst22.py: error: Name '__builtins__' is not defined
tst22.py:1: error: No library stub file for standard library module 'typing'
tst22.py:1: note: (Stub files are from https://github.com/python/typeshed)
Should we just roll back whatever broke things recently?
On Sep 25, 2017 6:58 AM, "Ivan Levkivskyi" <notifications@github.com> wrote:
It looks like installation on Mac is also broken now. I see:
tst22.py: error: Name '__builtins__' is not defined
tst22.py:1: error: No library stub file for standard library module 'typing'
tst22.py:1: note: (Stub files are from https://github.com/python/typeshed)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3988 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACwrMpNq95PXa1706JJE3P_zHYh7zUUKks5sl7E7gaJpZM4PheqA>
.
Activity
gvanrossum commentedon Sep 23, 2017
It would seem that mypy's search for typeshed needs to be augmented with a case for this type of configuration. Mypy itself is at
$HOME\appdata\roaming\python\python36\site-packages\mypyand typeshed is at$HOME\AppData\Python\lib\mypy\typeshed. Could you take a debugger and step through thedefault_data_dir()function (or insert some print statements) to find out where it goes wrong? I'm guessing the reason might be that it's looking for a component of the path namedlib, but in your case there isn't one.How did your Python install get in that location? I don't think that's where the Windows installers downloaded from python.org put it (but I might be wrong).
emmatyping commentedon Sep 23, 2017
I can debug this.
For me the default 3.x install directory for the newer installers (3.5+) point to
%USERPROFILE%\AppData\Local\Programs\Python\PythonXYinstead ofC:\PythonXY.Fix finding typeshed user install on Windows (#3991)
Summertime commentedon Sep 24, 2017
sorry for a slightly-too-late response, the fix doesn't seem to work for me :(
https://gist.github.com/Summertime/403ce90d067253669796326212becce0 probably-overkill install logs are here for the exact paths of everything (installing from the latest merge)
I can give a shot at trying to work out the issue in a couple days, however the problem might be obvious from the install logs already, I'm not too sure.
emmatyping commentedon Sep 24, 2017
Hm okay. Based on the output of the log it seems that you are using a custom compiled Python. Is that true? Sorry that fix didn't work for you.
Summertime commentedon Sep 24, 2017
no custom compiling! I reinstalled python just to make sure, clicked the main 3.x.x download link on python.org, did the following, then ran
pip install . --userin the same folder as before, same result!emmatyping commentedon Sep 24, 2017
Could you tell me what
where mypygives you now that you re-installed Python? Thanks!gvanrossum commentedon Sep 24, 2017
emmatyping commentedon Sep 25, 2017
Could you point out the comparison that you are thinking of? The part of the code in question is independent of the OS path separator to my knowledge. I'm thinking of here in particular
mypy/mypy/build.py
Line 231 in 6c409b4
gvanrossum commentedon Sep 25, 2017
I wasn't thinking of
os.sepbut of different cases forliborpython(on the next line). In particular the OP hasPython(%AppData%\Python\lib\mypyandC:\Users\[redacted!]\AppData\Roaming\Python\lib\mypy).emmatyping commentedon Sep 25, 2017
Confusingly,
%APPDATA%expands to%USERPROFILE%\AppData\RoamingorC:\Users\<username>\AppData\Roaming, so essentially the two are the same.gvanrossum commentedon Sep 25, 2017
I'm working on the hypothesis that
...\appdata\roaming\python\python36\site-packages(as quoted by OP) might be using capitalization everywhere, i.e....\AppData\Roaming\Python\Python36\site-packages. The only time this path is quoted by the OP it's clearly already lowercased by pip, so we have no hard evidence against this hypothesis. And if that's true, the algorithm (which seems to be searching for thepython36segment of the path) would fail since it's doing a case-sensitive comparison.I have no idea what installer was used, so I don't want to exclude this hypothesis yet -- it seems to be using capitalization in earlier segments of the path (at least
...\AppData\Roaming\Pythonare quoted by the OP). Also, I found this aboutAppData\Roaming: https://askleo.com/whats-the-appdata-roaming-folder/Summertime commentedon Sep 25, 2017
I did make sure to wipe all site-package/script directories before reinstalling too, so not an artifact of the previous install
As reported by powershell/windows (and as a result, probably the "official" capitalization that would show up:
I'm working on seeing if this reproduces in a fresh windows 10 VM using only
https://www.python.org/ftp/python/3.6.2/python-3.6.2.exe and
https://github.com/git-for-windows/git/releases/download/v2.14.1.windows.1/Git-2.14.1-64-bit.exe
emmatyping commentedon Sep 25, 2017
Aha, I see an issue. In the screenshots of your installer, you are using Python 3.6 32 bits. It is being installed in
%USERPROFILE%\AppData\Local\.... It seems that themypy.exeis left over (it is installed in%USERPROFILE%\AppData\Roaming).However, I agree that the check for prefixes with
pythonshould probably be case insensitive. So I will make a PR about that.ilevkivskyi commentedon Sep 25, 2017
By the way #3991 broke installing mypy on Linux Mint. So if #3991 doesn't really solve this problem then I propose to remove the
or os.path.basename(lib).startswith('python')line.emmatyping commentedon Sep 25, 2017
Hm, that is concerning. Could you describe how it is broken?
ilevkivskyi commentedon Sep 25, 2017
...or make this check dependent on
sys.platform == 'linux'.ilevkivskyi commentedon Sep 25, 2017
I see this when I install from git master:
ilevkivskyi commentedon Sep 25, 2017
FWIW, removing the line I mentioned fixes the problem. But I have no idea why.
Summertime commentedon Sep 25, 2017
it goes into
appdata/roamingwhen done with--user, if I did it without--userit would end up in theappdata/localspotI did say I wiped the folder!
And it reproduces in a VM too!
However I will note, running the module directly works:
(but for some reason my main install doesn't mirror that, dunno!) (I guess I'll consider my main install damaged for now since it repros differently)
ilevkivskyi commentedon Sep 25, 2017
It looks like installation on Mac is also broken now. I see:
gvanrossum commentedon Sep 25, 2017
emmatyping commentedon Sep 25, 2017
I made a PR which should fix everything in #4005.
Support user install on Windows. (#4005)