Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"The C extension could not be compiled' error. - while installing Flask

Tags:

python

flask

I get the error below when installing flask in virtualenv on debian 7. apt-get-install tells me I already have GCC. I tried apt-get install libpcre3-dev but then reinstalled flask with pip install Flask-scss --force-reinstall -I but still got the same error. How do I fix this so that the speedups are used?

The Error:

markupsafe/_speedups.c:12:20: fatal error: Python.h: No such file or directory
compilation terminated.
==========================================================================
WARNING: The C extension could not be compiled, speedups are not enabled.
Failure information, if any, is above.
Retrying the build without the C extension now.


==========================================================================
WARNING: The C extension could not be compiled, speedups are not enabled.
Plain-Python installation succeeded.
==========================================================================
like image 635
mkatt Avatar asked Jun 07 '14 12:06

mkatt


4 Answers

You need to install the python-dev package too; it depends on the right package that contains Python.h:

apt-get install python-dev
like image 126
Martijn Pieters Avatar answered Nov 09 '22 22:11

Martijn Pieters


For those using Amazon Web Services (AWS) .

Install your system’s Development tool-chain per this reference:

yum (Amazon AMI, RedHat, Centos)

sudo yum groupinstall -y "Development Tools"

apt (Debian, Ubuntu, Mint)

sudo apt-get install -y build-essential
like image 1
nu everest Avatar answered Nov 09 '22 22:11

nu everest


sudo apt-get install python-dev

Or

 sudo apt-get install python3-dev for python3
like image 9
Padraic Cunningham Avatar answered Nov 10 '22 00:11

Padraic Cunningham


This is a common problem on windows also when install libraries having c extensions. This problem in windows can be solved by install mingw, which stands for Minimalist GNU for Windows.

To install mingw for anaconda:

conda install mingw

To know more about mingw, have a look at http://www.mingw.org/

like image 1
Susa Avatar answered Nov 10 '22 00:11

Susa