12

I´m new to python and I ran into a problem I can´t solve. I would like to install and use the package spacy in python. Therefore I opened cmd and ran

pip install spacy

While installing the dependecies I get an error message:

    ----------------------------------------

Command ""c:\users\xxx\appdata\local\programs\python\python37\python.exe" -u -c "import setuptools, tokenize;file='C:\Users\xxx\AppData\Local\Temp\pip-install-6vcdnb_4\numpy\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\xxx\AppData\Local\Temp\pip-record-jhmti8_8\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\xxx\AppData\Local\Temp\pip-install-6vcdnb_4\numpy\

but I have no idea what´s the problem...

Does anybody has a solution for this?

I use Windows and python version 3.7.0b4

Joe
  • 40,031
  • 18
  • 107
  • 123
WinterMensch
  • 613
  • 1
  • 7
  • 16

15 Answers15

11

You might be using the python 32-bit version which you need to uninstall and you will need to switch to the python 64-bit version.

After switching everything will work fine, just upgrade pip and setuptools before installing.

pppery
  • 3,550
  • 19
  • 28
  • 41
10

Ok, here is a working solution (at least on windows 10 & python3.7):

Go here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#spacy

Search SpaCy and download the correct wheels for your platform :-

  • preshed
  • cymem
  • murmurhash
  • thinc
  • spacy

Then you need to install them with pip install [wheel] in the above order.

If this doesn't work, try installing scipy and maybe even numpy from the same site.

MegaIng
  • 6,933
  • 1
  • 21
  • 34
  • 1
    Everything installed fine till murmurhash. But the same error as in the question while installing thinc, any idea? – eoeo Sep 28 '20 at 05:17
6

It took me a while to get spaCy installed correctly, I am on Windows and running python 3.6.4. I'll share my installation process in case it helps anyone.

I am using pycharm as my IDE and working from the venv it creates.

I also had similar problems to the OP and managed to get it working outside the venv.

The main issue appeared to be with pip.

First of all, I deleted my pip cache as it appeared to be causing troubles (atleast on my machine). On windows it is located on:

C:\Users\YOUR_USERNAME\AppData\Local\pip\cache

Just delete the folder.

Then I had to upadte pip to the latest version for the installation to work,

python -m pip install --upgrade pip

Check your pip version (at the time of this comment the latest version is 10.0.1)

python -m pip --version

After this process I managed to get it working by installing it with pip

python -m pip install spacy
Trantidon
  • 147
  • 6
4

The following two commans should be enough:

pip install -U spacy

python -m spacy download en

Note that on Windows you should execute the commands with 'Run as Administrator' privileges.

2

I was using windows10 64bits and python 3.8.2(32bits) and don't work for me. I Uninstalled python 32 bits and installed python 64bits, so it work now!

1

Upgrading the pip and the setuptools generally helps.
Here are 3 steps:

pip install pip -U
pip install setuptools -U
pip install -U spacy

Key is -U which upgrades all packages to the newest available version.

Memin
  • 3,210
  • 26
  • 27
1

Uninstall Python32 bit and install Python 64 bit..

Worked for me!

Eliahu Aaron
  • 1
  • 4
  • 26
  • 35
1

Was able to solve issue by installing Python 3.7 of 64 bit. You can refer https://github.com/explosion/spaCy/issues/4581

1

It worked after I switched from Python 3.9.0 to 3.8.6

Ray
  • 11
  • 1
  • 2
    That is not answer to the question (which, btw., already has an accepted answer): 2 years ago there was no Python 3.9. – Timus Nov 14 '20 at 23:32
0

I experienced absolutely the same problem today.

It turned out that the Python I had installed was 32 bit. Uninstalled it and added 64 bit version. My Windows 10 is 64 bit too. Tried again installing spaCy and it worked.

kamentk
  • 493
  • 4
  • 10
0

Cause

It usually happened when your installation accidently stop , some of the data remain in cache which causes the problem .

Note: this type of error can also be occured in other packages.

Solution

  • Go to that directory

    C:\Users\User_Name\AppData\Local\pip\cache

  • Delete cache file

  • Then upgrading the pip

    python -m pip install --upgrade pip

  • Install the package you want

    python -m pip install spacy

Ali Ashraf
  • 351
  • 3
  • 5
0

If you are using Python 3.8, I strongly advise you to downgrade the python version to 3.7. I was trying to solve the issue for 5 hours, finally, after changing the eve to 3.7 it worked.

conda create --name chatterbot_example python=3.7

source activate chatterbot_example

pip install chatterbot
pip install chatterbot-corpus
10 Rep
  • 2,156
  • 7
  • 17
  • 31
0

I recently had the same issue and unfortunately, these explanations helped progress but did not solve the problem. I have windows 64-bit laptop. Python version is 3.8.5 and 64 bit.

I followed the below steps to install stacy

  1. Uninstall all python installs on my system (32 bit installs will cause issues)
  2. Go to this link to make sure which version of python has all the below packages. All these packages are a pre-req for spacy

Go here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#spacy

preshed, cymem, murmurhash, thinc, spacy

example: preshed‑3.0.2‑cp38‑cp38‑win_amd64.whl > cp38 meaning 3.8 version. You can go up to the latest version on all these packages and install the same python version.

  1. Install Python 3.8.5 version

  2. run pip3 install spacy

At the time of this writing python 3.8 is the max that you can install spacy on.

For me the issue was I was trying to install spacy on python 3.9 version and downgrading to 3.8.6 fixed the issue.

Note: I spent almost 4 hours to fix this and this is the only page that has almost all the options that you will need to fix the issues.

0

I also had the same issue on Ubuntu, finally followed this guide.

On Ubuntu(python v3.7.9),

pip install -U pip setuptools wheel
pip install -U spacy
python -m spacy download en_core_web_sm

Hope this helps you save time.

Bi Wu
  • 935
  • 10
  • 14
0

I had to delete the cache folder first.

  1. Go to C:\Users\XYZ\AppData\Local\pip and then delete the cache folder

  2. Then upgrade your pip

    python -m pip install --upgrade pip
    
  3. now install spacy

    pip install spacy
    
Zoe stands with Ukraine
  • 25,310
  • 18
  • 114
  • 149