Installing Python modules on Hostgator shared hosting using VirtualEnv

Connect to SSH, create a new directory and in it:

> wget --no-check-certificate

> tar xzf virtualenv-1.11.6.tar.gz
> rm virtualenv-1.11.6.tar.gz

> python virtualenv-1.11.6/ /home1/yourusername/public_html/ --no-site-package

Test new Python environement:

> which python

Activate Virtual Environment:

> source env/bin/activate

Test new Python environement:

> which python

Run pip, not the server’s pip,but the new pip that VirtualEnv just installed. Trying installing a package,for example Python Requests:

> bin/pip install requests

Downloading/unpacking requests
Downloading requests-2.4.0-py2.py3-none-any.whl (457kB): 457kB downloaded
Downloading/unpacking certifi (from requests)
Downloading certifi-14.05.14.tar.gz (168kB): 168kB downloaded
Installing collected packages: requests, certifi
Running install for certifi
Successfully installed requests certifi
Cleaning up...

Test in python:

> Python

>> import requests

If no error message then it works.

Then you can deactivate VirtualEnv:

> Deactivate

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>