I'm new on python spacy package.
I wanted to download model 'en_core_web_sm' and I get AttributeError.
I searched since 2 days all over the web and I couldn't fix it.
Someone can help me please ?
The code :
import spacy
nlp=spacy.load('en_core_web_sm')
The error :
n = y.shape[0]
AttributeError: 'NoneType' object has no attribute 'ndarray'
I'm using Python 3.6 on conda environment (spyder)
This happened to me once during development and the reason was that for some reason, my code tricked spaCy into thinking I was on GPU. On GPU, spaCy uses cupy
instead of numpy
– and if cupy
is not installed, it defaults to None
. It's likely that the code should be calling numpy.ndarray
, but it's calling cupy.ndarray
, ie None.ndarray
, which results in that error.
If you've intended to run spaCy on GPU, make sure it's available and you've installed the correct dependencies for your CUDA version. If you're running spaCy on CPU, here are some things to try:
cupy
or something like that. Also make sure numpy
is installed correctly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.