431

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?

Hostgator does not allow gcc on their shared accounts:

2
  • 1
    exactly same issue Commented Dec 22, 2016 at 3:21
  • 2
    You should try to find prebuild binaries for your system. It's the easiest way if you don't have root access. Commented May 15, 2020 at 1:47

15 Answers 15

761

The gcc compiler is not in your $PATH. It means either you don't 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
    
Sign up to request clarification or add additional context in comments.

9 Comments

I like the methods of installing build-essential, which contains gcc, g++, make, etc.
Is there an alternative for zypper?
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
Actually it's yum groupinstall "Development Tools" in CentOS 7
How would you determine if its installed but not in your $PATH variable?
|
120

You need to run

yum install gcc

4 Comments

I'm getting the error "Error accessing file for config file:///etc/yum.conf". I have Bluehost shared hosting.
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 !
Worked on AlmaLinux OS 8
Worked on Rocky Linux 8 ($ dnf install gcc)
103

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.

Comments

87

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

sudo apt-get install build-essential

7 Comments

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.
which distro are you using?
@mik.ro what OS/distribution are you running. Are you logged in as root by any chance?
i'm using hostgator, it's on CentOS x86.
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.
|
27

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

2 Comments

Worked for me on Ubuntu 18.04
worked for me, don't forget to sudo apt update . Always a good idea indeed.
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

4 Comments

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
I got "configure: error: no acceptable C compiler found in $PATH" when executed $PWD... Is there a known solution???
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.
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 ....
16

If you are using alphine with docker, do this:

apk --update add gcc make g++ zlib-dev

1 Comment

apk add --no-cache git autoconf automake gawk build-base
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.

Comments

11

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.

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.

Comments

9

Run apt-get install gcc in Suse Linux.

1 Comment

should be: sudo zypper install gcc for Suse Linux
7

On Arch Linux run the following:

sudo pacman -S base-devel

Comments

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.

Comments

2

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

Comments

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.

Comments

0

This is a simple docker file that works

FROM python:3.11-slim

# Copy local code
ENV APP_HOME /app
RUN mkdir $APP_HOME

WORKDIR $APP_HOME

# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Set Flask environment variables
ENV FLASK_APP=main.py
ENV FLASK_ENV=development
ENV PORT 5001
ENV RUN CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1

# Install pip.
RUN pip install --upgrade pip

# Install other dependencies
RUN apt-get update && apt-get install -y \
build-essential 

RUN pip install llama-cpp-python

# Install from requirements.txt files
COPY ./requirements/dev.txt .
RUN pip install -r dev.txt

# copy entrypoint.sh
COPY ./entrypoint.sh .
RUN sed -i 's/\r$//g'  $APP_HOME/entrypoint.sh
RUN chmod +x  $APP_HOME/entrypoint.sh

# Copy project
COPY . .

# run entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]

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.