tomopy / tomopy

Tomographic Reconstruction in Python
http://tomopy.readthedocs.org
Other
319 stars 274 forks source link

windows 10 #283

Closed decarlof closed 5 years ago

decarlof commented 6 years ago

Has anyone being able to build/install tomopy under windows 10?

If so can you provide instruction so we can update the documentation?

I tried following the instruction by teracamo branch win_x64 but it fails.

newville commented 6 years ago

@decarlof @dgursoy I've been trying to build tomopy on Windows. I was able to build tomopy on 64-bit Windows 7 for Anaconda Python 3.6 .

For this, I used MinGW 6.3.0 (posix), and had to make some small hacks to distutils/cygwinccompiler.py so that it replaced 'msvcr140' with 'vcruntime140'. I don't know if this is related to the mess of various VS versions I have on the machine in question. I'll try this on Windows 10 too.

I did add some library locations to setup.py (I will issue a PR for that soon). With that change, python setup.py build_ext --compiler=mingw32 build

does work to compile all extensions.

Running the automated tests shows many failures, but I have not started to investigate why that is....

I have not yet been able to build with Python 2.7 (Anaconda) and the same MinGW 64 compiler. Code compiles but cannot link to 'mkl_rt':

C:/Program Files\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev2\mingw64\bin\dllwrap.exe -mdll 
-static --entry _DllMain@12 --output-lib build\temp.win-amd64-2.7\Release\src\liblibtomopy.a --def 
 build\temp.win-amd64-2.7\Release\src\libtomopy.def -s build\temp.win-amd64-2.7\Release\src\utils.o
 build\temp.win-amd64-2.7\Release\src\project.o build\temp.win-amd64-2.7\Release\src\gridrec.o
 build\temp.win-amd64-2.7\Release\src\art.o build\temp.win-amd64-2.7\Release\src\bart.o 
 build\temp.win-amd64-2.7\Release\src\fbp.o build\temp.win-amd64-2.7\Release\src\mlem.o
 build\temp.win-amd64-2.7\Release\src\osem.o build\temp.win-amd64-2.7\Release\src\ospml_hybrid.o
 build\temp.win-amd64-2.7\Release\src\ospml_quad.o 
 build\temp.win-amd64-2.7\Release\src\pml_hybrid.o 
 build\temp.win-amd64-2.7\Release\src\pml_quad.o 
 build\temp.win-amd64-2.7\Release\src\prep.o 
 build\temp.win-amd64-2.7\Release\src\sirt.o 
 build\temp.win-amd64-2.7\Release\src\morph.o 
 build\temp.win-amd64-2.7\Release\src\stripe.o 
 build\temp.win-amd64-2.7\Release\src\remove_ring.o 
 -LC:\Users\xas_user\AppData\Local\Continuum\Anaconda2\Library 
 -LC:\Users\xas_user\AppData\Loca\Continuum\Anaconda2\Library\bin 
 -LC:\Users\xas_user\AppData\Local\Continuum\Anaconda2\libs 
 -LC:\Users\xas_user\AppData\Local\Continuum\Anaconda2\PCbuild\amd64 
 -LC:\Users\xas_user\AppData\Local\Continuum\Anaconda2\PC\VS9.0\amd64 
 -lpython27 -lmsvcr90 -o build\lib.win-amd64-2.7\tomopy\libtomopy.pyd -lm 
 -LC:\Users\xas_user\AppData\Local\Continuum\Anaconda2\Library\bin -lmkl_rt
  C:/Program Files/mingw-w64/x86_64-6.3.0-posix-seh-rt_v5-rev2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmkl_rt

which is odd, because the mkl and mkl-devel packages are definitely installed, and mkl_rt.dll is actually in ..../Anaconda2/Library/bin.

FWIW, I think it might be hopeless to try to build the most recent tomopy code with MS compilers, as much of the tomopy code (say, in gridrec.h and gridrec.c) assumes C99-std things like complex.h that seem to not be available with MS compilers.

carterbox commented 5 years ago

Could we use compiler definitions to use either complex.h or Microsoft's complex numbers depending on the environment?

newville commented 5 years ago

@carterbox Maybe. I think one might have to replace float _Complex (C99) with _fComplex (MS) probably with the preprocessor. I have not tried this.

It might also be reasonable to change gridrec.c and gridrec.h back to using a basic definition for complex types instead of assuming C99 Complex. I don't recall how it was done in earlier versions of tomopy, but I know the original gridrec code from BNL did not use C99, and that some folks use that on Windows almost exclusively.

But giving proper support to Windows would be great!