-
Notifications
You must be signed in to change notification settings - Fork 26
MAINT: init file and mpl updates #70
MAINT: init file and mpl updates #70
Conversation
* we've been getting reports of new Python 3.7 patch releases from Windows store causing SciPy DLL load issues: scipy/scipy#11826 * so, extend the `_distributor_init.py` machinery usage to include Python 3.7 and up for our wheels * simplify the appveyor `matplotlib` install now that there are stable releases available for Python `3.8`
Oh, I think the Travis config file needs an update too for the run to show up--something similar happened to Chuck and Matti recently.. |
420d69f
to
3b57fd5
Compare
* fix warnings in `.travis.yml` based on feedback from https://config.travis-ci.com/explore * bump distro to `bionic` since NumPy did this recently too * attempting to restore Travis CI runs to our wheels build matrix
3b57fd5
to
9bd0bc9
Compare
* try using `[System.Version]` for more robust Python version comparisons in powershell
The 2 test failures in the 32-bit run are this long-standing issue: scipy/scipy#11095 The other Travis failure are probably because of the NumPy < 1.14.5 --I'll try bumping up from 1.13.3. |
* update minimum NumPy version to `1.14.5` * the distutils override for appveyor/Windows builds now only happens for Python < 3.7, since we have now added the `_distributor_init.py` for Python 3.7 (not just Python 3.8)
086d2c3
to
88dbc09
Compare
I've pushed another attempted fix--the appveyor/Windows distutils override should only happen for Python < 3.7 now. I think that is because once the Well, it is a bit confusing, but if the CI gets to a state where there Appveyor is green & Travis CI only has the two 32-bit matrix entry failures for scipy/scipy#11095, then this PR should be in good shape. |
If that doesn't work on its own, I may have to look at the version of distutils in play for Python 3.7 on Windows. I don't think we'd want to bump the base version of NumPy in use for Python 3.7 if we can avoid that. Python 3.8 has a higher version of NumPy by necessity on Windows I think. |
* try using newer NumPy version for Windows Python 3.7 builds, to see if this helps `check_installed_package.py`
The 32-bit specific failure occurs for this loading of this DLL based on the debug printed CI output:
|
@pv @rgommers Since the Windows store Python 3.7 indicates that Perhaps that's a good enough excuse to only add the I'd still have to back out some of the debug changes above, but this may make things a bit easier if possible. |
That's fine. 32-bit isn't used a lot, so given our fairly limited bandwidth I think getting a patch for |
Sorry if I'm confused here - but is this 32-bit Windows? I believe that that is still the default download from Python.org - is that right? So I would imagine that 32-bit Windows installations are still pretty common - and likely will be for a while yet : see pypa/manylinux#118 (comment) |
@matthew-brett indeed, but only Python from Windows Store is broken I believe, because it changed DLL path handling (perhaps for good reasons, but that's what necessitates us adding |
Ah, but that message you linked to does say 32-bit is likely to follow in Windows Store .... |
The I'll try a debug print of the contents of the |
I can reproduce locally on my Windows 10 machine using a 32-bit Python 3.7.7 install:
import os
from ctypes import WinDLL
# 32-bit SciPy wheel artifact install path:
basepath = os.path.abspath("C:\\Users\\treddy\\python37_32bit_venv\\lib\\site-packages\\scipy\\.libs")
for filename in os.listdir(basepath):
try:
WinDLL(os.path.join(basepath, filename))
except OSError:
print("Problem opening DLL:", filename)
else:
print("Successfully opened DLL:", filename)
@zooba @mattip Any red flags here for 32-bit specific DLL resolution issues? |
At the point you are loading the dll, you have not "mangled" the PATH at all (which One difference between 32 and 64 bit builds is the version of mingw compiler used. Maybe the older 32-bit mingw compiler does not play well with something in the build of those DLLs: do they use the same MSVC compiler? C++ vs. C? |
Hmm, I see this console output:
And tons of apparently false-negative missing DLLs similar to this:
|
Perhaps compare the failing dlls to the successful ones. There should be something ithat is definitely missing (not with an hour glass) on the ones that fail. |
If I modify my test script with one more line, The DLL resolution rules changed in Python 3.8, and I think that's why However, in attempting to patch an allegation that similar issues are cropping in Windows store Python 3.7 + SciPy wheels, adding I feel like there should be a big clue in here somewhere. From the Python 3.8 release notes:
Perhaps because Python 3.7 is still sensitive to the For some reason the invocation of 32-bit DLL resolution via 51 # Drop '' from sys.path
52 sys.path.pop(0)
53
54 # Find module path
55 __import__(args.module) |
* try to solve DLL resolution issues for older (32-bit) Python versions by temporarily moving into the path where they are stored prior to load attempts in `_distributor_init.py`
Ok, more extreme solution attempt--physically move right into the directory where the DLLs are stored prior to attempting to load them (and move back to original dir after) in That should have no effect for Python 3.8, but |
Ok, that trick worked, finally; I may expand to Python 3.6 as well based on previous discussion with Ralf in the issue. I'll start the process of peeling back the debug code & cleaning up, and hopefully no more surprises come up. |
This reverts commit 46e69e1.
* remove some debug prints * revert some debug changes * use `_distributor_init.py` with Python 3.6+ (all supported Python versions)
I think I'm reasonably happy with the state of this PR now--no more bypassing 32-bit Windows for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Tyler! Looks like this works, feels a bit scary/wrong to do a chdir
on import so would be good to add a summary of why other approaches fail. I guess that knowledge is in the above comments, but there's a lot of them ....
_distributor_init.py
Outdated
@@ -22,5 +22,12 @@ | |||
libs_path = os.path.abspath(os.path.join(os.path.dirname(__file__), | |||
'.libs')) | |||
if os.path.isdir(libs_path): | |||
# for Python < 3.8, try to achieve brute force resolution | |||
# of DLLs by moving into their storage dir; should have no | |||
# effect for Python >= 3.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why "should have no effect"? being more explicit would be good here. and/or skip the chdir
by checking sys.version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also adding a rationale or link to the relevant issue would be useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gruesome details are now in a substantially expanded set of comments above the code block. Note that we never really understood the 32-bit vs. 64-bit Python 3.7 issue, but simply spread out our DLL resolution mechanisms to include "one old way" and "one new way," and that seemed to work.
You could certainly make the argument that the chdir
stuff should be restricted to Python < 3.8, since that works and is now the most robust/secure way to load DLLs in std lib. I haven't done that, but we could if you prefer.
* wrap the `_distributor_init.py` `os.chdir` code in a `try .. finally` block to ensure restoration of the working directory if something fails * substantially expand the comments describing the rationale for the working directory changes in `_distributor_init.py`
Thanks @tylerjereddy, that comment helps. CI is unhappy again; AppVeyor is a flake but TravisCI is unhappy about some multibuild thing. |
multibuild should be updated to a more recent devel |
* sync multibuild submodule to latest `devel` branch checkout in attempt to deal with Travis CI failures that just started appearing
I pushed a commit syncing |
CI results look solid again--any other requests here? Otherwise, let's merge soon-ish since there will be more work to do before we're release-ready in wheels repo. |
Nice, merged. Thanks a lot @tylerjereddy! I'll deal with the two |
we've been getting reports of new Python 3.7
patch releases from Windows store causing SciPy DLL
load issues: Error with _fblas scipy/scipy#11826
so, extend the
_distributor_init.py
machinery usageto include Python 3.7 and up for our wheels
simplify the appveyor
matplotlib
install now thatthere are stable releases available for Python
3.8