No acceptable C compiler found in $PATH when installing python
Asked Answered
D

14

403

I'm trying to install a new Python environment on my shared hosting. I follow the steps written in this post:

mkdir ~/src
wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
tar -zxvf Python-2.7.1.tar.gz
cd Python-2.7.1
mkdir ~/.localpython
./configure --prefix=/home/<user>/.localpython
make
make install

After coming to the ./configure --prefix=/home/<user>/.localpython command, I get the following output:

checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... linux3
checking EXTRAPLATDIR... 
checking machine type as reported by uname -m... x86_64
checking for --without-gcc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home3/mikos89/Python-2.7.1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

How can this problem be solved? I've been trying to find a solution for 3 hours, but I'm still stuck in one place.

UPDATE

Hostgator does not allow gcc on their shared accounts:

Daviddavida answered 6/11, 2013 at 15:38 Comment(2)
exactly same issueOcean
You should try to find prebuild binaries for your system. It's the easiest way if you don't have root access.Eindhoven
I
721

The gcc compiler is not in your $PATH. It means either you dont have gcc installed or it's not in your $PATH variable.

To install gcc use this: (run as root)

  • Redhat base:

     yum groupinstall "Development Tools"
    
  • Debian base:

     apt-get install build-essential
    
  • openSUSE base:

     zypper install --type pattern devel_basis
    
  • Alpine:

     apk add build-base
    
Ima answered 6/11, 2013 at 15:54 Comment(9)
I like the methods of installing build-essential, which contains gcc, g++, make, etc.Inkling
Is there an alternative for zypper?Toluca
this is shared hosting, how is this even an accepted solution? we need python, in come cases for node, which is also going in as user level, no root. this is a deal breaker for all this, needing root. this is supposed to be a non root procedure IMOOcean
Actually it's yum groupinstall "Development Tools" in CentOS 7Daph
How would you determine if its installed but not in your $PATH variable?Bisulfate
hi there, do we have a Windows 10 equivalent?Ruffina
I'm getting the same error, I have linux centos 6.5, please advise what to do..Remise
sudo apt-get install build-essential worked for meKashmir
github.com/pyenv/pyenv-installer github.com/pyenv/pyenv/wiki#suggested-build-environment For Ubuntu Users: sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \ libbz2-dev libreadline-dev libsqlite3-dev curl \ libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-devCampbell
D
116

You need to run

yum install gcc
Decompensation answered 23/4, 2014 at 16:40 Comment(7)
Worked on CentOS 7. ThanksEconometrics
Worked on Debian 4.9. ThanksCrossman
Worked on CentOS 8. ThanksRoswald
I'm getting the error "Error accessing file for config file:///etc/yum.conf". I have Bluehost shared hosting.Photoactive
Hey @PaulChrisJones, I ran into same problem when I tried installing gcc in my blueshot hosting acc using ssh. I ran into this because my configure file woud not run. If you managed to find a solution please let me know. It would be of great help !Bevon
Worked on AlmaLinux OS 8View
Worked on Rocky Linux 8 ($ dnf install gcc)Boothman
N
94

For Ubuntu / Debian :

sudo apt-get install build-essential

For RHEL/CentOS

sudo yum install gcc glibc glibc-common gd gd-devel -y

or

 sudo yum groupinstall "Development tools" -y

For more details, refer to this link.

Nought answered 6/7, 2015 at 12:51 Comment(0)
N
81

Assuming you're on a debain/ubuntu system, you will need to run the following first:

sudo apt-get install build-essential
Neuroma answered 6/11, 2013 at 15:42 Comment(7)
I got this response after typing your code: sudo: unable to mkdir /var/db/sudo: No such file or directory We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for <usrname>: <usrname> is not in the sudoers file. This incident will be reported.Daviddavida
which distro are you using?Ima
@Daviddavida what OS/distribution are you running. Are you logged in as root by any chance?Neuroma
i'm using hostgator, it's on CentOS x86.Daviddavida
@TomSwifty I got the mentioned message every time I want to login as a root. I'm gonna contact hostgator to clarify it.Daviddavida
Ok, i've checked hostgator website and the solution is very simple and sad: they don't allow gcc on their shared servers link If anyone has an idea, how can I install another python distribution on their shared hosting I'll appreciate it.Daviddavida
Great answer, fixed my problem,Dioxide
L
26

