Rueda de construcción fallada para spacy

Estoy tratando de instalar spacy ejecutando pip install spacy para la versión 3.6.1 de python, pero continuamente obtengo errores como el de abajo, ¿cómo deshacerme de este problema? Anteriormente estaba teniendo el error cl.exe no encontrado, después de eso agregué una ruta de estudio visual en las variables de entorno donde existe cl.exe.

  Failed building wheel for spacy Running setup.py clean for spacy Running setup.py bdist_wheel for murmurhash ... error Complete output from command c:\users\sh00428701\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SH0042~1\\AppData\\Local\\Temp\\pip-build-joi6voav\\murmurhash\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\SH0042~1\AppData\Local\Temp\tmpa6tzdkovpip-wheel- --python-tag cp36: running bdist_wheel running build running build_py ---------------------------------------- Failed building wheel for murmurhash Running setup.py clean for murmurhash Running setup.py bdist_wheel for cymem ... error Complete output from command c:\users\sh00428701\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SH0042~1\\AppData\\Local\\Temp\\pip-build-joi6voav\\cymem\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\SH0042~1\AppData\Local\Temp\tmpz7p6hkiwpip-wheel- --python-tag cp36: ---------------------------------------- Failed building wheel for cymem Running setup.py clean for cymem Running setup.py bdist_wheel for preshed ... error Complete output from command c:\users\sh00428701\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SH0042~1\\AppData\\Local\\Temp\\pip-build-joi6voav\\preshed\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\SH0042~1\AppData\Local\Temp\tmpwppgmyp9pip-wheel- --python-tag cp36: ---------------------------------------- Failed building wheel for preshed Running setup.py clean for preshed Running setup.py bdist_wheel for thinc ... error ---------------------------------------- Failed building wheel for thinc Running setup.py clean for thinc Running setup.py bdist_wheel for ujson ... error ---------------------------------------- Failed building wheel for ujson Running setup.py clean for ujson Running setup.py bdist_wheel for cytoolz ... error ---------------------------------------- Failed building wheel for cytoolz Running setup.py clean for cytoolz Failed to build spacy murmurhash cymem preshed thinc ujson cytoolz Installing collected packages: murmurhash, cymem, preshed, wrapt, tqdm, toolz, cytoolz, plac, pyreadline, dill, termcolor, pathlib, thinc, ujson, regex, spacy Running setup.py install for murmurhash ... error C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\sh00428701\appdata\local\programs\python\python36\include -IC:\Users\SH0042~1\AppData\Local\Temp\pip-build-joi6voav\murmurhash\murmurhash\include -Ic:\users\sh00428701\appdata\local\programs\python\python36\include -Ic:\users\sh00428701\appdata\local\programs\python\python36\include /EHsc /Tpmurmurhash/mrmr.cpp /Fobuild\temp.win-amd64-3.6\Release\murmurhash/mrmr.obj /Ox /EHsc mrmr.cpp c1xx: fatal error C1083: Cannot open source file: 'murmurhash/mrmr.cpp': No such file or directory error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\cl.exe' failed with exit status 2 ---------------------------------------- Command "c:\users\sh00428701\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SH0042~1\\AppData\\Local\\Temp\\pip-build-joi6voav\\murmurhash\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\SH0042~1\AppData\Local\Temp\pip-_j1cxej1-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\SH0042~1\AppData\Local\Temp\pip-build-joi6voav\murmurhash\ 

Un par de pensamientos:

para mí, pip install --no-cache-dir spacy funcionó

Instalé estos paquetes, entonces funciona:

 sudo apt-get install python-dev sudo apt-get install python3-dev sudo apt-get install libevent-dev 

Esto funcionó para mí:

 # Note, use sudo. I'm in a docker image, so i dont need it. # install dev libs apt-get install python-dev -y && \ apt-get install python3-dev -y && \ apt-get install libevent-dev -y && \ # install new gcc apt-get update && \ apt-get install build-essential software-properties-common -y && \ add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ apt-get update && \ apt-get install gcc-snapshot -y && \ apt-get update && \ apt-get install gcc-6 g++-6 -y && \ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \ apt-get install gcc-4.8 g++-4.8 -y && \ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8; 

vea https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91

Si estás en Ubuntu, haz esto

 sudo apt-get install build-essential python-dev git 

Ahora instala spacy por

 pip install -U spacy 

Descargue e instale desde la fuente Gihub. Aquí está el enlace: https://github.com/explosion/spaCy

Usa estos comandos:

 python -m pip install -U pip venv # update pip & virtualenv git clone https://github.com/explosion/spaCy # clone spaCy cd spaCy # navigate into directory venv .env # create environment in .env source .env/bin/activate # activate virtual environment export PYTHONPATH=`pwd` # set Python path to spaCy directory pip install -r requirements.txt # install all requirements python setup.py build_ext --inplace # compile spaCy 

Siéntase libre de usar solo los dos últimos comandos si no usa un entorno virtual. Sigue la Documentación oficial aquí.

Si lo está utilizando con python3.6 instalado manualmente e intenta instalarlo en un entorno 3.6, es posible que falte python3.6-dev

 sudo apt-get install python3.6-dev 

también tal vez

 sudo apt-get install gcc 

Esta es una respuesta a un caso particular.

conda install -c conda-forge spacy funcionó para mí. Tengo Windows 10 y Python 3.5.3 :: Anaconda custom (64-bit)

yum -y desarrollo groupinstall

TRABAJÓ PARA MI