kwikteam / klustakwik2

Fast software for high-dimensional cluster analysis using the masked EM algorithm for Gaussians mixtures
BSD 3-Clause "New" or "Revised" License
27 stars 13 forks source link

Compiling on Windows 64 bit and Python 3 #63

Open rossant opened 9 years ago

rossant commented 9 years ago

Hi @thesamovar have you ever succeeded in compiling KK2 on Windows 64 bit and Python 3? I tried with no success..

thesamovar commented 9 years ago

I haven't tried because I run Python 2.x only. What happened when you tried?

rossant commented 9 years ago

The classic errors on windows: unable to find vcvarsall, or some bug in cygwincompiler.py, etc etc. I tried many things with the Visual Studio compilers. Using mingw64 is not possible apparently.

At some point we should resolve this on a dedicated build machine and ship binstar binaries so that no one else needs to do the compilation!

thesamovar commented 9 years ago

Oh there's a fix for this that we're using in Brian 2 but I don't remember what it is exactly. @mstimberg? I think it's just something like you have to import setuptools before distutils or something.

mstimberg commented 9 years ago

Yes, we compile C extensions for Python 3 on Windows 64 Bit with MSCV 10/SDK 7.1 on appveyor. I think it also works with the "C++ for Python" compiler, but I'd have to check that again (I'm sure it works for Python 2, but I did less testing for Python 3). The trick is indeed to import setuptools (a fairly recent version, but everything >=6 should work, I think) in the beginning, it will monkey-patch distutils and then things work.

nippoo commented 9 years ago

@mstimberg have you got this working with MSVC 2010 Express Edition? Or do I need to get hold of the full edition?

mstimberg commented 9 years ago

I think all that is needed is the SDK 7.1, I don't have any full MSVC compiler on my (virtual) Windows machine. The tricky bit is that you have to set up the environment in the right way. We do this in a script on appveyor, it is a copy from this repository: https://github.com/ogrisel/python-appveyor-demo The relevant bits are here: https://github.com/ogrisel/python-appveyor-demo/blob/master/appveyor/run_with_env.cmd#L35 The necessary steps are also described here: https://github.com/cython/cython/wiki/CythonExtensionsOnWindows#using-windows-sdk-cc-compiler-older-method

mstimberg commented 9 years ago

I'm actually not that sure anymore that the monkeypatching by setuptools is necessary here, maybe it was only necessary for the C++ for Python 2.7 compiler.

nippoo commented 9 years ago

I've managed to get it to build (python 3.4, 64-bit) by installing VS2010 (full edition, express only has 32-bit). Now I'm trying to build a binstar package but I guess something to do with the monkey-patching is failing...

  File "C:\Users\Max\Miniconda\lib\subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Users\\Max\\Miniconda\\Scripts\\pa
tch.exe', '-p0', '-i', 'c:\\users\\max\\appdata\\local\\temp\\tmpqu71m7conda_ske
leton_klustakwik2-0.2.2.tar.bz2\\pypi-distutils.patch']' returned non-zero exit
status 2

We'll get there... slowly!

@mstimberg have you had any experience with binstar packages?

rossant commented 9 years ago

would it be simpler to use wheels and pip?

nippoo commented 9 years ago

hey I've solved this previous issue - turns out there was an issue with conda's version of patch. I built it from source.

Then tried to file an issue and discovered it was already filed - a year ago :(

https://github.com/conda/conda-build/issues/119

nippoo commented 9 years ago

boom - now it's all done https://binstar.org/kwikteam/klustakwik2 (for win64 python 2.7 / python 3.3 / python 3.4 only - other platforms coming at some point)

thesamovar commented 9 years ago

Nice work! Will look in more detail soon.

On 2 July 2015 23:49:40 BST, nippoo notifications@github.com wrote:

boom - now it's all done https://binstar.org/kwikteam/klustakwik2 (for win64 python 2.7 / python 3.3 / python 3.4 only - other platforms coming at some point)


Reply to this email directly or view it on GitHub: https://github.com/kwikteam/klustakwik2/issues/63#issuecomment-118187425

rossant commented 8 years ago

@nippoo could you tell me how you built the conda packages? I'd like to update newer releases on anaconda cloud (Python 3.5 etc). I now have a Windows setup that can build Python packages on Py 2.7 and Py 3.5 (I have Visual C++ 2015 installed for the latter).

I also uploaded Windows wheels on PyPI so I think pip install klustakwik2 might just work on Windows?