OSError: [E050] Can’t find model ‘en’

I am trying to use this pytextrank library of python- https://github.com/DerwenAI/pytextrank/blob/master/example.ipynb
but i am unable to resolve this error , earlier i was getting an error that ip.json can’t be found, but then was resolved

    import pytextrank
    import sys
    path_stage0="data/ip.json" 
    path_stage1="o1.json"

    with open(path_stage1,'w') as f:
        for graf in pytextrank.parse_doc(pytextrank.json_iter(path_stage0)):
            f.write("%sn" % pytextrank.pretty_print(graf._asdict()))
            print(pytextrank.pretty_print(graf))


    OSError                                   Traceback (most recent call last)
    <ipython-input-12-a20b437ea0f1> in <module>
          6 
          7 with open(path_stage1,'w') as f:
    ----> 8     for graf in pytextrank.parse_doc(pytextrank.json_iter(path_stage0)):
          9         f.write("%sn" % pytextrank.pretty_print(graf._asdict()))
         10         print(pytextrank.pretty_print(graf))

~Anaconda3libsite-packagespytextrankpytextrank.py in parse_doc(json_iter)
    259                 print("graf_text:", graf_text)
    260 
--> 261             grafs, new_base_idx = parse_graf(meta["id"], graf_text, base_idx)
    262             base_idx = new_base_idx
    263 

~Anaconda3libsite-packagespytextrankpytextrank.py in parse_graf(doc_id, graf_text, base_idx, spacy_nlp)
    185     if not spacy_nlp:
    186         if not SPACY_NLP:
--> 187             SPACY_NLP = spacy.load("en")
    188 
    189         spacy_nlp = SPACY_NLP

~Anaconda3libsite-packagesspacy__init__.py in load(name, **overrides)
     25     if depr_path not in (True, False, None):
     26         deprecation_warning(Warnings.W001.format(path=depr_path))
---> 27     return util.load_model(name, **overrides)
     28 
     29 

~Anaconda3libsite-packagesspacyutil.py in load_model(name, **overrides)
    137     elif hasattr(name, "exists"):  # Path or Path-like to model data
    138         return load_model_from_path(name, **overrides)
--> 139     raise IOError(Errors.E050.format(name=name))
    140 
    141 

OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

3

when using spacy we have to download the model using

python -m spacy download en_core_web_sm

If you have already done that make sure you have shortcut link assigned properly. meaning simlink between ‘en’ and ‘en_core_web_sm’

easy hack that worked when i am working directly with spacy

nlp = spacy.load("en_core_web_sm")

more help at https://spacy.io/usage/models

5

The model names changed, so en_core_web_sm or another model needed to be downloaded. That issue is resolved in the v1.2.1 release which updates to spaCy 2.x.

Try using the following command:

spacy.cli.download("en")

nlp = spacy.load('en_core_web_sm')

2

Solved error on notebook using:

!python -m spacy download en_core_web_md

You can download packages as per your requirements like:

!python -m spacy download en_core_web_sm'

or

!python -m spacy download en_core_web_lg

I solve the problem as follows.

Problem: I issued the following command:

pip install spacy

python -m spacy download en_core_web_lg

Then in the python console, when I used spacy.load(“en_core_web_lg”), I received the following error:
“Can’t find model ‘en_core_web_lg’. It doesn’t seem to be a shortcut link, a Python package or a valid path to a data directory.”

Solution:

  1. First, issue the ‘which python’ command to find the python installation used by your program. (Example of output: …/venv/bin/python)
  2. Inside the lib folder (located in the same level where the ‘bin’ folder is located), there should be a ‘site-packages/spacy’ folder. Go to the ‘spacy/data’ folder. Inside the ‘site-packages, a folder was created (e.g., en_core_web_lg or en_core_web_sm) when you download the model. Create a symbolic link to the downloaded model folder as follows:
    ln -s LOCATION_TO_MODEL THE_MODEL_NAME_YOU_WANT_TO_USE
    (Example: ln -s …/venv/lib/python3.5/site-packages/en_core_web_lg
    en_core_web_lg en_core_web_lg)
  3. A symbolic link with the name ‘en_core_web_lg’ is created.
  4. spacy.load(“en_core_web_lg”) command is now working. The name passed as the argument now point to the correct location of the model

More about the symbolic link can be found here: https://askubuntu.com/questions/56339/how-to-create-a-soft-or-symbolic-link

To me, the problem was solved by installing the en package:

python -m spacy download en

I was getting the following error:

OSError: [E050] Can’t find model ‘en_core_web_sm’. It doesn’t seem to be a shortcut link, a Python package or a valid path to a data directory.

here is my solution:

First, install the en_core_web package

pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0-py3-none-any.whl

Then, instead of using spacy as before:

import spacy
nlp = spacy.load('en_core_web_sm')

doc = nlp(text)
xxxxxxx

just use the installed package to act as the nlp processor like this

import en_core_web_sm
nlp = en_core_web_sm.load()

doc = nlp(text)
xxxxxxx

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật