cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution
Highlighted
Helper III
Helper III

cPanel Business Hosting & Python

Hi Everyone,

 

Question:  Is Python installed by default in cPanel Business Hosting?

 

I'm a SSH access & Python newbie and don't see anything in the /bin folder when connected via SSH so am assuming Python is not installed?

 

S3cmd Tool

https://s3tools.org/s3cmd

What I'm trying to do is install S3cmd tool so I can connect to Amazon S3 and upload some MySQL backup files via a cron job & script on a regular schedule.  For the S3cmd tool to install & run it needs Python to be present inside of cPanel.

 

How to Guide

  1. Can Python be installed on cPanel Business Hosting if it isn't pre-installed?
  2. Can you tell me the commands via SSH to install Python?

Thanks for explaining to a SSH & Python newbie but otherwise experienced coder.

 

Aly

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User III
Super User III
Solution

Re: cPanel Business Hosting & Python

@Aly 

 

Pretty much correct - 2.6 is what is installed but the AWS script actually needs 3.x 

 

As I said earlier - I believe you can only do this on a VPS as you actually need full root access to be able to install / map 3.x 

 

Once it was running it was great and allowed for scp and other commands but getting to that point was a royal pain



I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. Thank You Info If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community

View solution in original post

Highlighted
Helper III
Helper III
Solution

Re: cPanel Business Hosting & Python

Hi @PL281 ,

 

I figured out a solution that works with cPanel Business Hosting (shared hosting environment).

 

  1. Create a python virutal environment
  2. Install AWS CLI into this virtual environment (this allows the install to work in shared hosting)
  3. https://docs.aws.amazon.com/en_pv/cli/latest/userguide/install-virtualenv.html
  4. Run AWS by referencing the full virtual environment path (experience showed there was no need to "source activate" the virtual environment)
  5. Queue the shell backup script to run via a cron job

I'm using it to backup our MySQL databases and whatever file directories I need copied over to S3 on a regular basis.

 

Let me test this out some more then I'll write up the solution in more detail for the community. 

 

Interesting Notes: 

  • AWS CLI is working fine with Python 2.6.6 in the virtual environment.  It just gives a lack of TLS certification warning but otherwise runs.
  • In theory you could install the latest version of Python in the virtual environment and reference that to run AWS but Amazon's install method bundled Python 2.6.6 with their package so I left it alone.

 

Aly

View solution in original post

6 REPLIES 6
Highlighted
Super User III
Super User III

Re: cPanel Business Hosting & Python

@Aly 

 

I recently set this up on my VPS - I had to upgrade Python and it was about a 2hr + project as I had to get all the source files etc

 

If you are just on a cPanel server I don't believe you will be able to do what you are looking for



I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. Thank You Info If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community

Highlighted
Helper III
Helper III

Re: cPanel Business Hosting & Python

Hi @PL281 ,

 

Thanks for the reply and good information, much appreciated.

 

Python 2.7 does appear as shown in the 'top' processes (see screen shot below).

 

top-processes.PNG

 

Here are the paths returned on querying pythons location.

python: /usr/bin/python2.6 /usr/bin/python /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /opt/python35/bin/python3.5m-config /opt/python35/bin/python3.5 /opt/python35/bin/python3.5m /usr/share/man/man1/python.1.gz

However...

 

    • When I unzip the s3cmd-master.zip install file and copy the s3cmd files to a directory under my home folder /s3cmd/
    • Change directories in SSH to that folder /s3cmd/
    • Where /s3cmd/setup.py lives
    • Run the command line:  
      python setup.py install
    • Here's the error I receive
Using xml.etree.ElementTree for XML processing
running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 30] Read-only file system: '/usr/lib/python2.6/site-packages/test-easy-install-1017400.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/lib/python2.6/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  http://peak.telecommunity.com/EasyInstall.html

Please make the appropriate changes for your system and try again
  • I'm out of my depth on how to get around this problem.

Do you have any ideas?  Many thanks if you do.

 

Aly

Highlighted
Super User III
Super User III
Solution

Re: cPanel Business Hosting & Python

@Aly 

 

Pretty much correct - 2.6 is what is installed but the AWS script actually needs 3.x 

 

As I said earlier - I believe you can only do this on a VPS as you actually need full root access to be able to install / map 3.x 

 

Once it was running it was great and allowed for scp and other commands but getting to that point was a royal pain



I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. Thank You Info If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community

View solution in original post

Highlighted
Helper III
Helper III

Re: cPanel Business Hosting & Python

Hi @PL281 ,

 

Thanks for clarifying, I'll look for another way to do this.

 

Aly 🙂

Highlighted
Helper III
Helper III
Solution

Re: cPanel Business Hosting & Python

Hi @PL281 ,

 

I figured out a solution that works with cPanel Business Hosting (shared hosting environment).

 

  1. Create a python virutal environment
  2. Install AWS CLI into this virtual environment (this allows the install to work in shared hosting)
  3. https://docs.aws.amazon.com/en_pv/cli/latest/userguide/install-virtualenv.html
  4. Run AWS by referencing the full virtual environment path (experience showed there was no need to "source activate" the virtual environment)
  5. Queue the shell backup script to run via a cron job

I'm using it to backup our MySQL databases and whatever file directories I need copied over to S3 on a regular basis.

 

Let me test this out some more then I'll write up the solution in more detail for the community. 

 

Interesting Notes: 

  • AWS CLI is working fine with Python 2.6.6 in the virtual environment.  It just gives a lack of TLS certification warning but otherwise runs.
  • In theory you could install the latest version of Python in the virtual environment and reference that to run AWS but Amazon's install method bundled Python 2.6.6 with their package so I left it alone.

 

Aly

View solution in original post

Highlighted
Helper III
Helper III

Re: cPanel Business Hosting & Python