Skip to content
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

Does not install on Windows #8

Closed
Djoels opened this issue Oct 5, 2016 · 8 comments
Closed

Does not install on Windows #8

Djoels opened this issue Oct 5, 2016 · 8 comments

Comments

@Djoels
Copy link

Djoels commented Oct 5, 2016

pip install implicit fails on Windows 7.

After first fixing the issue of nog finding the VS C++ compiler (by installing the appropriate VS build tools), now the setup reports "failed building wheel" for this package.

Additionaly this message appears:

 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\XXX\AppData\Local\Continuum\
Anaconda3\include -IC:\Users\XXX\AppData\Local\Continuum\Anaconda3\include
"-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program
 Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86
)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\in
clude\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcimplicit\
_implicit.c /Fobuild\temp.win-amd64-3.5\Release\implicit\_implicit.obj -Wno-unus
ed-function -O3 -fopenmp -ffast-math
    cl : Command line error D8021 : invalid numeric argument '/Wno-unused-function'

I tried checking for the CFLAGS in a previously mentioned issue (that one was on Mac OSX though):

C:\Users\XXX\implicit>python
Python 3.5.2 |Anaconda 4.1.1 (64-bit)| (default, Jul  5 2016, 11:41:13) [MSC v.1
900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> print(sysconfig.get_config_var("CFLAGS"))
None

Any idea what is going on here?

benfred added a commit that referenced this issue Oct 6, 2016
OSX installs were failing if an openmp compatible compiler wasn't found,
backoff to using clang without openmp in this case
#1

On windows, we were passing in compile flags that weren't valid.
Visual Studo expects the '/W' flag to be an integer specifying the warning
level, and we were passing in a 'Wno-unused-function' to disable a warning.
#8 . Try to pass in the appropiate
options here
@benfred
Copy link
Owner

benfred commented Oct 6, 2016

I think the problem was the compile_args flags being set up in setup.py .

For windows machines I've changed the flags to be what are expected here: https://msdn.microsoft.com/en-us/library/fwkeyyhe.aspx in the last commit

Could you verify this works? I don't have a windows machine to test on currently. I've uploaded these changes to pypi so going 'pip install implicit' should work

@Djoels
Copy link
Author

Djoels commented Oct 6, 2016

Thank you so much for looking into this!

Installation works now, but importing throws an error:

>>> import implicit
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\XXX\AppData\Local\Continuum\Anaconda3\lib\site-packages\im
plicit-0.1.4-py3.5-win-amd64.egg\implicit\__init__.py", line 1, in <module>
    from .implicit import alternating_least_squares
  File "C:\Users\XXX\AppData\Local\Continuum\Anaconda3\lib\site-packages\im
plicit-0.1.4-py3.5-win-amd64.egg\implicit\implicit.py", line 6, in <module>
    from . import _implicit
ImportError: DLL load failed: %1 is not a valid Win32 application.

I am still figuring out what's wrong here.
Anyhow: thanks a lot for the effort!

@benfred
Copy link
Owner

benfred commented Oct 7, 2016

So - I tried to add windows continuous integration support just now, without success for the moment: https://ci.appveyor.com/project/benfred/implicit . Will come back to it later

I think the error you have there might be related to a 64bit/32bit clash (though I'm not totally sure) This page https://github.com/cython/cython/wiki/CythonExtensionsOnWindows has some info on building cython extensions on windows that might help here

According to that page these errors might need these commands run:

set DISTUTILS_USE_SDK=1
setenv /x64 /release

in a command shell before trying to go pip install.

Let me know if this helps

@Djoels
Copy link
Author

Djoels commented Oct 7, 2016

Apparently the option /openmp is only relevant for the compile arguments and not for the linker (so maybe the following code is unnecessary? link_args = ['/openmp']
However this results only in a warning and an error.

The actual error is as follows:

    > link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\XXX\AppData\Local\Continuum\Anaconda3\libs /LIBPATH:C:\Users\XXX\AppData\Local\Continuum\Anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x
86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" "/LIBPATH:C:\Program Files
 (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" "/LIBPATH:C:\Program Files (x8
6)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Wind
ows Kits\8.1\lib\winv6.3\um\x64" /EXPORT:PyInit_implicit\_implicit build\temp.wi
n-amd64-3.5\Release\implicit\_implicit.obj /OUT:build\lib.win-amd64-3.5\implicit
\_implicit.cp35-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\implicit\
_implicit.cp35-win_amd64.lib /openmp
    LINK : warning LNK4044: unrecognized option '/openmp'; ignored
    LINK : error LNK2001: unresolved external symbol PyInit_implicit\_implicit build\temp.win-amd64-3.5\Release\implicit\_implicit.cp35-win_amd64.lib :
fatal error LNK1120: 1 unresolved externals error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1120**

PS: Not a single issue on Mac OS X though.

PS2: I forgot to mention, execution the commands you mentioned in the previous post didn't work. For one thing there doesn't seem to be a 'setenv' command anymore in the visual studio 2015 distribution (with its Microsoft SDK)

@benfred
Copy link
Owner

benfred commented Oct 20, 2016

So I think this commit fixes: 1ecca73

The build is running and tests complete on windows with appveyor at least: https://ci.appveyor.com/project/benfred/implicit

@benfred benfred closed this as completed Oct 22, 2016
@Djoels
Copy link
Author

Djoels commented Oct 26, 2016

Thank you so much for looking into this! 👍

Upon retrying I see different errors, regarding to my MS compiler version, which is obviously out of your control.

@Aashit-Sharma
Copy link

I know it is really late but I am getting the same error while installing this on win 7 through pip

I tried to do the setenv command but it didnt work

Does this have something to do with newer python version ?

@benfred
Copy link
Owner

benfred commented Mar 5, 2018

@Aashit-Sharma What error are you seeing? There are a couple different ones in the thread above.

Also, there are now pre-built windows binaries that can be installed via conda-forge by conda install -c conda-forge implicit (assuming you're using anaconda).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants