Comments (3)
Looks like official documentation suggests "Microsoft Visual C++ Build Tools" is the correct answer, but I'm going to try with MinGW to see if it'll work
from pygrappa.
The computer I had access to that had Windows 10 did not give me admin rights. So all steps below assume no admin rights (part of the reason I couldn't go with VS C++ 14.0 option, requires admin rights to install...)
First try...
- Download Python 3.7.3 64-bit
- Download official MinGW, only comes in 32-bit flavor
- Add to PATH
- Find
vcruntime140.dll
online, download it and put in pythonpath/libs - Modify cygwinccompiler.py according to tgalal/yowsup#2494 :
@cesardmoro
edit your cygwinccompiler.py and download vcruntime140.dll and paste into pythonpath/libsdef get_msvcr(): """Include the appropriate MSVC runtime library if Python was built with MSVC 7.0 or later. """ msc_pos = sys.version.find('MSC v.') if msc_pos != -1: msc_ver = sys.version[msc_pos+6:msc_pos+10] if msc_ver == '1300': # MSVC 7.0 return ['msvcr70'] elif msc_ver == '1310': # MSVC 7.1 return ['msvcr71'] elif msc_ver == '1400': # VS2005 / MSVC 8.0 return ['msvcr80'] elif msc_ver == '1500': # VS2008 / MSVC 9.0 return ['msvcr90'] elif msc_ver == '1600': # VS2010 / MSVC 10.0 return ['msvcr100'] elif msc_ver == '1700': # Visual Studio 2012 / Visual C++ 11.0 return ['msvcr110'] elif msc_ver == '1800': # Visual Studio 2013 / Visual C++ 12.0 return ['msvcr120'] elif msc_ver == '1900': # Visual Studio 2015 / Visual C++ 14.0 # "msvcr140.dll no longer exists" http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx return ['vcruntime140'] else: raise ValueError("Unknown MS Compiler version %s " % msc_ver)
- run
pip install --global-option build_ext --global-option --compiler=mingw32 pygrappa
(see pypa/pip#18 (comment))
Unfortunately this leads to an error stemming from a mismatch between MinGW and Python, 32 bit and 64 bit respectively (see kivy/cymunk#52 (comment)).
Let's try again, this time with 64 bit MinGW...
- Download MinGW (choose 32 or 64, whichever corresponds to the python build you have. I'm using python 3.7.3 , so get 64 bit following this guide: https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&-MSYS2)
- Install everything in previously mentioned guide and add everything to PATH. I had to edit PATH for current user because I didn't have admin rights. I'll reproduce the relevant parts from the guide here in case the link ever goes bad:
If you have a 32-bit development machine, change every occurrence of C:\dev\msys64 with C:\dev\msys32 below. However, it's
<current year>
, get a 64-bit machine.Download msys2-x86_64-latest.exe and run it. If your development machine is 32-bit, download msys2-i686-latest.exe instead. Make sure to set the install directory to C:\dev\msys64 (C:\dev\msys32 for 32-bit). Choose to run MSYS2 right now.
In the MSYS2 shell, execute the following. Hint: if you right click the title bar, go to Options -> Keys and tick "Ctrl+Shift+letter shortcuts" you can use Ctrl+Shift+V to paste in the MSYS shell.
pacman -Syuu
Close the MSYS2 shell once you're asked to. There are now 3 MSYS subsystems installed: MSYS2, MinGW32 and MinGW64. They can respectively be launched from C:\dev\msys64\msys2.exe, C:\dev\msys64\mingw32.exe and C:\dev\msys64\mingw64.exe. If the installer created any shortcuts to open shells for these subsystems, you can update them to these locations to get pretty icons. Each subsystem provides an environment to build Windows applications. The MSYS2 environment is for building POSIX compliant software on Windows using an emulation layer. The MinGW32/64 subsystems are for building native Windows applications using a linux toolchain (gcc, bash, etc), targetting respectively 32 and 64 bit Windows. We will install our PATH such that these tools can be called from regular cmd.exe as well, and we need only use the MinGW subsystem to install/update MSYS2 packages or if our build setup requires a *nix shell. Hint: after starting up MSYS2, the prompt will say which version you launched.Reopen MSYS2 (doesn't matter which version, since we're merely installing packages). Repeatedly run the following command until it says there are no further updates. You might have to restart your shell again.
pacman -Syuu
Now that MSYS2 is fully up-to-date we will install GCC and common build tools. When you are queried to select packages and confirm the installation just press enter:pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
git subversion mercurial
mingw-w64-i686-cmake mingw-w64-x86_64-cmake
Add C:\dev\msys64\mingw64\bin and C:\dev\msys64\mingw32\bin, in that order, to your PATH. Note that MSYS2 also puts a lot of other tools in this directory, most notably Python. So put these entries below any other tools you might have installed in your PATH.
- Again, modify cygwinccompiler.py similar to tgalal/yowsup#2494 (it doesn't seem like we need vcruntime140.dll this time), but using the version number 1916:
def get_msvcr(): """Include the appropriate MSVC runtime library if Python was built with MSVC 7.0 or later. """ msc_pos = sys.version.find('MSC v.') if msc_pos != -1: msc_ver = sys.version[msc_pos+6:msc_pos+10] if msc_ver == '1300': # MSVC 7.0 return ['msvcr70'] elif msc_ver == '1310': # MSVC 7.1 return ['msvcr71'] elif msc_ver == '1400': # VS2005 / MSVC 8.0 return ['msvcr80'] elif msc_ver == '1500': # VS2008 / MSVC 9.0 return ['msvcr90'] elif msc_ver == '1600': # VS2010 / MSVC 10.0 return ['msvcr100'] elif msc_ver == '1916': # Visual Studio 2015 / Visual C++ 14.0 # "msvcr140.dll no longer exists" http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx return ['vcruntime140'] else: raise ValueError("Unknown MS Compiler version %s " % msc_ver)
- now run the command
pip install --global-option build_ext --global-option --compiler=mingw32 --global-option -DMS_WIN64 pygrappa
.
We need to explicitly give option -DMS_WIN64
as in cython/cython#2670 (comment):
@gui36 I have a similar issue with my code and had a discussion in the cython-users Google group. The problem is in the header
pyport.h
, in whichSIZEOF_VOID_P
is defined based on whetherMS_WIN64
is defined or not. The solution is to pass-DMS_WIN64
when compiling with MinGW.
Summary:
- Use Python 3.7 64-bit
- Use 64-bit MinGW fork
- Change cygwinccompiler.py to not break with non-visual-studio compilers
- Pass compilation options explicitly when installing using pip
from pygrappa.
Running basic_cgrappa.py needs scipy.
from pygrappa.
Related Issues (20)
- ndarray is not C-contiguous error, when using grog and switching the coil axis HOT 3
- Build problem on M2 Mac with Meson 1.3.2 HOT 1
- API references missing cgrappa
- cgrappa breaks on 7T real data
- CI error for python 3.5
- ENH: multidimensional data support for cgsense
- ValueError when using complex64 with cgrappa HOT 10
- ENH: revamp cgrappa HOT 1
- ERROR when installing pygrappa in a singularity image HOT 7
- Precision on the kernel size HOT 13
- igrappa doesn't return coil dimension
- Regularly undersampled GRAPPA HOT 1
- Aliasing artifacts HOT 4
- BUG: radialgrappaop should use lamda0, not lamda
- Slow performance of mdgrappa HOT 7
- skimage.util.pad not available HOT 2
- Keeping calibration weights for reuse? HOT 5
- Defination of kernel sizes not agree with most papers HOT 2
- Local utils package cannot be imported properly HOT 3
- Memory Allocation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pygrappa.