I'm using Hostgator shared as a production environment and I had a problem installing some python modules, after using:
pip install MySQL-python
pip install pillow
results in:
unable to execute gcc: Permission denied error: command 'gcc' failed with exit status 1
server limitations
questions
is there an alternative package for pillow. I want this to use django ImageField. (just like pymysql is an equally capable alternative for mysql-python)
i have modules like mysql-python and pil installed in root, i.e. pip freeze without any virtualenv lists these modules. but i cannot install my other required modules in this root environment and in my virtualenv i cannot install mysql-python and pil. can something be done? can we import/use packages installed in root somehow in a virtualenv?
is hostgator shared only good for PHP and not for python/django webapps. we have limited traffic so we are using hostgator shared. should we avoid hostgator or shared hosting? aren't they good enough for python/django (i had no problems in hosting static/PHP sites ever). are they too many problems and limitations or performance issues (FCGI)? if yes, what are the alternatives?
Our Shared Hosting packages do not support Python. However, you can use it on a VPS.
One solution for this is to use executable method in sys package which will return the absolute path of the executable binary for Python against which we can run commands. We add ! (exclamation operator) in front for running it like a shell command from inside notebook, IDE or console.
You can try building wheels on some similar host where gcc is available, copy them to your server and install. But I do not know how much similar hosts should be.
on "similar" host with gcc:
mkdir /tmp/wheels
mkdir /tmp/pip-cache
pip wheel --download-cache /tmp/pip-cache -w /tmp/wheels -r requirements.pip
copy wheels to your hosting (I assume that you copy to /tmp/wheels
)
install from wheels ignoring index and using wheels dir:
pip install --download-cache /tmp/pip-cache --find-links=/tmp/wheels --no-index -r requirements-dev.pip
P.S. Maybe you should also copy download-cache to your hosting. I do not remember if this is needed. If this is not needed then you can skip option --download-cache /tmp/pip-cache
you can try to use PIL instead of Pillow (try it but I'm guessing you will probably run into the same compile problem)
when you setup your virtualenv, you can pass it a --system-site-packages flag. See here
there are definitely a lot of alternative services out there- heroku, digital ocean, webfaction etc. Quick plug for PythonAnywhere (I work here)-- we are a PAAS specifically geared towards python frameworks such as Django and come with PIL, mysql-python, and many other python packages preinstalled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With