Cannot import spacy after building from master
See original GitHub issueHow to reproduce the problem
I have cloned the spacy github then built the extensions. Building from master was working previously with version 2.3.2, I think, as I have been using spacy for some time.
The only recent difference is getting a new GFX card and installing spacy[cuda] at one point. I have since uninstalled all spacy related stuff and still cannot build from master.
I’ve seen this issue referenced a lot on the neuralcoref github but I’m not using this extension.
python setup.py build_ext --inplace
python setup.py install
Using /home/user/anaconda3/envs/uniqueness/lib/python3.8/site-packages
Finished processing dependencies for spacy==2.3.2
➜ cd ..
➜ python
Python 3.8.2 (default, Mar 26 2020, 15:53:00)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import spacy
<frozen importlib._bootstrap>:219: RuntimeWarning: spacy.morphology.Morphology size changed, may indicate binary incompatibility. Expected 104 from C header, got 112 from PyObject
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/anaconda3/envs/uniqueness/lib/python3.8/site-packages/spacy-2.3.2-py3.8-linux-x86_64.egg/spacy/__init__.py", line 12, in <module>
from . import pipeline
File "/home/user/anaconda3/envs/uniqueness/lib/python3.8/site-packages/spacy-2.3.2-py3.8-linux-x86_64.egg/spacy/pipeline/__init__.py", line 4, in <module>
from .pipes import Tagger, DependencyParser, EntityRecognizer, EntityLinker
File "pipes.pyx", line 1, in init spacy.pipeline.pipes
File "nn_parser.pyx", line 1, in init spacy.syntax.nn_parser
File "/home/user/anaconda3/envs/uniqueness/lib/python3.8/site-packages/spacy-2.3.2-py3.8-linux-x86_64.egg/spacy/gold/__init__.py", line 1, in <module>
from .corpus import Corpus
File "/home/user/anaconda3/envs/uniqueness/lib/python3.8/site-packages/spacy-2.3.2-py3.8-linux-x86_64.egg/spacy/gold/corpus.py", line 6, in <module>
from .example import Example
File "spacy/vocab.pxd", line 26, in init spacy.gold.example
ValueError: spacy.vocab.Vocab size changed, may indicate binary incompatibility. Expected 120 from C header, got 112 from PyObject
>>>
Your Environment
- spaCy version: 2.3.2
- Platform: Linux-4.15.0-112-generic-x86_64-with-glibc2.10
- Python version: 3.8.2
Pip Packages
Package Version
------------------------- ------------
absl-py 0.9.0
activesoup 0.0.5
aniso8601 8.0.0
appdirs 1.4.4
asgiref 3.2.10
astunparse 1.6.3
atomicwrites 1.4.0
attrs 19.3.0
awscli 1.18.41
Babel 2.8.0
backcall 0.1.0
bcrypt 3.1.7
beautifulsoup4 4.9.0
bleach 3.1.4
blis 0.4.1
boto 2.49.0
boto3 1.14.20
botocore 1.17.20
cachetools 4.1.0
catalogue 1.0.0
certifi 2020.6.20
cffi 1.14.0
chardet 3.0.4
click 7.1.1
colorama 0.4.3
coverage 5.2.1
cryptography 2.9.2
cupy 8.0.0b5
cupy-cuda101 7.7.0
cycler 0.10.0
cymem 2.0.3
Cython 0.29.21
decorator 4.4.2
defusedxml 0.6.0
Django 3.0.7
docopt 0.6.2
docutils 0.15.2
en-core-web-sm 2.2.5
en-trf-bertbaseuncased-lg 2.3.0
entrypoints 0.3
fastrlock 0.5
filelock 3.0.12
flake8 3.5.0
Flask 1.1.2
Flask-Compress 1.4.0
Flask-Cors 3.0.8
Flask-RESTful 0.3.8
ftfy 5.7
future 0.18.2
gast 0.3.3
gensim 3.8.3
google-auth 1.15.0
google-auth-oauthlib 0.4.1
google-pasta 0.2.0
grpcio 1.29.0
h5py 2.10.0
html5lib 1.0.1
idna 2.10
importlib-metadata 1.7.0
ipykernel 5.2.1
ipython 7.13.0
ipython-genutils 0.2.0
itsdangerous 1.1.0
jedi 0.17.0
jellyfish 0.8.2
Jinja2 2.11.2
jmespath 0.9.5
joblib 0.14.1
json5 0.9.4
jsonschema 3.0.2
jupyter-client 6.1.3
jupyter-core 4.6.3
jupyterlab 2.1.0
jupyterlab-server 1.1.1
Keras-Preprocessing 1.1.2
kiwisolver 1.2.0
language-tool-python 2.2.1
lemminflect 0.2.1
Mako 1.1.3
Markdown 3.2.2
MarkupSafe 1.1.1
matplotlib 3.2.1
mccabe 0.6.1
mistune 0.8.4
ml-datasets 0.1.6
mock 2.0.0
more-itertools 8.3.0
murmurhash 1.0.2
nbconvert 5.6.1
nbformat 5.0.6
nibabel 3.0.2
nilearn 0.6.2
nltk 3.5
notebook 6.0.3
num2words 0.5.10
numpy 1.19.0
oauthlib 3.1.0
opt-einsum 3.2.1
packaging 20.4
pandas 1.0.3
pandocfilters 1.4.2
paramiko 2.7.1
parso 0.7.0
pathlib 1.0.1
pbr 5.4.5
pexpect 4.8.0
pickleshare 0.7.5
pip 20.2.1
plac 1.1.3
pluggy 0.13.1
preshed 3.0.2
prometheus-client 0.7.1
prompt-toolkit 3.0.5
protobuf 3.12.0
psutil 5.7.0
psycopg2 2.8.5
ptyprocess 0.6.0
py 1.8.1
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycodestyle 2.3.1
pycountry 19.8.18
pycparser 2.20
pycuda 2019.1.2
pydantic 1.6.1
pyflakes 1.6.0
Pygments 2.6.1
pymongo 3.10.1
PyNaCl 1.4.0
pyparsing 2.4.7
pyrsistent 0.16.0
pytest 5.0.1
pytest-cov 2.7.1
pytest-timeout 1.4.2
python-dateutil 2.8.1
pytokenizations 0.5.0
pytools 2020.3.1
pytz 2019.3
PyYAML 5.3.1
pyzmq 19.0.0
regex 2020.4.4
requests 2.24.0
requests-oauthlib 1.3.0
rsa 3.4.2
s3transfer 0.3.3
sacremoses 0.0.43
scikit-learn 0.22.2.post1
scipy 1.4.1
Send2Trash 1.5.0
sentencepiece 0.1.91
setuptools 49.2.1
six 1.14.0
sklearn 0.0
smart-open 2.1.0
soupsieve 2.0
spacy 2.3.2
sqlparse 0.3.1
srsly 1.0.2
sshtunnel 0.1.5
symspellpy 6.5.2
tensorboard 2.2.1
tensorboard-plugin-wit 1.6.0.post3
tensorflow 2.2.0
tensorflow-estimator 2.2.0
termcolor 1.1.0
terminado 0.8.3
testpath 0.4.4
thinc 7.4.1
tokenizers 0.5.2
torch 1.5.1
torchcontrib 0.0.2
tornado 6.0.4
tqdm 4.45.0
traitlets 4.3.3
transformers 2.8.0
typer 0.3.1
Unidecode 1.1.1
urllib3 1.25.9
wasabi 0.7.1
wcwidth 0.1.9
webencodings 0.5.1
Werkzeug 1.0.1
wheel 0.34.2
wrapt 1.12.1
zipp 3.1.0
Any ideas on how I can get spacy working again?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Install spaCy · spaCy Usage Documentation
Import error: No module named spacy This error means that the spaCy module can't be located on your system, or in your environment....
Read more >SpaCy install error -- ImportError: cannot import name ...
I think I solved my problem. I installed SpaCy using another Conda install: conda install -c "conda-forge/label/cf201901" spacy.
Read more >How to Fix : “ImportError: Cannot import name X” in Python
The imported class from a specific module is misplaced. The imported class is not present in the Python library. This generally happens while...
Read more >Natural Language Processing With spaCy in Python
spaCy is a free, open-source library for NLP in Python. It's written in Cython and is designed to build information extraction or natural...
Read more >How to use spaCy models in Dataiku
To test that it works correctly, run the following code in a notebook using this code environment. import spacy nlp = spacy.load("en_core_web_sm").
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, so the reason for everything failing was because setuptools had created a bunch of egg files in .egg in my spacy directory which were obviously overriding what I had installed with pip. I deleted the .egg folder and everything started working.
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.