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

GPU ops are not getting built for thinc : No module named 'thinc.neural.gpu_ops' #1745

Closed
dineshdharme opened this issue Dec 20, 2017 · 16 comments
Labels
gpu Using spaCy on GPU install Installation issues 🔮 thinc spaCy's machine learning library Thinc

Comments

@dineshdharme
Copy link

dineshdharme commented Dec 20, 2017

So I was following the guide to install spacy with gpu support : https://spacy.io/usage/
I already have cuda installed with CUDA_HOME variable set as mentioned in the above link
I ran the following command. I have both python2.7 and python3 (-> python3.6)

sudo pip3 install spacy
python3 -c "import thinc.neural.gpu_ops"  

I got the following error,

Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'thinc.neural.gpu_ops'

I have successfully installed cupy from Chainer as well. Then uninstalled thinc and again installed thinc. But same error.

I uninstalled thinc and then installed it again with specifying the install log file.
sudo pip3 install thinc --log thinclogs.txt --no-cache-dir

From the logs, it seems that it is unable to find nvcc. But I can clearly access nvcc with nvcc -V command on the terminal.
Here are the relevant logs.

Downloading thinc-6.10.2.tar.gz (1.2MB)
Downloading from URL https://pypi.python.org/packages/55/fd/e9f36081e6f53699943381858848f3b4d759e0dd03c43b98807dde34c252/thinc-6.10.2.tar.gz#md5=41f4cd26d3e894600cdd36e3cd074239 (from https://pypi.python.org/simple/thinc/)
Running setup.py (path:/tmp/pip-build-xmgkus0e/thinc/setup.py) egg_info for package thinc
Running command python setup.py egg_info
Warning: The nvcc binary could not be located in your $PATH. For GPU capability, either add it to your path, or set $CUDA_HOME
running egg_info
creating pip-egg-info/thinc.egg-info
writing pip-egg-info/thinc.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/thinc.egg-info/dependency_links.txt
writing requirements to pip-egg-info/thinc.egg-info/requires.txt
writing top-level names to pip-egg-info/thinc.egg-info/top_level.txt
writing manifest file 'pip-egg-info/thinc.egg-info/SOURCES.txt'
reading manifest file 'pip-egg-info/thinc.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.cpp' under directory 'include'
warning: no files found matching 'buildbot.json'
writing manifest file 'pip-egg-info/thinc.egg-info/SOURCES.txt'

Your Environment

  • spaCy version: 2.0.5
  • Platform: Linux-4.13.0-19-generic-x86_64-with-Ubuntu-17.10-artful
  • Python version: 3.6.3
  • Environment Information: I have Cuda 8 with gtx 1080
@ines ines added install Installation issues 🔮 thinc spaCy's machine learning library Thinc gpu Using spaCy on GPU labels Dec 22, 2017
@alexpilot11
Copy link

I have this issue too

@pratik-shivarkar
Copy link

I have this same issue, If I copy nvcc.exe and rename it as nvcc. The warning will change to:

Warning: The CUDA lib64 path could not be located in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib64

spacy: 2.0.5
thinc: 6.10.1
Platform: Windows 10 x64
Python version: 3.6.3
CUDA 8 Install Location: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\

@max0xff
Copy link

max0xff commented Feb 6, 2018

I did the same as @pratik-shivarkar, then I've copied C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64 to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib64,

but now I get this error:

building 'thinc.neural.gpu_ops' extension
creating build\temp.win-amd64-3.6\Release\include
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-Ic:\program files\python36\include" -IC:\Users\Alex\AppData\Local\Temp\pip-build-sddrm1cv\thinc\include "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" "-Ic:\program files\python36\include" "-Ic:\program files\python36\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\10\include\10.0.10240.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" /EHsc /Tpthinc/neural/gpu_ops.cpp /Fobuild\temp.win-amd64-3.6\Release\thinc/neural/gpu_ops.obj /Ox /EHsc
gpu_ops.cpp
error: Don't know how to compile include/_cuda_shim.cu to build\temp.win-amd64-3.6\Release\include/_cuda_shim.obj

spacy: 2.0.7
thinc: 6.10.2
Platform: Windows 10 x64
Python version: 3.6.4
CUDA 8 Install Location: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\

@ivmreg
Copy link

ivmreg commented Feb 13, 2018

Same issue -
spacy: 2.0.7
thinc: 6.10.2
Platform: Windows 10 x64
Python version: 3.6.3
CUDA 8 Install Location: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
I think it wasn't expecting to be built on Windows.

