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

Error when trying to load "en_core_sci_sm" #92

Closed
Bancherd-DeLong opened this issue Apr 4, 2019 · 3 comments

Comments

@Bancherd-DeLong
Copy link

commented Apr 4, 2019

Not sure of what's is going on, but I got this parsing error:

`>>> import spacy

nlp = spacy.load("en_core_sci_sm")
Traceback (most recent call last):
File "", line 1, in
File "/home/bancherd3/anaconda3/lib/python3.7/site-packages/spacy/init.py", line 27, in load
return util.load_model(name, **overrides)
File "/home/bancherd3/anaconda3/lib/python3.7/site-packages/spacy/util.py", line 131, in load_model
return load_model_from_package(name, **overrides)
File "/home/bancherd3/anaconda3/lib/python3.7/site-packages/spacy/util.py", line 152, in load_model_from_package
return cls.load(**overrides)
File "/home/bancherd3/anaconda3/lib/python3.7/site-packages/en_core_sci_sm/init.py", line 14, in load
nlp = load_model_from_init_py(file, **overrides)
File "/home/bancherd3/anaconda3/lib/python3.7/site-packages/spacy/util.py", line 190, in load_model_from_init_py
return load_model_from_path(data_path, meta, **overrides)
File "/home/bancherd3/anaconda3/lib/python3.7/site-packages/spacy/util.py", line 173, in load_model_from_path
return nlp.from_disk(model_path)
File "/home/bancherd3/anaconda3/lib/python3.7/site-packages/spacy/language.py", line 786, in from_disk
util.from_disk(path, deserializers, exclude)
File "/home/bancherd3/anaconda3/lib/python3.7/site-packages/spacy/util.py", line 611, in from_disk
reader(path / key)
File "/home/bancherd3/anaconda3/lib/python3.7/site-packages/spacy/language.py", line 776, in
deserializers["tokenizer"] = lambda p: self.tokenizer.from_disk(p, exclude=["vocab"])
File "tokenizer.pyx", line 390, in spacy.tokenizer.Tokenizer.from_disk
File "tokenizer.pyx", line 436, in spacy.tokenizer.Tokenizer.from_bytes
File "/home/bancherd3/anaconda3/lib/python3.7/re.py", line 234, in compile
return _compile(pattern, flags)
File "/home/bancherd3/anaconda3/lib/python3.7/re.py", line 286, in _compile
p = sre_compile.compile(pattern, flags)
File "/home/bancherd3/anaconda3/lib/python3.7/sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "/home/bancherd3/anaconda3/lib/python3.7/sre_parse.py", line 930, in parse
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
File "/home/bancherd3/anaconda3/lib/python3.7/sre_parse.py", line 426, in _parse_sub
not nested and not items))
File "/home/bancherd3/anaconda3/lib/python3.7/sre_parse.py", line 536, in _parse
code1 = _class_escape(source, this)
File "/home/bancherd3/anaconda3/lib/python3.7/sre_parse.py", line 337, in _class_escape
raise source.error('bad escape %s' % escape, len(escape))
re.error: bad escape \p at position 326`


Thank you very much.

@danielkingai2

This comment has been minimized.

Copy link
Collaborator

commented Apr 4, 2019

What versions of scispacy and spacy do you have?

@danielkingai2

This comment has been minimized.

Copy link
Collaborator

commented Apr 4, 2019

My guess is that you have an incompatible version for the model that you downloaded. You'll want to make sure that for scispacy version 0.1.0 you have spacy version 2.0.18 and use models that have 0.1.0 in the url, like this one https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.1.0/en_core_sci_sm-0.1.0.tar.gz. We just upgraded scispacy to version 0.2.0 which is compatible with spacy version 2.1.3 and requires models with 0.2.0 in the url, like this one https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.2.0/en_core_sci_sm-0.2.0.tar.gz. The README has been updated to have model links for scispacy version 0.2.0 as of yesterday.

@Bancherd-DeLong

This comment has been minimized.

Copy link
Author

commented Apr 5, 2019

Thank you. I used "en_core_sci_sm" == en_core_sci_sm-0.2.0.tar.gz and the issue went away. I will close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.