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.core
unconditionally imports numpy._pytesttester
-> issue when freezing
#17183
Comments
numpy.core
unconditionally imports numpy._pytesting
-> issue when freezingnumpy.core
unconditionally imports numpy.pytesttester
-> issue when freezing
numpy.core
unconditionally imports numpy.pytesttester
-> issue when freezingnumpy.core
unconditionally imports numpy._pytesttester
-> issue when freezing
In this case it's only a single import, so it's not totally unreasonable. But the logic here that PyInstaller et al. use seems wrong - there may be other optional dependencies that get included this way, and there should be a simple way to exclude those from the freezing process. Not using a guarded |
Well the issue is that The same issue arrives with The proposed solution is just the easiest work-around. Please note: I'm just the PyInstslelr maintainer, not using numpy at all. So actually I do not care about frozen numpy applications are huge or not. This would just be a favour for the users. Thus I'm not going contribute to this discussion any further. If some reasonable solution arises from this issue, we are please if one opens a ticket at https://github.com/pyinstaller/pyinstaller/ for us to follow up. |
That's not my point -
Thanks, I wasn't aware. I understand it's up to us to do the work here. What I was asking is if there's some allow/deny-list mechanism to simply exclude modules, because |
Same thing applies - |
This is no longer true:
|
For a more persistent solution, PyInstaller offers "hooks", where you can |
Maybe numpy project wants to provide hooks? See #17184 |
Users can do this today with |
numpy.core
unconditionally importsnumpy._pytesttester
. When freezing an numpy-application using PyInstaller, py2app, etc., this leads to pytest being included into the frozen application and thus about 180 modules more to be included.Reproducing code example:
This shows about 60 pytest modules included.
In total this lead to about 150 packages more being included than without pytest:
Proposed solution
As a simple work-around: In numpy._pytesttester change the import into:
Thus at least PyInstaller can not detect this import.
A better solution would be to import _pytesttester only on demand.
Numpy/Python version information:
The text was updated successfully, but these errors were encountered: