4

I'm trying to install Spacy on my computer but when I run

pip.exe install spacy

I obtain this error:

Requirement already satisfied (use --upgrade to upgrade): spacy in c:\python27
Collecting numpy (from spacy)
  Using cached numpy-1.9.2.tar.gz
    Running from numpy source directory.
Collecting murmurhash (from spacy)
  Using cached murmurhash-0.24.tar.gz
    warning: manifest_maker: MANIFEST.in, line 5: 'recursive-include' expects <dir> <pattern1> <pattern2> ...
    warning: manifest_maker: MANIFEST.in, line 6: unknown action '*.py'
    warning: manifest_maker: MANIFEST.in, line 7: unknown action '*.rst'
Collecting cymem>=1.11 (from spacy)
  Using cached cymem-1.11.tar.gz
Collecting preshed (from spacy)
  Using cached preshed-0.37.tar.gz
    zip_safe flag not set; analyzing archive contents...
    headers_workaround.__init__: module references __file__
Installed c:\users\hp-por~1\appdata\local\temp\pip-build-y5elnp\preshed\.eggs\headers_workaround-0.17-py2.7.egg
Collecting thinc (from spacy)
  Using cached thinc-1.75.tar.gz
    zip_safe flag not set; analyzing archive contents...
    headers_workaround.__init__: module references __file__
    Installed c:\users\hp-por~1\appdata\local\temp\pip-build-y5elnp\thinc\.eggs\headers_workaround-0.17-py2.7.egg
Requirement already satisfied (use --upgrade to upgrade): unidecode in c:\python27\lib\site-packages (from spacy)
Requirement already satisfied (use --upgrade to upgrade): wget in c:\python27\lib\site-packages (from spacy)
Requirement already satisfied (use --upgrade to upgrade): plac in c:\python27\lib\site-packages (from spacy)
Requirement already satisfied (use --upgrade to upgrade): six in c:\python27\lib\site-packages (from spacy)
Installing collected packages: thinc, preshed, cymem, murmurhash, numpy
  Running setup.py install for thinc
    building 'thinc.learner' extension
    C:\Users\HP-PORTABLE\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I. -IC:\Python27\include -IC:\Python27\include -IC:\Python27\PC /Tpthinc/learner.cpp /Fobuild\temp.win32-2.7\Release\thinc/learner.obj -O3
    cl : Command line warning D9002 : ignoring unknown option '-O3'
    learner.cpp
    thinc/learner.cpp(238) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
    error: command 'C:\\Users\\HP-PORTABLE\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
    Complete output from command C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\hp-por~1\\appdata\\local\\temp\\pip-build-y5elnp\\thinc\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\hp-por~1\appdata\local\temp\pip-qxxztl-record\install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_py

creating build

creating build\lib.win32-2.7

creating build\lib.win32-2.7\thinc

copying thinc\context_fields.py -> build\lib.win32-2.7\thinc

copying thinc\util.py -> build\lib.win32-2.7\thinc

copying thinc\__init__.py -> build\lib.win32-2.7\thinc

copying thinc\cache.pyx -> build\lib.win32-2.7\thinc

copying thinc\cy_svm.pyx -> build\lib.win32-2.7\thinc

copying thinc\features.pyx -> build\lib.win32-2.7\thinc

copying thinc\learner.pyx -> build\lib.win32-2.7\thinc

copying thinc\search.pyx -> build\lib.win32-2.7\thinc

copying thinc\thinc.pyx -> build\lib.win32-2.7\thinc

copying thinc\weights.pyx -> build\lib.win32-2.7\thinc

copying thinc\cache.pxd -> build\lib.win32-2.7\thinc

copying thinc\cy_svm.pxd -> build\lib.win32-2.7\thinc

copying thinc\features.pxd -> build\lib.win32-2.7\thinc

copying thinc\learner.pxd -> build\lib.win32-2.7\thinc

copying thinc\search.pxd -> build\lib.win32-2.7\thinc

copying thinc\thinc.pxd -> build\lib.win32-2.7\thinc

copying thinc\typedefs.pxd -> build\lib.win32-2.7\thinc

copying thinc\weights.pxd -> build\lib.win32-2.7\thinc

copying thinc\__init__.pxd -> build\lib.win32-2.7\thinc

copying thinc\compile_time_constants.pxi -> build\lib.win32-2.7\thinc

running build_ext

building 'thinc.learner' extension

creating build\temp.win32-2.7

