-
Notifications
You must be signed in to change notification settings - Fork 767
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
Numpy: "nan" is not a known member of module #450
Comments
Duplicate of #150. Note that numpy is not a fully typed library in its latest released version, so enabling a type checking mode other than "off" is likely to cause trouble. Their next release should include stubs, though. |
This I'm confused by; we should have no behavioral differences to pyright in this case. Did you write stubs for numpy and they aren't being read? Are you certain the CLI version is running with identical settings? |
Nope. My setup was just installing WSL, installing node (from nodesource), then pyright, and opening VSCode on the folder. No type stubs or anything else. You can see on both outputs (pyright and pylance) that no I should mention that this was working correctly yesterday, I think, or maybe the day before that. Was there a recent update that might've caused this? Wrt settings, I don't have any config files for pyright, and for pylance the only relevant configuration is python path pointing to the virtual environment (which was activated when I ran pyright). |
Pyright's copy of Pylance is slightly ahead of the released version of pyright, so maybe there's a problem there. Note that Pylance's defaults are not the same as pyright, but arguably pyright's defaults are stricter so it doesn't make sense for Pylance to complain about something and pyright not. Yes, we release weekly, the latest being Wednesday. You can use the VS Code extension menu to roll back to any other version if you'd like to test an older release. |
Do you mean Pylance's copy of Pyright?
Pylance v2020.9.6 works fine. No issues. Edit: the Pylance changelog says this:
1.1.75 is also the version I have installed. The changelog does list two unreleased bug fixes, so the regression must've been introduced between the released 1.1.75 and the build that Pylance uses. |
I suspect this is due to a pyright change that was introduced after 1.1.75. I'll investigate further. |
Yes, my mistake.
Note that we make modifications to pyright internally and sync the changes back; potentially the issue could be there (I had fixed a few bugs I introduced in 2020.9.6 to do with paths). Feasibly you could build the pyright CLI and test it to see if it reproduces. |
I tried doing that. I followed the instructions on this page but here's what I got: italo@Malacandra ~/d/p/p/pyright (master)
> node ./dist/pyright.js ~/a.py
No configuration file found.
Search paths found for configured python interpreter:
/usr/lib/python3.8
/usr/lib/python3.8/lib-dynload
/home/italo/.local/lib/python3.8/site-packages
/mnt/c/Users/italo/Google Drive/Code/Library
/usr/local/lib/python3.8/dist-packages
/usr/lib/python3/dist-packages
stubPath /home/italo/dev/pyright/packages/pyright/typings is not a valid directory.
Assuming Python platform Linux
Searching for source files
Found 1 source file
/home/italo/a.py
2:1 - error: "print" is not defined (reportUndefinedVariable)
1 error, 0 warnings, 0 infos
Completed in 0.409sec
italo@Malacandra ~/d/p/p/pyright (master)
> which python
/usr/bin/python This is the same Obviously I'm missing a step on the build process, but I'm not sure what. |
That doc needs an update; run Note that you're now running pyright outside the venv and in a different directory; you should go back to where you were running pyright previously and run the local build from there. |
Are there any commits on pylance's pyright that aren't on the main repo? |
I found the culprit. As I suspected, it's a change that was made to pyright post 1.1.75 that was included in this week's pylance release. The problem is that numpy is using a form of __all__ += nanfunctions.__all__ I've added support for this form, and the problem is now fixed. Apologies for the regression. And thanks for reporting it. |
This should be available in the next release on Wednesday, right? |
Yes, we'll pull it in. I'm still wondering how your CLI isn't reporting this, but the GUI is, though... |
I presume that the CLI isn't reporting it because the last version of the CLI is 1.1.75 which doesn't have this change. |
I just built the CLI from the main repo, though (see above). It still doesn't report any errors. |
I'm able to repro the problem with pyright 1.1.75. It doesn't occur with pyright 1.1.74. The regression was introduced between these two versions. @oyarsa, I'm not sure why you are not seeing the problem with the CLI. Are you sure you're running the correct version? |
@erictraut This is what pyright is reporting. Again, this was built from the pyright repo (master branch). |
The version there is always the same (comes out of the package.json and is only bumped at release). The git state would be what to check, but I can see in #450 (comment) that you were running at the right revision. The only difference I can think of is the wrong python version being run or the wrong working directory. The linked comment is still running it on a file in |
We've just published a hotfix release (2020.9.8) for this rather than waiting until next week. Thanks for the report. |
Environment data
Expected behaviour
Pylance should recognise
nan
as part of thenumpy
module.Pyright CLI already recognises it.
Actual behaviour
XXX
Logs
The text was updated successfully, but these errors were encountered: