Aravind R
Aravind R

Reputation: 1283

ERROR: Could not build wheels for spacy, which is required to install pyproject.toml-based projects

enter image description here

Hi Guys, I am trying to install spacy model == 2.3.5 but I am getting this error, please help me!

Upvotes: 5

Views: 45531

Answers (4)

ohnoinkimono
ohnoinkimono

Reputation: 41

I had a similar issue with this. In my case it was "nmslib". Along the way I also ran into CUDA problems, similar to this. Deleting my scispacy conda environment over and over again, I finally achieved a clean and fast install with this order:

# create new conda environment with Python 3.9 (to build wheels)
conda create -n scispacy python=3.9

# activate new environment
conda activate scispacy

# install other important packages (don't forget pytorch here! It is especially important as "pip install scispacy" would install it too, but then you would run into CUDA trouble)
conda install spyder numpy scipy pandas matplotlib sympy cython pytorch 

# install scispacy
pip install scispacy

# .. and its models (the ones you want, obviously)`enter code here`
pip install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.5.3/en_core_sci_lg-0.5.3.tar.gz
pip install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.5.3/en_core_sci_scibert-0.5.3.tar.gz

Upvotes: 1

Anton Samokat
Anton Samokat

Reputation: 1136

I had the similar error while executing pip install -r requirements.txt but for aiohttp module:

socket.c -o build/temp.linux-armv8l-cpython-311/aiohttp/_websocket.o
aiohttp/_websocket.c:198:12: fatal error: 'longintrepr.h' file not found
#include "longintrepr.h"                                   
          ^~~~~~~                        1 error generated.
error: command '/data/data/com.termux/files/usr/bin/arm-linux-androideabi-clang' 
failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for aiohttp
Failed to build aiohttp
ERROR: Could not build wheels for aiohttp, which is required to install
pyproject.toml-based projects

Just in case I will leave here solution to my error. This error is specific to Python 3.11 version. On Python with 3.10.6 version installation went fine.

To solve it I needed to update requirements.txt.

Not working versions of modules with Python 3.11:

aiohttp==3.8.1
yarl==1.4.2
frozenlist==1.3.0

Working versions:

aiohttp==3.8.2
yarl==1.8.1
frozenlist==1.3.1

Links to the corresponding issues with fixes:

Upvotes: 4

aab
aab

Reputation: 11474

Try using python 3.6-3.9 instead, where there are binary wheels for pip install to use instead of having to compile from source.

(This is a conflict with python 3.10 and some generated .cpp files in the source package. Python 3.10 wasn't released yet when this version was published.)

Upvotes: 5

Talha Tayyab
Talha Tayyab

Reputation: 27219

Try using:

!pip install spacy==2.3.5

Do not give space between == and 2.3.5

If you give any space between equal sign and version, it may give error.

Upvotes: 1

Related Questions