creating build\temp.win32-2.7\Release

creating build\temp.win32-2.7\Release\thinc

C:\Users\HP-PORTABLE\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I. -IC:\Python27\include -IC:\Python27\include -IC:\Python27\PC /Tpthinc/learner.cpp /Fobuild\temp.win32-2.7\Release\thinc/learner.obj -O3

cl : Command line warning D9002 : ignoring unknown option '-O3'

learner.cpp

thinc/learner.cpp(238) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory

error: command 'C:\\Users\\HP-PORTABLE\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

----------------------------------------
Command "C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\hp-por~1\\appdata\\local\\temp\\pip-build-y5elnp\\thinc\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\hp-por~1\appdata\local\temp\pip-qxxztl-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\hp-por~1\appdata\local\temp\pip-build-y5elnp\thinc

I've upgraded setuptools, but nothing changes. I'm running a Windows 7 64b. I've installed Visual C++ compiler Package for python 2.7. I'm trying to install on 2 different PC with the same error.

shauryachats
  • 9,975
  • 4
  • 35
  • 48
user3310453
  • 41
  • 1
  • 2

2 Answers2

0

In Windows, I have had a lot of problems installing packages via pip. One solution I found (and I still use it) it's using 'virtualenv' in order to create virtual enviroments for my projects. Pip seems to work better in venvs rather than C: routes.

You can install virtualenv via pip pip install virtualenv or check the installation guide.

After instalation, simply create a virtualenv in your project route (or wherever you want) and activate it. Open a cmd terminal and use:

> virtualenv name_of_the_enviroment
> name_of_the_enviroment/Scripts/activate
> pip install spacy

I hardly recommend to put your python routes in your Enviroment Variables, so you can use "pip", "python" etc in the cmd terminal.

Now, when you use "pip install some_package", it will be installed in the virtualenv instead. deactivate will deactivate the virtualenv.

Note: Please note that you must activate a virtualenv whenever you want to use packages or start the project with installed packages.

  • 2
    Thank you but I obtain the same error when I run in the new environment (which name is myspacy): (myspacy) C:\Python27\Scripts\myspacy\Scripts>pip.exe install spacy. – user3310453 Mar 20 '15 at 12:46
0

It could possibly be a conflict with other python packages installed in your virtual environment (venv). That was the case I had. I tried a pip install into a venv that had these packages already installed:

appnope==0.1.0
beautifulsoup4==4.5.1
bs4==0.0.1
chardet==2.3.0
cloudpickle==0.2.1
cssselect==1.0.0
cymem==1.31.2
decorator==4.0.10
entrypoints==0.2.2
headers-workaround==0.18
ipykernel==4.5.2
ipython==5.1.0
ipython-genutils==0.1.0
ipywidgets==5.2.2
Jinja2==2.8
jsonschema==2.5.1
jupyter==1.0.0
jupyter-client==4.4.0
jupyter-console==5.0.0
jupyter-core==4.2.1
lxml==3.6.4
MarkupSafe==0.23
mistune==0.7.3
murmurhash==0.26.4
nbconvert==4.2.0
nbformat==4.2.0
notebook==4.2.3
numpy==1.11.2
pandas==0.19.1
pathlib==1.0.1
pdfminer.six==20160614
pdfminer3k==1.3.1
pdfquery==0.4.3
pexpect==4.2.1
pickleshare==0.7.4
plac==0.9.6
ply==3.9
preshed==0.46.4
prompt-toolkit==1.0.9
ptyprocess==0.5.1
py==1.4.31
Pygments==2.1.3
pyquery==1.2.17
pytest==3.0.3
python-dateutil==2.6.0
pytz==2016.7
pyzmq==16.0.2
qtconsole==4.2.1
requests==2.11.1
roman==2.0.0
semver==2.7.2
simplegeneric==0.8.1
six==1.10.0
slate==0.3
sputnik==0.9.3
terminado==0.6
thinc==5.0.8
tornado==4.4.2
traitlets==4.3.1
ujson==1.35
wcwidth==0.1.7
widgetsnbextension==1.2.6

and it kept failing, even with upgrading setuptools.

Try creating a totally new environment conda create -n spacy python=3, proceeding with the installation of the default packages (openssl, pip, wheel, etc) and (after activating the new venv source activate spacy) then run pip install -U spacy. It installed into the virtual environment with no problems. From there install the other packages you need.

cheevahagadog
  • 4,638
  • 3
  • 15
  • 15