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

Unable to import modules #59

Closed
BBCMax opened this issue Jun 21, 2018 · 14 comments
Closed

Unable to import modules #59

BBCMax opened this issue Jun 21, 2018 · 14 comments

Comments

@BBCMax
Copy link

BBCMax commented Jun 21, 2018

Hi,

I get the following error when I try to run either of the simple examples in your README file:

Traceback (most recent call last):
File "/Users/maximild/src/MaxQA/src/test.py", line 1, in
import en_coref_md
File "/Users/maximild/anaconda3/lib/python3.6/site-packages/en_coref_md/init.py", line 6, in
from en_coref_md.neuralcoref import NeuralCoref
File "/Users/maximild/anaconda3/lib/python3.6/site-packages/en_coref_md/neuralcoref/init.py", line 1, in
from .neuralcoref import NeuralCoref
File "strings.pxd", line 23, in init en_coref_md.neuralcoref.neuralcoref
ValueError: spacy.strings.StringStore has the wrong size, try recompiling. Expected 88, got 112

I appear to have successfully downloaded the en_coref_md model, but I am unable to import it. I'm using spaCy 2.0.11 and Python 3.6 if that helps.

Any suggestions on what might be wrong?

Thanks!

@BBCMax
Copy link
Author

BBCMax commented Jun 22, 2018

I tried downgrading spaCy to version 2.0.0 and got a slightly different value error

ValueError: spacy.strings.StringStore has the wrong size, try recompiling. Expected 64, got 112

@AYEG
Copy link

AYEG commented Jun 22, 2018

I think i also experienced that problem when I tried upgrading from 2.0 in 3.0 in another environment. in another clean virtual environment spacy keeps telling me I can't find the module and if I try to import it direcly it tells me "ImportError: cannot import name 'load_model_from_init_py'"

@AYEG
Copy link

AYEG commented Jun 22, 2018

Did an extra run to check if interpreter and right pip was used within conda and got the same message: "ValueError: spacy.strings.StringStore has the wrong size, try recompiling. Expected 88, got 112"

@thomwolf
Copy link
Member

Hi @BBCMax and @AYEG,
I can't reproduce your error with the latest spaCy and neuralcoref models.
Two questions:

  • are you on windows/mac/linux ?
  • do you have an error when you use en_coref_sm?

@BBCMax
Copy link
Author

BBCMax commented Jun 25, 2018

Hey!
I am running this on a mac, and I had the same error with en_coref_sm.

However I managed to get this working yesterday with the most recent version of spaCy and neuralcoref models (and en_coref_md). I had to do a fresh install of spaCy, its models, and neuralcoref - but I can't explain what would have changed in this process. Sorry for the confusion!

@AYEG
Copy link

AYEG commented Jun 25, 2018

Hi, yes also running on a mac and was unable to use en_coref_sm or en_coref_md inside newly created conda environments, tried different versions of spacy.

I gave it another try just now to see,
I created a conda environment, activated it..

conda install spacy
python -m spacy download en_core_web_sm
pip install https://github.com/huggingface/neuralcoref-models/releases/download/en_coref_sm-3.0.0/en_coref_sm-3.0.0.tar.gz

During Pip install I get two red lines

Successfully built en-coref-sm
mkl-random 1.0.1 requires cython, which is not installed.   <----
mkl-fft 1.0.0 requires cython, which is not installed.           <-----
 Installing collected packages: en-coref-sm, pathlib, regex

when i try to run, when it loads the model into spacy or when I import the module directly I get:

File "strings.pxd", line 23, in init en_coref_sm.neuralcoref.neuralcoref
ValueError: spacy.strings.StringStore has the wrong size, try recompiling. Expected 88, got 112

@thomwolf
Copy link
Member

Interesting, thanks.
Maybe the conda version of spaCy is older than the pip version.
Can you try pip install spacyinstead of conda in a clean environment?

@BBCMax
Copy link
Author

BBCMax commented Jun 25, 2018

I did this in a clean environment via pip initially..

@AYEG
Copy link

AYEG commented Jun 25, 2018

Thank you, It is working and it is quick! Amazing work

@thomwolf
Copy link
Member

thomwolf commented Jun 25, 2018

Happy to hear that.
By the way, you don't even need to install spaCy before neuralcoref, the recommended way to install NeuralCoref with conda (assuming MODEL_URL contains the NeuralCoref model URL) :

conda create -n myenv
source activate myenv
pip install MODEL_URL

@thomwolf
Copy link
Member

@BBCMax if you still have the problem try reinstalling a clean version of NeuralCoref like this:

pip install --upgrade --force-reinstall --no-cache-dir MODEL_URL

@BBCMax
Copy link
Author

BBCMax commented Jun 27, 2018

Thanks @thomwolf - all ok now, but I hope it can help someone else suffering from similar issues!

@thomwolf
Copy link
Member

Thanks for the heads up

@ashwini2008
Copy link

Thanks @thomwolf - all ok now, but I hope it can help someone else suffering from similar issues!

hey I have same problem. Can you please help me out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants