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

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 “<string>”, line 1, in <module> 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

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 16 (1 by maintainers)

Most upvoted comments

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 https://github.com/explosion/spaCy/issues/1530)

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.

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