Load resource causes AssertionError
nlp = English() Traceback (most recent call last): File "
", line 1, in File "/usr/local/lib/python2.7/dist-packages/spacy/language.py", line 194, in init tokenizer = self.default_tokenizer(vocab, data_dir=path.join(data_dir, 'tokenizer')) File "/usr/local/lib/python2.7/dist-packages/spacy/language.py", line 152, in default_tokenizer return Tokenizer.from_dir(vocab, data_dir) File "spacy/tokenizer.pyx", line 39, in spacy.tokenizer.Tokenizer.from_dir (spacy/tokenizer.cpp:3004) File "spacy/tokenizer.pyx", line 31, in spacy.tokenizer.Tokenizer.init (spacy/tokenizer.cpp:2620) File "spacy/tokenizer.pyx", line 257, in spacy.tokenizer.Tokenizer._load_special_tokenization (spacy/tokenizer.cpp:6025) File "spacy/vocab.pyx", line 184, in spacy.vocab.Vocab.make_fused_token (spacy/vocab.cpp:5541) File "spacy/vocab.pyx", line 99, in spacy.vocab.Vocab.get (spacy/vocab.cpp:4247) AssertionError python -m spacy.en.download all ran to completion without any error...
Data folder looks good:
ls /usr/local/lib/python2.7/dist-packages/spacy/en/data/ deps ner pos tokenizer vocab wordnet
Any idea how to fix this? Thanks in advance.
Are you using the latest version and did you download the english model?
$ pip install --upgrade spacy
$ python -m spacy.en.download all
Hi, Yes, i am running the latest version and download ran to completion successfully. I even upgraded Numpy to 1.9.3 but that did not help either.
I looked into vocab.pyx and the assertion at line 99 ( assert lex.orth == self.strings[string]) is failing. Need some more time to understand what this assertion is about.
I've added a more detailed error, since bare asserts are obviously bad.
The new exception says:
class LookupError(Exception):
@classmethod
def mismatched_strings(cls, id_, id_string, original_string):
return cls(
"Error fetching a Lexeme from the Vocab. When looking up a string, "
"the lexeme returned had an orth ID that did not match the query string. "
"This means that the cached lexeme structs are mismatched to the "
"string encoding table. The mismatched:\n"
"Query string: {query}\n"
"Orth cached: {orth_str}\n"
"ID of orth: {orth_id}".format(
query=original_string, orth_str=id_string, orth_id=id_)
)
Since your error is happening on load, it means that the lexemes.bin file is out-of-synch with the strings.txt, which entries in the lexemes.bin refer to.
Did you compile from source, or install via pip or conda?
Meta: We really need a command like python -m spacy.debug. We're having a lot of problems with the diversity of ways things can be installed and set up, and the variety of different platforms. I'd really like to make this debugging process much smoother.
Hi, Thanks for you reply. I deleted everything and tried to build from scratch using pip but same results. I am using Ubuntu 12.04 for legacy reasons. The same set of commands work fine on vivid Ubuntu 15.04 so I dont whether it has to do with 12.04. I checked the data files in two installations (12.04 vs 15.04) and they seem to be identical at least in size. Any other reasons(other module version etc) for the error?
Is your OS 32 bit, or 64 bit?
64bit ubuntu server
$lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 12.04.5 LTS Release: 12.04 Codename: precise
Hey Matthew, Thanks for your help but we decided to upgrade our server as we could not resolve the issue and it was about time we need to upgrade our servers. Closing this issue. Thanks.
i get the same error too:
Traceback (most recent call last):
File "classify-briefs.py", line 11, in <module>
nlp = English(parser=False, tagger=False, entity=False)
File "/home/ysim/tools/python/lib/python2.7/site-packages/spacy/language.py", line 194, in __init__
tokenizer = self.default_tokenizer(vocab, data_dir=path.join(data_dir, 'tokenizer'))
File "/home/ysim/tools/python/lib/python2.7/site-packages/spacy/language.py", line 152, in default_tokenizer
return Tokenizer.from_dir(vocab, data_dir)
File "spacy/tokenizer.pyx", line 39, in spacy.tokenizer.Tokenizer.from_dir (spacy/tokenizer.cpp:3004)
File "spacy/tokenizer.pyx", line 31, in spacy.tokenizer.Tokenizer.__init__ (spacy/tokenizer.cpp:2620)
File "spacy/tokenizer.pyx", line 257, in spacy.tokenizer.Tokenizer._load_special_tokenization (spacy/tokenizer.cpp:6025)
File "spacy/vocab.pyx", line 186, in spacy.vocab.Vocab.make_fused_token (spacy/vocab.cpp:5623)
File "spacy/vocab.pyx", line 100, in spacy.vocab.Vocab.get (spacy/vocab.cpp:4320)
spacy.vocab.LookupError: Error fetching a Lexeme from the Vocab. When looking up a string, the lexeme returned had an orth ID that did not match the query string. This means that the cached lexeme structs are mismatched to the string encoding table. The mismatched:
Query string:
Orth cached:
ID of orth: 2032
i am running with python 2.7 and on 64 bit version of cent os. what could be the problem?
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.