Failed building wheel for spacy
Asked Answered
S

12

26

I'm trying to install spacy by running pip install spacy for python version 3.6.1 but continuously i'm getting errors like below,how to get rid of this issue? previously i was having cl.exe not found error, after that i added visual studio path in environment variables where cl.exe exists.

     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\
Selfwinding answered 12/4, 2017 at 13:24 Comment(0)
V
18

A couple thoughts:

Victoriavictorian answered 2/7, 2017 at 15:4 Comment(4)
The first option worked for me on Windows 64 bit, python 2.7. Just a note you also need to cytoolz and ujson from : lfd.uci.edu/~gohlke/pythonlibsUnanimous
Dude, you just saved my life on this. Thank you so muchAalborg
What's the mac alternative?Inspection
What's the Raspbian/Linux alternative?Fogbow
K
32

for me, pip install --no-cache-dir spacy worked

Kaja answered 26/1, 2018 at 22:22 Comment(2)
Awesome! I spent hours trying to figure this out. This simple little line has spared me my sanity. Thanks!Shaker
correct solution if install is failing because your /tmp volume is running out of spaceIny
V
18

A couple thoughts:

Victoriavictorian answered 2/7, 2017 at 15:4 Comment(4)
The first option worked for me on Windows 64 bit, python 2.7. Just a note you also need to cytoolz and ujson from : lfd.uci.edu/~gohlke/pythonlibsUnanimous
Dude, you just saved my life on this. Thank you so muchAalborg
What's the mac alternative?Inspection
What's the Raspbian/Linux alternative?Fogbow
D
17

I installed these packages, then it works:

sudo apt-get install python-dev 
sudo apt-get install python3-dev 
sudo apt-get install libevent-dev
Drifter answered 5/6, 2017 at 7:56 Comment(4)
What's the Windows equivalent?Harlanharland
Whats equivalent for yum RHELNotum
is this for ubuntu ?Dougie
on Windows you can use Cygwin's installer (just re-run it again if you already have Cygwin) to add these packagesBeall
T
4

This worked for me:

# 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;

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

Thrombophlebitis answered 8/2, 2018 at 7:58 Comment(1)
Updated based on feedback.Thrombophlebitis
B
2

conda install -c conda-forge spacy worked for me. I have windows 10 and Python 3.5.3 :: Anaconda custom (64-bit)

Beni answered 22/1, 2019 at 0:0 Comment(0)
A
1

If you are on Ubuntu, just do this

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

Now install spacy by

pip install -U spacy
Alternative answered 2/6, 2018 at 19:3 Comment(0)
T
1

Download and install from the Gihub source. Here is the link: https://github.com/explosion/spaCy

Use these commands:

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

Feel free to use only last two commands if not using virtual environment. Follow the official Documentation here

Toffey answered 28/6, 2018 at 21:26 Comment(0)
L
1

If you are using it with manually installed python3.6 and trying to install in a 3.6 environment then you maybe missing python3.6-dev

sudo apt-get install python3.6-dev

also maybe

sudo apt-get install gcc

This is an answer to particular case.

Letourneau answered 13/1, 2019 at 12:57 Comment(2)
Based on the question i assume the op uses windows. So this may not help the OP.Shaunshauna
I agree. Answer is for someone like me who comes searching.Letourneau
R
1

yum -y groupinstall development

WORKED FOR ME

Roxana answered 14/3, 2019 at 16:54 Comment(0)
G
1

Spacy requires 64-bit python.

Uninstall 32-bit. Install 64-bit python.

Try spacy installation again.

Guffaw answered 29/4, 2020 at 4:48 Comment(0)
F
0

For anyone looking for an answer for spacy 2.X with Python 3.8 in Ubuntu, I had the same problem. I'm using venv. As the other answers were not enough, I write the solution which solved my problem.

  1. install the required libraries as mentioned in other answers:
sudo apt-get install python3-dev libevent-dev build-essential gcc g++
pip install setuptools wheel
  1. Update pip and install cython
pip install -U pip
pip install cython

I suspect that updating pip to the newest version solved my problem.

Fineman answered 22/2, 2021 at 22:37 Comment(0)
K
0

At first, install those packages and try to install spacy

sudo apt update
sudo apt install python3-dev
sudo apt install libpython3-dev
sudo apt install python3-devel
sudo apt-get install libevent-dev
sudo apt update
Kramer answered 1/8, 2021 at 11:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.