neuralcoref: ValueError: spacy.strings.StringStore size changed, may indicate binary incompatibility. Expected 80 from C header, got 64 from PyObject

I am using python ==3.8.3, spacy==3.0.5, neuralcoref ==4.0. These libraries are successfully installed. When running the code

import spacy import neuralcoref

nlp = spacy.load(‘en’) neuralcoref.add_to_pipe(nlp) doc1 = nlp(‘My sister has a dog. She loves him.’) print(doc1._.coref_clusters)

I get the error.

Traceback (most recent call last): File “d:/Comp4550/xxxxxxxxxxxxxxx/code/analysis/co-reference.py”, line 2, in <module> import neuralcoref File “D:\python3.8.3\lib\site-packages\neuralcoref_init_.py”, line 14, in <module> from .neuralcoref import NeuralCoref File “strings.pxd”, line 23, in init neuralcoref.neuralcoref ValueError: spacy.strings.StringStore size changed, may indicate binary incompatibility. Expected 80 from C header, got 64 from PyObject

I search the error code in google and I get this from stackoverflow [https://stackoverflow.com/questions/67041981/valueerror-spacy-strings-stringstore-size-changed-may-indicate-binary-incompat] . It suggests me to downgrade the python version. However, python version cannot be changed due to the particular project. I wonder that if there exists a way for me to successfully run the test code. By the way, I also try pip uninstall neuralcoref, pip install neuralcoref --no-binary neuralcoref. The problem is still not resolved. If anyone can solve my problem, I am really appreciate that.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15 (1 by maintainers)

Most upvoted comments

Hey all, as @correia-marcos mentioned, I figured that there seems to be some compatibility issue between spacy v3 and neuralcoref. Here are the steps I did to make it work:

  1. Setup a python3.7 on conda env and conda install -c anaconda git
  2. As per stated in README.md,
git clone https://github.com/huggingface/neuralcoref.git
cd neuralcoref
pip install -r requirements.txt
pip install -e .
  1. At this stage, your spacy version should be 2.3.x (verify using pip show spacy), because the requirements.txt did explicitly stated that spacy version has to be <3.0.0. Hence, DO NOT execute pip install -U spacy, which would upgrade your spacy version to beyond 3.0.0.
  2. Execute python -m spacy download en to obtain your English Model.

Summary of key item versions:

Python==3.7.10
spacy==2.3.5
neuralcoref==4.0

Hope this helped! 😃

Thanks, @manekiyong – I guess I was hoping we could get the compatibility issue fixed so we could use both neuralcoref and the fancy new features of spacy 3.0.

But again, thank you for taking the time to respond with such clear instructions.

大家好,作为@correia-marcos提到,我认为 spacy v3 和 neurocoref 之间似乎存在一些兼容性问题。以下是我为使其工作而采取的步骤:

  1. 在 conda env 上设置 python3.7 和conda install -c anaconda git
  2. 如中所述README.md
git clone https://github.com/huggingface/neuralcoref.git
cd neuralcoref
pip install -r requirements.txt
pip install -e .
  1. 在这个阶段,你的 spacy 版本应该是2.3.x(验证使用pip show spacy),因为requirements.txt确实明确指出 spacy 版本必须是<3.0.0. 因此,不要执行pip install -U spacy,这会将您的 spacy 版本升级到 Beyond 3.0.0
  2. 执行python -m spacy download en以获得您的英文模型。

关键项目版本摘要:

Python==3.7.10
spacy==2.3.5
neuralcoref==4.0

希望这有帮助!😃

thank u

Issue seems to have been created by one of the recent commits. I used feb 2020 version of the neuralcoref library (commit ‘73d07e97fe’) and it seems to have been installed at least. Leaving it here as it might help someone else. Works with both python versions 3.6.9 and 3.7.10.

I’ve tried so many things. Seeing others issues I came to realized neuralcoref doesn’t work in spacy v3 (see [stackoverflow] also (https://stackoverflow.com/questions/57008612/kernel-died-when-running-neuralcoref)). The problem for me now is actually how to download spacy pipeline for v2 versions? Seems stupidly easy, but I can’t find in the documentation.

same here… can’t import why? thx!

image

Also having this issue; I’m using a Win10 PC in a conda environment with config:

  • python == 3.7.10
  • spacy == 3.0.6
  • neuralcoref == 4.0
  • cython == 0.29.23
  • numpy == 1.20.2

When I run the code:

from spacy.lang.en import English
import spacy
import neuralcoref
nlp = English()
neuralcoref.add_to_pipe(nlp)

I get the error:

ValueError                                Traceback (most recent call last)
<ipython-input-1-8e5edb230c15> in <module>
      1 from spacy.lang.en import English
      2 import spacy
----> 3 import neuralcoref
      4 nlp = English()
      5 # nlp.add_pipe("sentencizer")

~\Anaconda3\envs\spacy_work\lib\site-packages\neuralcoref\__init__.py in <module>
     12 warnings.filterwarnings("ignore", message="spacy.strings.StringStore size changed,")
     13 
---> 14 from .neuralcoref import NeuralCoref
     15 from .file_utils import NEURALCOREF_MODEL_URL, NEURALCOREF_MODEL_PATH, NEURALCOREF_CACHE, cached_path
     16 

strings.pxd in init neuralcoref.neuralcoref()

ValueError: spacy.strings.StringStore size changed, may indicate binary incompatibility. Expected 80 from C header, got 64 from PyObject

What I tried:

  • Performed the binary install mentioned in the readme, got the same error message.
  pip uninstall neuralcoref
  pip install neuralcoref --no-binary neuralcoref  
  • Downgraded to spacy 3.0.0. Same error message.

Any help would be very much appreciated!