48

I am trying to install something in my virtual environment, which uses Anaconda Python 3.6. I get the gcc failed with exit status 1, hinting on the absence of the right python3-devel package, as described in Error message "error: command 'gcc' failed with exit status 1" while installing eventlet.

To fix the error, I tried to install the python3-devel package on my server running RHEL 7.3.

I did yum install python3-devel, but got a 'package not found' error. Then I found Is there a repository for python3-devel on CentOS 7?, which hints to the python34-devel package in the EPEL repository. I installed it using YUM, but upon trying to install something in my virtual environment, I still get the gcc failed with exit status 1 error.

How can I fix this?

5
  • "gcc failed with exit status 1" is the symptom, not the cause. Commented Mar 27, 2017 at 13:07
  • Hey, thanks for your reply. As I describe in my post, I believe the cause to be the absence of the python3-devel package. Commented Mar 27, 2017 at 13:22
  • Okay, but nothing in the question backs that up. Commented Mar 27, 2017 at 13:23
  • True, added my source. Commented Mar 27, 2017 at 13:27
  • 3
    As a sidenote, I would recommend Red Hat Software Collections for installing Python3 instead of EPEL -- you get official support with that. See access.redhat.com/solutions/472793 Commented Mar 27, 2017 at 18:24

3 Answers 3

127

Search for the package in yum. Use the following command:

yum search python3 | grep devel

It will list all the available development packages (as in including C header files, etc., not a pre-alpha version). The result will be somewhat like this

python3-cairo-devel.x86_64 : Libraries and headers for python3-cairo
python3-devel.x86_64 : Libraries and header files needed for Python 3
                     : development
python34-devel.x86_64 : Libraries and header files needed for Python 3
                      : development

Then you can choose the package you want to install from the list. Suppose if you want to to install python3-devel, execute the following:

yum install -y python3-devel.x86_64
Sign up to request clarification or add additional context in comments.

4 Comments

# yum search python3 // Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager // Warning: No matches found for: python3 No matches found -- couldn't find it on my system
I want to give you 2 points but SO won't let me ... thanks man ... this is BY FAR the most straight forward answer
The above did not work for me, probably because I did not have repositories setup, so I found this here which worked:draculaservers.com/tutorials/install-python-3-centos-7 Or just this---------------------------------------- sudo yum install centos-release-scl sudo yum install rh-python36 scl enable rh-python36 bash python --version
Which repo is python3-devel found? I have base, extras, epel and ius configured and it is not found. Pip search can't find it. I can only seem to find it on rpmfind.net and that is a source rpm.
14

For 2020: As of RHEL 7.7, python-devel is not available in EPEL. It has been retired by the Fedora Project. All I wanted for today was the Python .h files, and this got me there. As root:

yum install python3-devel.x86_64 --enablerepo=rhel-7-server-optional-rpms

We do have one of the Redhat No-Cost Developer licenses, but I am not sure that is required for the optional-rpms package.

PS: This was helpful in verifying which packages of interest were in optional-rpms (as root)

yum repo-pkgs rhel-7-server-optional-rpms list | grep python3

Comments

13

There aren't any python3-* packages from Red Hat in Red Hat Enterprise Linux (RHEL) 6 or 7.

However, there are python3-* packages available if you enable third-party repositories, like EPEL (Extra Packages for Enterprise Linux) or IUS (Inline with Upstream Stable). But, these are not supported by Red Hat. Chances are if you are running RHEL, your organization has a preference for supported packages.

You can get supported Python 3 packages from Red Hat via Red Hat Software Collections (RHSCL). Currently Python 3.6 is the newest available, the package name is rh-python36. Installing the RHSCL package will also install rh-python36-devel and a number of other packages.

See How to install Python 3, pip, venv, virtualenv, and pipenv on RHEL

Don't forget to install @development first, so you have gcc, make, etc. for building any dynamically loaded shared objects.

To install:

su -
subscription-manager repos --enable rhel-7-server-optional-rpms \
  --enable rhel-server-rhscl-7-rpms
yum -y install @development
yum -y install rh-python36

yum -y install rh-python36-numpy \
 rh-python36-scipy \
 rh-python36-python-tools \
 rh-python36-python-six

exit

The blog linked above has lots of tips for working with Python, virtual environments, as well as software collections on Red Hat.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.