@tejzpr
Copy link

tejzpr commented Feb 28, 2018

I get the error error: Don't know how to compile include/_cuda_shim.cu to build\temp.win-amd64-3.6\Release\include/_cuda_shim.objwith CUDA9 after applying @pratik-shivarkar's fix
spacy: 2.0.7
thinc: 6.10.2
Platform: Windows 10 x64
Python version: 3.6.4

@Lef-F
Copy link

Lef-F commented Mar 16, 2018

Same issue ImportError: No module named 'thinc.neural.gpu_ops'

spacy: 2.0.8
thinc: 6.10.2
Platform: Windows 10 x64
Python version: 3.5.4
CUDA 8 Install Location: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0

@several27
Copy link

several27 commented Apr 4, 2018

Hey, just managed to solve that problem for me: (ubuntu, python3, pip3, and cuda8)

sudo pip3 uninstall spacy thinc cupy
sudo pip3 install --no-cache-dir cupy
sudo CUDA_HOME=/usr/local/cuda-8.0 pip3 install --no-cache-dir thinc 
sudo pip3 install spacy
python3 -c "import thinc.neural.gpu_ops" 

Setting the CUDA_HOME for sudo is very important as it's often using env variables without CUDA one!

Hope that helps someone.

(based on #1530)

@dkulagin
Copy link

dkulagin commented Jun 17, 2018

The solution by @several27 works like a charm, but may require a lower version of gcc/g++. It's done easily on Ubuntu, please refer to the SO thread for instructions: https://askubuntu.com/questions/1036108/install-gcc-4-9-at-ubuntu-18-04

Also found a useful GIST for the task, hope it helps: https://gist.github.com/SunnyRaj/788ca494db609a404c9dc4c88d47e775

@millawell
Copy link

millawell commented Aug 3, 2018

I currently have the issue that when I install thinc, I get (after installing cupy)
Successfully installed thinc-6.11.2
And I can also successfully import the gpu_ops. However, when I then install spacy, my pip says:

  Found existing installation: thinc 6.11.2
    Uninstalling thinc-6.11.2:
      Successfully uninstalled thinc-6.11.2
Successfully installed spacy-2.0.12 thinc-6.10.3

So, I could only solve this by afterwards installing thinc again. Which results in this uncomfortable warning of spacy 2.0.12 has requirement thinc<6.11.0,>=6.10.3, but you'll have thinc 6.11.2 which is incompatible.
this combination though still seems to work..

@veonua
Copy link

veonua commented Oct 17, 2018

same here
cupy==4.5.0
cupy-cuda92==5.0.0rc1
thinc==6.12.0
thinc-gpu-ops==0.0.3
spacy==2.0.16

@ivan-bilan
Copy link

I have the same issue on Python 3.7. I've dug quite deep into this, and I've landed on Cython not being properly built for Python 3.7 as per scikit-learn-contrib/py-earth#191, that's why thinc can't be built either with cupy. Anyone has any other solutions in mind?

@veonua
Copy link

veonua commented Dec 7, 2018 via email

@ivan-bilan
Copy link

I ended up using thick from py3.5. it shows warnings but works pretty well. It is a bad hack, but already wasted on this two days

On Fri, Dec 7, 2018, 10:21 Ivan Bilan @.*** wrote: I have the same issue on Python 3.7. I've dug quite deep into this, and I've landed on Cython not being properly built for Python 3.7 as per scikit-learn-contrib/py-earth#191 <scikit-learn-contrib/py-earth#191>, that's why thinc can't be built either with cupy. Anyone has any other solutions in mind? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#1745 (comment)>, or mute the thread https:/notifications/unsubscribe-auth/ABeALhntk3JmyaDKQYQfj8KnWxYhiY58ks5u2jMIgaJpZM4RIXEL .

What do you mean? You installed thinc souce for Python 3.5 on Python 3.7? How did you do that?

@veonua
Copy link

veonua commented Dec 7, 2018 via email

@honnibal
Copy link
Member

Version 0.0.3 of thinc_gpu_ops had a problem where it wouldn't build on Python 3.7. Apologies for the delay on this -- we can't test the GPU with the CI systems, so it's hard to catch all the cross-platform problems that might occur. I've now uploaded v0.0.4 of thinc_gpu_ops, which should solve the problem.

@lock
Copy link

lock bot commented Jan 15, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
gpu Using spaCy on GPU install Installation issues 🔮 thinc spaCy's machine learning library Thinc
Projects
None yet
Development

No branches or pull requests