I installed spacy package in python 3.6 but after installing I get this error when I want to import this package.

In [1]: import spacy
ImportError                               Traceback (most recent call last)
<ipython-input-1-c080f6458562> in <module>()
----> 1 import spacy

C:\Users\Dsaad\Anaconda3\lib\site-packages\spacy\__init__.py in <module>()
      2 from __future__ import unicode_literals
----> 4 from . import util
      5 from .deprecated import resolve_model_name
      6 from .cli import info

C:\Users\Dsaad\Anaconda3\lib\site-packages\spacy\util.py in <module>()
      4 import ujson
----> 5 import regex as re
      6 from pathlib import Path
      7 import sys

C:\Users\Dsaad\Anaconda3\lib\site-packages\regex.py in <module>()
    392 # Internals.
--> 394 import _regex_core
    395 import _regex
    396 from threading import RLock as _RLock

C:\Users\Dsaad\Anaconda3\lib\site-packages\_regex_core.py in <module>()
     19 from collections import defaultdict
---> 21 import _regex
     23 __all__ = ["A", "ASCII", "B", "BESTMATCH", "D", "DEBUG", "E", "ENHANCEMATCH",

ImportError: DLL load failed: The specified procedure could not be found.

I had this issue as well, but it was fixed after I created a conda environment and specified python=3.

conda create --name py36 python=3

This command installed a few new packages:

  • pip: 9.0.1-py36_1
  • python: 3.6.1-0
  • setuptools: 27.2.0-py36_1
  • vs2015_runtime: 14.0.25123-0
  • wheel: 0.29.0-py36_0

I suspect the installation of vs2015_runtime is what fixed this issue, but I haven't done a root cause analysis. Visual Studio is mentioned in the Spacy Windows installation section.

Also note if you use this solution you will need to activate the conda environment whenever you want to use it. (see conda envs activating environments docs)

  • I've done all of that and I still have the problem. – DSaad May 9 '17 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.