-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Mingw Gfortran on Windows? #2829
Comments
That would be really good. |
What Blas/Lapack version can we use? That would be really good. to echo Matthew |
I can't find @cournape's description of the issue right now, but the problem is what to do with the binaries. Apparently with MinGW 4.x we need extra dll's and have nowhere to install them in such a way that they can be found. |
@rgommers that's correct. There are only bad solutions:
Details: there is unfortunately no way to statically link the required runtimes on gcc 4.x, and short of putting the mingw dll in C:\Python_, I don't see any solution. Putting the dll in C:\Python_ is really horrible, though, and prone to all kind of dll-hell situations. I have an idea that could fix this long term (requires changes to python itself), but that won't fix anything until we can give up the current python... |
Let me understand this, is it a problem with the recent versions of MinGW, gfortran specifically, distutils, Python itself, this charming operative system, everything at the same time? |
@Juanlu001 It is a problem related to recent versions of mingw + windows-specific issues, in the sense that every other system has a sane way to ship "private" shared libraries. |
Maybe this discussion should go to the {numpy or scipy} mailing list with the options laid out? Am I right in thinking this issue is now blocking us from using fortran 90 in scipy and providing Windows 64 bit builds for numpy? |
Previous discussion on this thread : http://mail.scipy.org/pipermail/numpy-discussion/2013-February/065339.html |
For future references, this is the description @cournape gave on the mingw + windows issue, in the thread @matthew-brett linked: http://mail.scipy.org/pipermail/numpy-discussion/2013-February/065349.html According to the documentation, g77 cannot compile Fortran 90 (the new features not available in FORTRAN 77) http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/Fortran-90-Support.html So yes, this is blocking us from using Fortran 90 (see #2818). |
I would perhaps just dive for the DLL-hell solution. At least build an example installer and put it available with the beta release and see how many people manage to blow a gasket. Of course, this may be hitting not-so-nicely the downstream guys like Anaconda & EPD (but are they really also sticking with G77)? The package list on http://scipy.org/install.html should be checked. |
It does not matter for us (Enthought) at least, since we're not using mingw at all for our own packages. Someone from Continuum should answer, but I suspect that's not a problem for them either. |
@ilanschnell do you care about g77 support for Anaconda? |
If we drop support for Windows XP and Vista for the binaries we provide ourselves, then we can go to MinGW 4.x without DLL hell, correct? That may the best option - XP support has ended back in 2009 and extended (paid) support is also ending in H1 2014. And no one runs Vista, right? |
There was also the suggestion from Christoph Gohlke to preload the DLLs from a custom location using ctypes. If that works (he says he used it), it would seem like a portable solution. |
We also do not use mingw to compile the packages that go into Anaconda. So no, g77 is not an issue. |
Yeah, in case dropping XP and Vista support is unacceptable, @cgohlke's solutions are here: http://mail.scipy.org/pipermail/numpy-discussion/2013-February/065357.html It's not pretty, but it's hardly DLL-hell. DLL-minor-purgatory, maybe. The current mingw3-based system is what's really hellish... |
it is not just about being non pretty, it causes lots of problems in non-standard installation, or embedding. I actually prefer DLL-hell to that solution. |
Can you give an example of such a problem? Installation in a non-standard location seems like a non-issue to me -- if The way embedding tools handle .dll's like multiarray.dll is that they just I might be missing something... On Mon, Sep 16, 2013 at 11:15 AM, David Cournapeau <notifications@github.com
|
Which MingW dlls are still necessary? Josef |
@njsmith the pb with non standard installation is not where to look for the file, but pre-loading. Some packages do that, and it causes hard to track bugs, because it changes the rules of which dll are looked first (or worse how symbols are resolved). Putting the dll in non standard location without pre-loading is actually the ideal solution :) |
As Josef notes above, Mingw >= 4.7.1 have EDIT: |
@josef-pkt I believe neither the C++ exception support (the *sljl.dll stuff) or the fortran runtimes can be statically linked. So while numpy may be fine, scipy will not. Last time I tried to force static linking, it crashed horribly at import times for scipy, but I have not tried for a while now. |
From @cournape: To be clear when I'm referring to Cristoph's solutions I mean On Mon, Sep 16, 2013 at 1:11 PM, David Cournapeau
|
From a search on my Windows computer, octave and several other programs have the gcc dlls locally. |
using recent mingw-w64 toolchains, i.e. mingw-builds "http://sourceforge.net/projects/mingwbuilds/" statically linking is possible with the following flags at the linking stage: "-static" "-static-libgcc" "-static-libstdc++" "-static-libgfortran" depending on wether you use Fortran, C++, C. Result is that there is no dependency on any gcc DLLs. I'm not sure if "-static-libgfortran" has an effect. From my experience gfortran linking with "-static" "-static-libgcc" is sufficient. Another possibility is using a toolchain with shared linking disabled , i.e. from "equation.com" or TDM's mingw toolchain. I personally prefer a toolchain with a comprehensible build process and patches, i.e. mingw-build (see "https://github.com/niXman/mingw-builds" ). I never encountered problems with static linking python extensions with mingw-w64 (mostly gfortran). The overhead is minimal after the pyd files are stripped. Some other details which should be considered:
There is much more to say about mingw-w64 usage:
|
Earlier, there were also some legal concerns with mingw-w64. These seem to have been resolved: https://lists.fedoraproject.org/pipermail/mingw/2012-February/004533.html EDIT: ok, I see you noted this too... |
I have started looking into this yesterday night: I intend to build openblas with mingw+msys, and then look into numpy + scipy with the static options. |
BTW: openblas has some binaries on sourceforge: "http://sourceforge.net/projects/openblas/files/v0.2.8/" mingw-w64 itself is on the way to make a new stable release (if I understand it correctly): I intend to build a fully statically gcc and maybe publish the binaries somewhere in near future. Things to include are missing libmoldnameXX.a libraries for msvcr80..100 versions as well as different spec files for linking with different msvcr runtimes. Another hint is important for working with 64bit Windows and 64bit gcc: instead of msys it is recommended to use msys2 http://sourceforge.net/projects/msys2/files/Alpha-versions to get around the SysWOW64 problem http://en.wikipedia.org/wiki/WoW64 . |
See here what happens when I go from 4 threads (number of physical cores) to 8 threads (number of logical cores): http://nbviewer.ipython.org/urls/dl.dropboxusercontent.com/u/12464039/kdtree-jan21-simd.ipynb Why? Because if I only have half as many threads as logical cores, each thread has a 50 % chance of being scheduled to an idle core. |
Is your claim that if you have 2 threads, 2 physical cores, and 4 total Determining the fastest number of threads for a given workload on modern Anyway, this is all 100% a topic for the OpenBLAS bug tracker, not numpy or
|
Link to the "funding request" on the mingwpy subject: https://mingwpy.github.io/proposal_december2015.html Is it still true that this problem has an impact on "odeint / sundials" progress ? #2818 |
Thanks for linking, I was not aware of its existence. Please keep us posted about NumFOCUS decision :) |
@Juanlu001 the full proposal was just accepted. I just sent a PR to update http://mingwpy.github.io/roadmap.html with a sentence saying that. |
wunderbar ! |
Congratulations! 🎉 |
I was starting to type "yes, because ..." but then realized that we did drop the numpy-vendor (mingw32) based toolchain a few weeks ago. And that was the issue - we relied on g77 for Windows binaries. So even before we start using MingwPy for Windows wheels on PyPi (i.e. right now), we can start using Fortran 90/95 code I think. Does anyone see a problem with that? |
So the logic here is that for now, ifort will be the only supported fortran compiler for building scipy on windows, and eventually (if everything goes well) gfortran will also be supported? That sounds plausible, since I'm pretty sure @cgohlke and Anaconda (@ilanschnell?) are already using ifort, and WinPython IIUC is already using Carl's gfortran builds (right @stonebig?). I'm not as certain about Canopy (@cournape) or Python(x,y) (@mindw, @yuvalj) -- anyone want to object? |
Python(x,y) uses uses ifort. |
Pretty much, but minor correct: |
Yes, we use |
Currently, WinPython is mainly prepared with @cgohlke wheels for the scipy stack, as:
This bus factor of 1 is an uncomfortable blue pill. |
It's true that scipy compiles with mingwpy/gfortran on the windows platform without compile or link errors. The prerequisite is a mingwpy compiled numpy build. Hence an officially scipy build compiled with mingwpy/gfortran will be available with the advent of a rigorously tested numpy based on mingwpy and OpenBLAS. The necessary code changes for numpy has been withdrawn due to some side effects some weeks ago. This numpy customization has to be corrected and resubmitted to the numpy repository. This is an essential part of the recently confirmed mingwpy proposal. One nice feature of scipy-1.6.x is the Cython api for LAPACK and BLAS: #4021. It means in effect that a python package depending on specific BLAS/LAPACK features can be developed with the help of the Scipy Cython API without becoming dependant on the specific BLAS implementation of numpy. The hope is, that much less packgages with a dedicated numpy+MKL dependancy are around. BTW the latests numpy, scipy test builds (based on local patches and mingpwy, OpenBLAS) are about 4 months old and can be found here:
Here: https://anaconda.org/carlkl/all are some more and somewhat older variants. numpy-1.9.3 and scipy-1.6.1 and newer releases are in the pipeline. For the existings builds there are some test failures
this happens only on 32 bit
this happens on python-3.4.amd64
this errors pops up because there is an additional byte at the end of the footer This picture may change with future builds of numpy scipy |
Not sure if this is in the right discussion, but I saw Anaconda people speaking of compiling with ifort.exe. I can compile NumPy with MKL or OpenBLAS no problem w/ MSVC14, but on SciPy I get an error "no fortan compiler found" about halfway through the build. Obviously ifort is available. Do you modify the build files at all in SciPy to get it to compile? Thanks. |
Building scipy with MSVC and Intel Fortran compiler is supported. Just be sure to pass |
@mrslezak : You need to have @cournape : It may actually not be necessary to pass in the |
Removed the 0.18.0 milestone - this is not tied to a particular release anymore. Once we can build binary wheels for Windows, we'll upload them for the latest existing releases. The g77 vs. gfortran thing is resolved: g77 is not supported anymore. Fortran 90/95 can be used in Scipy. |
This issue is resolved (pending only merging the numpy distutils patch), closing. |
So far we've kept to Fortran 77 due to needing g77 on Windows.
However, it seems to me Mingw32 gfortran-4.8.1 can compile a working Scipy, so perhaps it could be used for the next release? This would also allow including Fortran 90 code.
The text was updated successfully, but these errors were encountered: