Could not build wheels for pycuda - python

Receiving an error during pip pycuda installation on ubuntu as follows:
command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycuda
Failed to build pycuda
ERROR: Could not build wheels for pycuda, which is required to install pyproject.toml-based projects

I solved the problem by doing:
For Python 2.x use:
sudo apt-get install python-dev
For Python 2.7 use:
sudo apt-get install libffi-dev
For Python 3.x use:
sudo apt-get install python3-dev
or for a specific version of Python 3, replace x with the minor version in
sudo apt-get install python3.x-dev

Related

cytoolz/dicttoolz.c:19:10: fatal error: Python.h: No such file or directory

cytoolz/dicttoolz.c:19:10: fatal error: Python.h: No such file or directory
19 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for cytoolz
I'm using this:
(venv) root#x-System-Product-Name:~# pypy3 --version
Python 3.6.9 (7.3.1+dfsg-4, Apr 22 2020, 05:15:29)
[PyPy 7.3.1 with GCC 9.3.0]
I had problems with web3 installation, was able to solve up to the point of packages lru-dict, bitarray, and cytoolz. Those are the showstoppers...
I tried those solutions from the Internet, they didn't work for me:
pip3 install wheel
sudo apt-get install python-dev
sudo apt-get install python3-dev
sudo apt-get install libevent-dev
sudo apt-get install libblas-dev libatlas-base-dev
python -m venv --upgrade ./venv
sudo apt-get install python3-dev
sudo apt install libpython3.x-dev
dpkg --add-architecture i386
apt-get update
apt-get install libssl-dev:i386
sudo apt-get install openssl libssl-dev
pip3 install --upgrade pip
sudo apt-get install libpcap-dev libpq-dev
The error persists, in the same form, with the exact same packages.
I also tried installing from manually downloaded files, still the same 'failed building wheel' error.
Tried installing GCC, and some other random ideas were tried and failed.
It was solved in my case by installing the appropriate python3-dev package corresponding to the python version in my virtualenv:
sudo apt install python3.10-dev
I find this cleaner than messing with python.h files.
You need the version of Python.h and associated files for PyPy, not the one from CPython. That's usually in a package called something like pypy3-dev.
Migrating OP's solution from the question to an answer:
This tutorial worked:
https://blog.ducthinh.net/gcc-no-such-file-python-h/
However, still the installation needs work done on it - I'm getting
this error about cytoolz package (which is I decided to not mark this
solved).
ImportError: /usr/local/lib/pypy3.6/dist-packages/cytoolz/itertoolz.pypy36-pp73-x86_64-linux-gnu.so:
undefined symbol: PyExc_SystemError

I'm trying to download pygame but it keeps coming up with the same error (error: command 'gcc' failed with exit status 1)? [duplicate]

