Closed dimitris93 closed 6 years ago
So - it looks like it's failing because I'm using some the random number generation features from c++11 (https://github.com/benfred/implicit/blob/master/implicit/bpr.pyx#L23) but you're using a compiler that doesn't support c++11 (Visual C++ for Python v9.0 - which I think came is the same as in visual studio 2008).
You can download a newer compiler here: https://visualstudio.microsoft.com/visual-cpp-build-tools/ that should work.
Alternatively - If you don't need the BPR model, you can clone this source code and modify the setup.py file to not try to compile bpr.pyx (in this line https://github.com/benfred/implicit/blob/master/setup.py#L55).
What am I supposed to install then?
If you look at (https://wiki.python.org/moin/WindowsCompilers#Which_Microsoft_Visual_C.2B-.2B-_compiler_to_use_with_a_specific_Python_version_.3F) it says that you are supposed to use Visual C++ 9.0 for CPython 2.7. I am using Python 2.7.15. What should I download and install? Can I get a direct link?
Or is there some version that doesn't use c++11 features or something? Or you have a .whl file for me?
I believe the link is here: https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15 - but if you're using Python 2.7, I don't think that just upgrading the compiler is sufficient =( See this thread for more discussion on why: https://github.com/conda-forge/implicit-feedstock/pull/4#issuecomment-364586216
Can you try installing by running this command? pip install implicit==0.2.13
This will install the last version of implicit that works with python 2.7 on windows.
I've updated the README to reflect that we don't support Python 2.7 on windows anymore
Ok. Looks like installation was successful with this older version. Is it really impossible to produce random numbers without c++11 support? Seems really strange.
Thanks for your help. It is really late so I will continue working tomorrow.
I'm open to patches here - but the problem is in generating random numbers in a thread safe fashion. The c rand
function isn't thread safe, and the rand_r
version isn't available on windows (#82). The c++11 versions are the easiest way of getting this going that I found.
I know lightfm handles this by copying the rand_r implementation from the musl stdlib (https://github.com/lyst/lightfm/blob/master/lightfm/_lightfm_fast.pyx.template#L64) - but that seems like overkill for this.
Is it really an overkill? It looks alright to me if you can copy a similar rand_r implementation from some other library.
To me it looks like using c++11 features just for random number generation, is an overkill. Especially when that breaks compatibility for python 2.7.
can I know what is this cause of this error?
@srinivascnu166 did you solve your problem? I have the same problem.
python3.6 -m pip install Cython
this solve the problem for me ! I'm using linux mint 19.1 | python 3.6
python3.6 -m pip install implicit Collecting implicit Downloading https://files.pythonhosted.org/packages/96/68/7497a86926065cde8e433bd3b704b8b08db154afbaec4abf9dda4ad15b40/implicit-0.4.8.tar.gz (1.1MB) 100% |████████████████████████████████| 1.1MB 571kB/s Collecting numpy (from implicit) Using cached https://files.pythonhosted.org/packages/45/b2/6c7545bb7a38754d63048c7696804a0d947328125d81bf12beaa692c3ae3/numpy-1.19.5-cp36-cp36m-manylinux1_x86_64.whl Collecting scipy>=0.16 (from implicit) Using cached https://files.pythonhosted.org/packages/c8/89/63171228d5ced148f5ced50305c89e8576ffc695a90b58fe5bb602b910c2/scipy-1.5.4-cp36-cp36m-manylinux1_x86_64.whl Collecting tqdm>=4.27 (from implicit) Downloading https://files.pythonhosted.org/packages/63/f3/b7a1b8e40fd1bd049a34566eb353527bb9b8e9b98f8b6cf803bb64d8ce95/tqdm-4.62.3-py2.py3-none-any.whl (76kB) 100% |████████████████████████████████| 81kB 851kB/s Building wheels for collected packages: implicit Running setup.py bdist_wheel for implicit ... error Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-build-2zdr8nza/implicit/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmp_94zyrtypip-wheel- --python-tag cp36: WARNING:root:The nvcc binary could not be located in your $PATH. Either add it to your path, or set $CUDAHOME to enable CUDA extensions Failed to find CUDA toolkit. Building without GPU acceleration. running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.6 creating build/lib.linux-x86_64-3.6/implicit copying implicit/init.py -> build/lib.linux-x86_64-3.6/implicit copying implicit/bpr.py -> build/lib.linux-x86_64-3.6/implicit copying implicit/als.py -> build/lib.linux-x86_64-3.6/implicit copying implicit/utils.py -> build/lib.linux-x86_64-3.6/implicit copying implicit/nearest_neighbours.py -> build/lib.linux-x86_64-3.6/implicit copying implicit/approximate_als.py -> build/lib.linux-x86_64-3.6/implicit creating build/lib.linux-x86_64-3.6/implicit/gpu copying implicit/gpu/init.py -> build/lib.linux-x86_64-3.6/implicit/gpu copying implicit/gpu/bpr.py -> build/lib.linux-x86_64-3.6/implicit/gpu copying implicit/gpu/als.py -> build/lib.linux-x86_64-3.6/implicit/gpu copying implicit/gpu/matrix_factorization_base.py -> build/lib.linux-x86_64-3.6/implicit/gpu creating build/lib.linux-x86_64-3.6/implicit/cpu copying implicit/cpu/init.py -> build/lib.linux-x86_64-3.6/implicit/cpu copying implicit/cpu/als.py -> build/lib.linux-x86_64-3.6/implicit/cpu creating build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/sketchfab.py -> build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/init.py -> build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/_download.py -> build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/movielens.py -> build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/million_song_dataset.py -> build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/reddit.py -> build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/lastfm.py -> build/lib.linux-x86_64-3.6/implicit/datasets running build_ext building 'implicit._nearest_neighbours' extension error: unknown file type '.pyx' (from 'implicit/_nearest_neighbours.pyx')
Failed building wheel for implicit Running setup.py clean for implicit Failed to build implicit Installing collected packages: numpy, scipy, tqdm, implicit Running setup.py install for implicit ... error Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-build-2zdr8nza/implicit/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-791zv4z1-record/install-record.txt --single-version-externally-managed --compile --user --prefix=: WARNING:root:The nvcc binary could not be located in your $PATH. Either add it to your path, or set $CUDAHOME to enable CUDA extensions Failed to find CUDA toolkit. Building without GPU acceleration. running install running build running build_py creating build creating build/lib.linux-x86_64-3.6 creating build/lib.linux-x86_64-3.6/implicit copying implicit/init.py -> build/lib.linux-x86_64-3.6/implicit copying implicit/bpr.py -> build/lib.linux-x86_64-3.6/implicit copying implicit/als.py -> build/lib.linux-x86_64-3.6/implicit copying implicit/utils.py -> build/lib.linux-x86_64-3.6/implicit copying implicit/nearest_neighbours.py -> build/lib.linux-x86_64-3.6/implicit copying implicit/approximate_als.py -> build/lib.linux-x86_64-3.6/implicit creating build/lib.linux-x86_64-3.6/implicit/gpu copying implicit/gpu/init.py -> build/lib.linux-x86_64-3.6/implicit/gpu copying implicit/gpu/bpr.py -> build/lib.linux-x86_64-3.6/implicit/gpu copying implicit/gpu/als.py -> build/lib.linux-x86_64-3.6/implicit/gpu copying implicit/gpu/matrix_factorization_base.py -> build/lib.linux-x86_64-3.6/implicit/gpu creating build/lib.linux-x86_64-3.6/implicit/cpu copying implicit/cpu/init.py -> build/lib.linux-x86_64-3.6/implicit/cpu copying implicit/cpu/als.py -> build/lib.linux-x86_64-3.6/implicit/cpu creating build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/sketchfab.py -> build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/init.py -> build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/_download.py -> build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/movielens.py -> build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/million_song_dataset.py -> build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/reddit.py -> build/lib.linux-x86_64-3.6/implicit/datasets copying implicit/datasets/lastfm.py -> build/lib.linux-x86_64-3.6/implicit/datasets running build_ext building 'implicit._nearest_neighbours' extension error: unknown file type '.pyx' (from 'implicit/_nearest_neighbours.pyx')
----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-build-2zdr8nza/implicit/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-791zv4z1-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-2zdr8nza/implicit/
@srinivascnu166 did you solve your problem? I have the same problem.
python3.6 -m pip install Cython (this command solve my problem with installing implicit )
@srinivascnu166 did you solve your problem? I have the same problem.
python3.6 -m pip install Cython (this command solve my problem with installing implicit )
Thanks a lot! That's the only thing that helped.
1) python3 -m pip install Cython
2) conda install implicit -c conda-forge -n
I am trying to install the implicit package on windows 10 with Python 2.7.15 using
There seems to be an error with implicit/bpr.cpp if I am not mistaken. I have no idea what to do.
This is the full log I am getting: