[Python] How to download spaCy models in a Poetry managed environment

Discussão em 'Python' iniciado por Stack, Junho 27, 2025.

  1. Stack

    Stack Membro Participativo

    I am writing a Python Jupyter notebook that does some NLP processing on Italian texts.

    I have installed spaCy 3.5.3 via Poetry and then attempt to run the following code:

    import spacy
    load_model = spacy.load('it_core_news_sm')


    The import line works as expected, but running spacy.load produces the following error:


    OSError: [E050] Can't find model 'it_core_news_sm'. It doesn't seem to be a Python package or a valid path to a data directory. The model name is correct as shown on https://spacy.io/models/it
    ​

    After a web search, I see that a solution is to issue the following command:

    python3 -m spacy download it_core_news_sm


    After running this command the above code works as expected, however, is there a more 'kosher' way of doing this via Poetry?

    Continue reading...

Compartilhe esta Página