Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install python packages on shared host

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?

like image 232
Shmwel Avatar asked May 02 '14 13:05

Shmwel


People also ask

Can I install Python on shared hosting?

Our Shared Hosting packages do not support Python. However, you can use it on a VPS.

Do I need admin rights to install Python packages?

To install Python packages (“eggs”) from the Python language's package manager pip, follow our instructions below. This can be done without Administrator access in a per-user, per-project clean manner with virtualenv.


2 Answers

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

like image 152
ezChx Avatar answered Oct 18 '22 09:10

ezChx


Though this is an old question, I bumped into the same problem.

You normally can not install packages for Python easily. There is however a nice solution. Virtualenv creates a local instance of Python, and after installing virtualenv, you can install packages locally in your account.

like image 30
jcoppens Avatar answered Oct 18 '22 09:10

jcoppens