I wanted to install eventlet on my system in order to have "Herd" for software deployment.. but the terminal is showing a gcc error:
root#agrover-OptiPlex-780:~# easy_install -U eventlet
Searching for eventlet
Reading http://pypi.python.org/simple/eventlet/
Reading http://wiki.secondlife.com/wiki/Eventlet
Reading http://eventlet.net
Best match: eventlet 0.9.16
Processing eventlet-0.9.16-py2.7.egg
eventlet 0.9.16 is already the active version in easy-install.pth
Using /usr/local/lib/python2.7/dist-packages/eventlet-0.9.16-py2.7.egg
Processing dependencies for eventlet
Searching for greenlet>=0.3
Reading http://pypi.python.org/simple/greenlet/
Reading https://github.com/python-greenlet/greenlet
Reading http://bitbucket.org/ambroff/greenlet
Best match: greenlet 0.3.4
Downloading http://pypi.python.org/packages/source/g/greenlet/greenlet- 0.3.4.zip#md5=530a69acebbb0d66eb5abd83523d8272
Processing greenlet-0.3.4.zip
Writing /tmp/easy_install-_aeHYm/greenlet-0.3.4/setup.cfg
Running greenlet-0.3.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-_aeHYm/greenlet-0.3.4/egg-dist-tmp-t9_gbW
In file included from greenlet.c:5:0:
greenlet.h:8:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1`
Why can't Python.h be found?
Your install is failing because you don't have the python development headers installed. You can do this through apt on ubuntu/debian with:
sudo apt-get install python-dev
for python3 use:
sudo apt-get install python3-dev
For eventlet you might also need the libevent libraries installed so if you get an error talking about that you can install libevent with:
sudo apt-get install libevent-dev
For Fedora:
sudo yum install python-devel
sudo yum install libevent-devel
and finally:
sudo easy_install gevent
What worked for me on CentOS was:
sudo yum -y install gcc
sudo yum install python-devel
For Redhat Versions(Centos 7) Use the below command to install Python Development Package
Python 2.7
sudo yum install python-dev
Python 3.4
sudo yum install python34-devel
Python 3.6
sudo yum install python36-devel
If the issue is still not resolved then try installing the below packages -
sudo yum install python-devel
sudo yum install openssl-devel
sudo yum install libffi-devel
On MacOS I had trouble installing fbprophet which requires pystan which requires gcc to compile. I would consistently get the same error: command 'gcc' failed with exit status 1
I think I fixed the problem for myself thus:
I used brew install gcc to install the newest version, which ended up being gcc-8
Then I made sure that when gcc ran it would use gcc-8 instead.
It either worked because I added alias gcc='gcc-8 in my .zshrc (same as .bashrc but for zsh), or because I ran export PATH=/usr/local/bin:$PATH (see comment)
Also: all my attempts were inside a virtual environment and I only succeeded by installing fbprophet globally (with pip), but still no success inside a venv
This is an old post but I just run to the same problem on AWS EC2 installing regex. This working perfectly for me
sudo yum -y install gcc
and next
sudo yum -y install gcc-c++
If it is still not working, you can try this
sudo apt-get install build-essential
in my case, it solved the problem.
try this :
sudo apt-get install libblas-dev libatlas-base-dev
I had a similar issue on Ubuntu 14.04. For me the following Ubuntu packages
On MacOS I also had problems trying to install fbprophet which had gcc as one of its dependencies.
After trying several steps as recommended by #Boris the command below from the Facebook Prophet project page worked for me in the end.
conda install -c conda-forge fbprophet
It installed all the needed dependencies for fbprophet. Make sure you have anaconda installed.
This page is gonna save your life, for all further lib issues that are forthcoming,
For Alpine(>=3.6), use
apk --update --upgrade add gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev
For CentOS 7.2:
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Codename: Core
Install eventlet:
sudo yum install python-devel
sudo easy_install -ZU eventlet
Terminal info:
[root#localhost ~]# easy_install -ZU eventlet
Searching for eventlet
Reading http://pypi.python.org/simple/eventlet/
Best match: eventlet 0.19.0
Downloading https://pypi.python.org/packages/5a/e8/ac80f330a80c18113df0f4f872fb741974ad2179f8c2a5e3e45f40214cef/eventlet-0.19.0.tar.gz#md5=fde857181347d5b7b921541367a99204
Processing eventlet-0.19.0.tar.gz
Running eventlet-0.19.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Hh9GQY/eventlet-0.19.0/egg-dist-tmp-rBFoAx
Adding eventlet 0.19.0 to easy-install.pth file
Installed /usr/lib/python2.6/site-packages/eventlet-0.19.0-py2.6.egg
Processing dependencies for eventlet
Finished processing dependencies for eventlet
For openSUSE 42.1 Leap Linux use this
sudo zypper install python3-devel
I am using MacOS catalina 10.15.4. None of the posted solutions worked for me. What worked for me is:
>> xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
>> env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2==2.8.4
Collecting psycopg2==2.8.4
Using cached psycopg2-2.8.4.tar.gz (377 kB)
Installing collected packages: psycopg2
Attempting uninstall: psycopg2
Found existing installation: psycopg2 2.7.7
Uninstalling psycopg2-2.7.7:
Successfully uninstalled psycopg2-2.7.7
Running setup.py install for psycopg2 ... done
Successfully installed psycopg2-2.8.4
use pip3 for python3
if you are on Mac as myself, try this in your terminal: xcode-select --install
Then accept the installation request, and it works afterwards as described in this issue
Build from source and install, this is fixed in the latest release (10.3+):
mkdir -p /tmp/install/netifaces/
cd /tmp/install/netifaces && wget -O "netifaces-0.10.4.tar.gz" "https://pypi.python.org/packages/source/n/netifaces/netifaces-0.10.4.tar.gz#md5=36da76e2cfadd24cc7510c2c0012eb1e"
tar xvzf netifaces-0.10.4.tar.gz
cd netifaces-0.10.4 && python setup.py install
Similarly I fixed it like this (notice python34):
sudo yum install python34-devel
sudo apt install gcc
It works for PyCharm on Ubuntu 20.10.
If you are migrating to a more modern version of python3 e.g. python3.5 to python3.8 You may want to check/upgrade the versions of the library that are failing if you have already installed the recommended libraries to handle gcc building python3-dev + other libraries as suggested.
It depends on the package. Some versions of the packages may not be supported on later versions of python3.

Python failed building wheel for dlib Ubuntu

I am attempting to install dlib to my python virtual environment.
There is a very similar problem here and I followed the exact steps to no avail.
Somehow I am able to import dlib when running code and I managed to do that by git cloning git clone -b pybind11 https://github.com/supervacuus/dlib.git.
But when I attempt to install it pip3 install dlib or a library that depends on it such as pip3 install face_recognition I get errors stating that ERROR: Failed building wheel for dlib
Full execution logs and error here https://gist.github.com/GhettoBurger996/1e6a423b88b7435c8759255e19fa5e60
I am using 3.5.2 and Ubuntu 16.04
Question is a bit old but I ran into a similar problem where installing dlib using pip3 would fail.
Installing the following dependencies fixed it for me:
$ sudo apt-get install build-essential cmake
$ sudo apt-get install libgtk-3-dev
$ sudo apt-get install libboost-all-dev
From the posted error logs it seems that you had cmake installed already so the first line might not be necessary for you.

Python - Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-21ft0H/pandas

I'm using Centos 7 and Python 2.7.5. The problem is when I install Pandas, i got this error message
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-21ft0H/pandas
I already tried a lot of solutions but no success even yum -y update.
Can't install via pip because of egg_info error
Python pip install fails: invalid command egg_info
https://www.digitalocean.com/community/tutorials/how-to-set-up-python-2-7-6-and-3-3-3-on-centos-6-4
pip fails to install anything, error: invalid command 'egg_info'
Distribute has been merged into Setuptools as of version 0.7. If you are using a version <=0.6, upgrade using pip install --upgrade setuptools or easy_install -U setuptools.
I already found the answer. I need to install python via RPM.
rpm -i ftp://195.220.108.108/linux/centos/7.1.1503/updates/x86_64/Packages/python-2.7.5-18.el7_1.1.x86_64.rpm
Reference: http://blog.revivalx.com/2015/11/14/python-command-python-setup-py-egg_info-failed-with-error-code-1-tmppip-build-21ft0hpandas/
In my case for continuos integration work:
before_script:
- apk update && apk add python3-dev
- apk add --no-cache python3-dev libstdc++
- apk add --update curl gcc g++
- ln -s /usr/include/locale.h /usr/include/xlocale.h
- pip3 install numpy
- pip3 install pandas
- rm -rf /var/cache/apk/*
- python -V
- python -m pip install --upgrade pip
- python -m pip install --upgrade pip setuptools wheel --user --no-cache-dir
pip install -- upgrade pip python -m pip install pandas
following link solved my problem
https://googleapis/google-cloud-python#3884
You should try pip install --upgrade setuptools.
sudo apt-get install python-matplotlib
i used this when i got similar error during matplotlib install
simply execute this command :
sudo apt-get install python3.6-dev libmysqlclient-dev
I got this error while installing mysqlclient from pip3
So I executed command :
sudo apt-get install python3.6-dev libmysqlclient-dev
After executing this command i was able to install mysqlclient successfully
Note:- Version Number 3.6 is to be replaced by your python version

Installing Pillow error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

While i try to install Pillow 2.5.3
I am getting an error : command 'x86_64-linux-gnu-gcc' failed with exit status 1
Here is the complete log of what happened
I need this library as a part of another python project.
I have gone through many solutions but none helped me
You are missing Python headers. Install python-dev from your distribution's package manager.
Equally for python 3. Install python3-dev, example:
sudo apt-get install python3-dev
I have tried python-dev package but not worked for me.
Then i have tried below code work like charm
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
If you are running python 3.6 the use this command
sudo apt-get install python3.6-dev

Categories

Resources