375

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:

Alex Waygood
  • 6,304
  • 3
  • 24
  • 46
mik.ro
  • 4,381
  • 2
  • 18
  • 23

14 Answers14

685

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
    
vahid abdi
  • 9,636
  • 4
  • 29
  • 35
  • 21
    I like the methods of installing [build-essential](http://packages.ubuntu.com/precise/build-essential), which contains gcc, g++, make, etc. –  Jul 09 '14 at 20:06
  • 3
    Is there an alternative for zypper? – Almino Melo Apr 29 '15 at 17:39
  • 1
    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 IMO – blamb Dec 22 '16 at 03:51
  • 2
    Actually it's yum groupinstall "Development *T*ools" in CentOS 7 – Francesco Gualazzi Jan 30 '17 at 14:35
  • 5
    How would you determine if its installed but not in your $PATH variable? – JMess May 30 '17 at 21:25
  • hi there, do we have a Windows 10 equivalent? – Franva Aug 27 '19 at 06:15
  • 1
    I'm getting the same error, I have linux centos 6.5, please advise what to do.. – Suresh Jun 22 '20 at 15:18
  • ```sudo apt-get install build-essential``` worked for me – zahra shahrouzi Feb 27 '21 at 11:22
  • https://github.com/pyenv/pyenv-installer https://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-dev – X.C. Jun 29 '23 at 07:32
112

You need to run

yum install gcc
Alex Waygood
  • 6,304
  • 3
  • 24
  • 46
mlowton
  • 1,120
  • 1
  • 7
  • 4
91

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.

Alex Waygood
  • 6,304
  • 3
  • 24
  • 46
Lakshmikandan
  • 4,301
  • 3
  • 28
  • 37
79

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

sudo apt-get install build-essential
Alex Waygood
  • 6,304
  • 3
  • 24
  • 46
Tom Swifty
  • 2,864
  • 2
  • 16
  • 25
  • 1
    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 : is not in the sudoers file. This incident will be reported. – mik.ro Nov 06 '13 at 15:46
  • 1
    which distro are you using? – vahid abdi Nov 06 '13 at 15:50
  • @mik.ro what OS/distribution are you running. Are you logged in as root by any chance? – Tom Swifty Nov 06 '13 at 16:00
  • i'm using hostgator, it's on CentOS x86. – mik.ro Nov 06 '13 at 16:28
  • @TomSwifty I got the mentioned message every time I want to login as a root. I'm gonna contact hostgator to clarify it. – mik.ro Nov 06 '13 at 16:40
  • 1
    Ok, i've checked hostgator website and the solution is very simple and sad: they don't allow gcc on their shared servers [link](http://support.hostgator.com/articles/pre-sales-questions/compatible-technologies) If anyone has an idea, how can I install another python distribution on their shared hosting I'll appreciate it. – mik.ro Nov 06 '13 at 16:52
  • Great answer, fixed my problem, – Cornelis Nov 07 '21 at 14:25
25

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.

Alex Waygood
  • 6,304
  • 3
  • 24
  • 46
Mbigha Siggi
  • 391
  • 3
  • 4
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
Alex Waygood
  • 6,304
  • 3
  • 24
  • 46
blamb
  • 4,220
  • 4
  • 32
  • 50
  • 15
    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 $PATH** – Tony Chou Feb 09 '18 at 18:47
  • 1
    I got "configure: error: no acceptable C compiler found in $PATH" when executed $PWD... Is there a known solution??? – Terry Dec 22 '18 at 13:19
  • 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. – Ashitakalax Jan 10 '21 at 21:26
  • 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 .... – Rookie Aug 04 '22 at 21:34
15

If you are using alphine with docker, do this:

apk --update add gcc make g++ zlib-dev
Sahith Vibudhi
  • 4,935
  • 2
  • 32
  • 34
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.

Alex Waygood
  • 6,304
  • 3
  • 24
  • 46
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.

wdh
  • 1,612
  • 12
  • 16
9

Run apt-get install gcc in Suse Linux.

Alex Waygood
  • 6,304
  • 3
  • 24
  • 46
Black
  • 18,150
  • 39
  • 158
  • 271
7

On Arch Linux run the following:

sudo pacman -S base-devel

Timo Giese
  • 55
  • 9
user6735634
  • 79
  • 1
  • 1
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.

Apex
  • 206
  • 2
  • 5
2

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

MD Mushfirat Mohaimin
  • 1,966
  • 3
  • 10
  • 22
Arash Foroughi
  • 139
  • 2
  • 6
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.

ganjim
  • 1,234
  • 1
  • 16
  • 30
Dan
  • 21
  • 1