Install python packages on shared host

Shmwel picture Shmwel · May 2, 2014 · Viewed 7.2k times · Source

I would like to know if it is possible to install (without using shell - I don't have any permissions to use command line) python packages on a shared host. (Do not ask to change host provider)

Also, on that host is installed Python and Django and I would like to install : https://pypi.python.org/pypi/xlwt on server.

Is that possible?

Answer

ezChx picture ezChx · Jan 27, 2017

I don't think it is possible without SSH. For what it's worth, I have GoDaddy deluxe shared hosting on Linux and I was able to install Python as follows:

Set up a new directory in /home/"your username":

mkdir ~/python27
cd ~/python27

Download and unpack Python files:

wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tar -xzvf Python-2.7.12.tgz
find ~/python27 -type d -exec chmod 755 {} \;
cd Python-2.7.12

Configure and install Python:

./configure --prefix=$HOME/python27
make
make install

Update your default Python path by modifying your bash_profile file:

vi ~/.bash_profile

Add these lines to bash_profile:

# Python 2.7
export PATH="$HOME/python27/bin:$PATH"

Confirm that the changes took place:

python -V #old version
source ~/.bashrc
python -V #new version

Install easy_setup:

wget https://bootstrap.pypa.io/ez_setup.py
python ez_setup.py

Quit SSH, log in again, and install pip:

easy_install pip

You can now add libraries as required. You can access the new version in your python applications with:

#! /home/"your username"/python27/Python-2.7.12/python

The following links were all helpful, but I needed to combine various steps for it to work for me:

http://geeksta.net/geeklog/python-shared-hosting/

https://www.godaddy.com/garage/tech/config/how-to-install-and-configure-python-on-a-hosted-server/

https://gist.github.com/BigglesZX/1610950