sudo apt install build-essential is the command.

However, if you get the "the package can be found" kind of error, run

  • sudo apt update first
  • then sudo apt install build-essential

This worked for me.

Ledbetter answered 16/1, 2020 at 20:27 Comment(2)
Worked for me on Ubuntu 18.04Jamille
worked for me, don't forget to sudo apt update . Always a good idea indeed.Crumbly
O
18

You would need to install it as non-root, since it's shared hosting. Here is a tutorial that goes through how to do this step.

cd ~/src
wget http://www.netgull.com/gcc/releases/gcc-5.2.0/gcc-5.2.0.tar.gz

or equivalent gcc source, then

tar -xvf gcc-5.2.0.tar.gz
cd gcc-5.2.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-5.2.0/configure --prefix=$HOME/gcc-5.2.0 --enable-languages=c,c++,fortran,go
make
make install

Then add to .bashrc, or equivalent:

export PATH=~/gcc-5.2.0/bin:$PATH
export LD_LIBRARY_PATH=~/gcc-5.2.0/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=~/gcc-5.2.0/lib64:$LD_LIBRARY_PATH
Ocean answered 22/12, 2016 at 3:54 Comment(4)
when execute $PWD/../gcc-5.2.0/configure --prefix=$HOME/gcc-5.2.0 --enable-languages=c,c++,fortran,go still result the same error configure: error: no acceptable C compiler found in $PATHBost
I got "configure: error: no acceptable C compiler found in $PATH" when executed $PWD... Is there a known solution???Misunderstood
I had a similar issue when using Bluehost's hosting services. I had to call support to request to be added to their compiler group(which they have an example for enabling python). After they granted it, I was able to call make, which is currently still compiling after an hour.Hughey
I'm on a NAS drive. I don't have access to apt, yum or even dpkg. How can I install this file on a folder already pre-compiled so to speak. I believe the poster is describing compiling the application but unfortunately I can't compile the C compiler without a C compiler ....Intoxication
A
16

If you are using alphine with docker, do this:

apk --update add gcc make g++ zlib-dev
Antisemite answered 27/6, 2018 at 15:6 Comment(1)
apk add --no-cache git autoconf automake gawk build-baseWhitlow
S
13

Issue:

configure: error: no acceptable C compiler found in $PATH

I fixed the issue by executing the following command:

yum install gcc

to install gcc.

Saliva answered 4/7, 2020 at 8:3 Comment(0)
Q
9

Get someone with access to the root account on that server to run sudo apt-get install build-essential. If you don't know who has root access, contact the support team for your shared hosting and ask them.

Edit: If you aren't allowed access to root, you aren't ever going to get it working. You'll have to change hosting provider I'm afraid.

Queenie answered 6/11, 2013 at 15:54 Comment(0)
I
9

Run apt-get install gcc in Suse Linux.

Issi answered 10/7, 2018 at 14:5 Comment(1)
should be: sudo zypper install gcc for Suse LinuxTouraine
T
7

On Arch Linux run the following:

sudo pacman -S base-devel

Tom answered 19/8, 2016 at 15:39 Comment(1)
Thanks, this solved my issue. With no additional setup.Waybill
K
4

For Ubuntu/Debian, run

sudo apt update

sudo apt install -y build-essential

Remember to add the flag -y to accept to continue by default.

Kielce answered 30/6, 2021 at 16:14 Comment(0)
M
2

You need just to install build-essential on Debian-family and Development tools on RedHat-family.

Middlebreaker answered 4/8, 2021 at 5:40 Comment(0)
S
2

In a shared hosting, gcc compiler is disabled by default (in a terminal write gcc --version and it must return 'Permission denied' if installed...). It's very important to the next step.

Now, contact the support team and request to add your user id to 'compiler group'. This solves your problem and other - for example, you will be able to execute 'make' and 'make install' without problems, install the pillow library, etc.

Forget about 'sudo' or 'apk' commands. They are also disabled by default.

Summer answered 8/2, 2022 at 17:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.