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
BUG: no module named 'numpy._typing._ufunc' #24604
Comments
This is not a bug though? The This very much looks like a sphinx issue to me, as in its current state a global constant is altered while they lack a way of dealing with all the ramifications of doing so. |
Oops me example code is wrong, this is typing I imported, not testing (I will edit). To me, it looks like each module has its own view of what the TYPE_CHECKING implies, and it’s quite hard to know where the bug really is 😅 |
While the official docs are admittedly somewhat slim they do state clearly that its value should be assumed as In addition, PEP 484 clearly states that the constant is intended to be used for code that "must be seen by a type checker (or other static analysis tools) but should not be executed". The latter very much means that stub files, which are intended for type checkers (among others) rather than runtime, are fair game, if not one of its primary intended use cases. |
In this recent PR I encountered a very similar issue with the same traceback to a ModuleNotFoundError in numpy. This is only a problem for my docs builds with Sphinx v7.2.5 on RTD (my docs render a notebook that uses numpy and jax, so this seems very similar). When I pin to Sphinx v7.2.4 I no longer get this error. This seems consistent with the original suggestion that this is somehow an issue with sphinx, and also with the coincidental timing of Sphinx v7.2.5 release date of August 31, 2023. |
I'm going to close this issue though as this is very much a sphinx issue, and one that will persist as such as long as they'll keep using |
Describe the issue:
When importing
numpy.testing
with type checking enable, I get the following error message (see context below).Reproduce the code example:
Error message:
Runtime information:
Context for the issue:
So I initially faced some issue in Sphinx 7.2, see sphinx-doc/sphinx#11652, and it turns out it was because they now import with
typing.TYPE_CHECKING=True
withautodoc
, which causes some import error.After filing an issue on the Jax repo, see google/jax#17385, I am now filing an issue here, because the earliest traces of the error are found when importing
numpy.testing
.The text was updated successfully, but these errors were encountered: