SpaCy needs a file that doesn't exist: strings.json
I run pytextrank in the second step, I get this error from spaCy:
File "C:\Anaconda3\lib\pathlib.py", line 371, in wrapped return strfunc(str(pathobj), *args)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Anaconda3\\lib\\site-packages\\spacy\\data\\en\\vocab\\strings.json'
I have searched .json strings but there is no such thing.
Interestingly, a similar error with pathlib.py existed when I installed spaCy with the following error code:
OSError: Symbolic link privilege not held
Do you guys have any ideas? Thanks to
source to share
In conclusion, I can answer the question on stackoverflow. I faced the same problem but ended up solving it. Here's my suggestion:
1. Download spaCy model from python -m spacy or github
both are very convenient.
1). from python spacy:
python3 -m spacy download en
Suppose you are using python3 +, this can be done automatically and create new model packages that you can import via import en or using spacy.load('en')
2). from github
send a link , register a new version and download it.
2. (if you are not using python -m path then you want to manually link the model) Link your loaded model
this is the most important part, you have to unzip the downloaded tar or gzip file and get the folder, however this is still not the link path you want.
.
βββ en_core_web_md-1.2.1
β βββ deps
β β βββ config.json
β β βββ model
β βββ meta.json
β βββ ner
β β βββ config.json
β β βββ model
β βββ pos
β β βββ config.json
β β βββ model
β βββ vocab
β βββ gazetteer.json
β βββ lexemes.bin
β βββ oov_prob
β βββ serializer.json
β βββ strings.json
β βββ vec.bin
you have to link the folder to the structure. which spacy will link the folder via your link name.
here is the script link you need:
base_path=`pwd`
sudo python3 -m spacy link ${base_path}/en_core_web_md-1.2.1 en_core_web --force
you can create a .sh file next to this folder and run it.
, what is it!
source to share
The error Symbolic link privilege not held
usually occurs if you have installed spaCy and models in the system directory, but your user does not have the necessary permissions to create symbolic links. To resolve this issue, run download
either link
again as administrator or, if this is not possible, use virtualenv
to install everything to the user directory (see the troubleshooting section for more on this ).
Since version 1.1.0 spaCy creates symbolic links. quick access links in the catalog spacy/data
. This makes it easy to keep your models wherever you want, install them as Python packages and load them using custom names eg. spacy.load('my_model')
...
What probably happened in your case is that spaCy was unable to establish this link due to a permission error and now cannot find and load the model - including vocab/strings.json
. (The spaCy path failed here, although it didn't, but it was fixed in version 1.1.3.)
Since the model is already installed, all you have to do is create a symbolic link for it (either as an administrator or at virtualenv
):
python -m spacy link en_core_web_sm en
(If you downloaded another model , just replace en_core_web_sm
with the name of that model. en
- this is a shortcut to use and can be any name you want.)
Edit: if you want to use a tokenizer and don't care about the models, or want to use one of the supported languages that didn't come with a statistical model yet, you can also just import the class Language
in v1.7.3:
from spacy.fr import French
nlp = French()
source to share