Unable to install spacy english model in python 3.5
Asked Answered
P

2

10

I am doing the following:

root@ABZ-173:/home/abz# pip3 install en_core_web_md
Collecting en_core_web_md
  Could not find a version that satisfies the requirement en_core_web_md (from versions: )
No matching distribution found for en_core_web_md
You are using pip version 8.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

This used to work previously. I do not want to link spacy to the model, python -m spacy download en. Instead, I want to download it independently. Also tried by various other means (by specifying version en_core_web_md==2.0.0, etc.). Unable to download.

Paraldehyde answered 14/6, 2018 at 9:23 Comment(0)
L
18

en_core_web_md doesn't exist as a package in its own right on pypi.org or Anaconda, so you can't just pip install it by name. However you can find download links for the model on the GitHub page and you can pip install directly from one of the download URLs, e.g.

pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_md-2.0.0/en_core_web_md-2.0.0.tar.gz

Note that when I tested that it did install spacy for me. So it might be easiest to just use spacy to download in the first place and change the linked model with python -m spacy link afterwards if necessary.

Leschen answered 14/6, 2018 at 9:45 Comment(1)
One small addition: The reason spaCy is installed is that the model package specifies the spaCy version it's compatible with in its setup.py. If spaCy is not installed yet, or if the version doesn't match, pip will install and/or update it, just like it would for any other dependency. Setting the --no-deps flag will turn this off (but also means that the user is responsible for making sure that the versions are compatible).Ignominious
O
14

I believe the space documentation covers all of the use cases you are after. Specifically looks like there are ~3 ways to download models.

  • python -m spacy download en but that creates a link
  • python -m spacy download en_core_web_sm-2.0.0 --direct this doesn't create a link
  • pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz

You can include them in requirements with the following syntax

spacy>=2.0.0,<3.0.0
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz#en_core_web_sm

All of this was taken from the docs page here.

Orchestrion answered 14/6, 2018 at 10:41 Comment(2)
@Peter.k pip install your_file_name --userEsprit
I still think the best way would be the default: python -m spacy download en_core_web_smScharf

© 2022 - 2024 — McMap. All rights reserved.