Search code examples
pythonpython-3.xpipspacybuild-tools

Error Message while installing Spacy 2.3.5 - "Microsoft Visual C++ 14.0 or greater is required" even though build tools is already installed


I want to use spacy version 2.3.5 since I have a trained an NLP model in this version. I am able to install latest spacy using "pip install spacy"

However installing any specific version fails

>>pip install spacy==2.3.5

  copying spacy\tests\tokenizer\sun.txt -> build\lib.win-amd64-cpython-310\spacy\tests\tokenizer
  running build_ext
  building 'spacy.parts_of_speech' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/   
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.   ERROR: Failed building wheel for spacy Failed to build spacy ERROR: Could not build wheels for spacy, which is required to install pyproject.toml-based projects

Build tools exists in my system: enter image description here

I have tried reinstalling pip, build tools and restarted my system several times. Build Tools didn't exist in my Environment Variables PATH so I've added the path yet the Spacy installation fails.

Apologies if this appears like a duplicate question, but I've gone through solutions on Stackoverflow and nothing works.

This answer suggested to install third part wheels instead but the web page isn't available.

My environment info: Virtual environment on Python 3.10.10 Windows 10 Home Edition


Solution

  • spacy 2.3.5 is compatible with "2.3.1", "2.3.0"

    "2.3.5": {
          "en_core_web_sm": ["2.3.1", "2.3.0"],
          "en_core_web_md": ["2.3.1", "2.3.0"],
          "en_core_web_lg": ["2.3.1", "2.3.0"]
    }
    

    You can install by:

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

    Or

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

    Here is the complete link : https://github.com/explosion/spacy-models/blob/master/compatibility.json