installing python modules that require gcc on shared hosting with no gcc or root access

2024/9/20 5:26:44

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

  • no root access
  • sudo doesnt work (sudo: effective uid is not 0, is sudo installed setuid root?)
  • no gcc

questions

  1. 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)

  2. 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?

  3. 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?

Answer

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.

  1. 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

  2. copy wheels to your hosting (I assume that you copy to /tmp/wheels)

  3. 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

https://en.xdnf.cn/q/72741.html

Related Q&A

Using libclang to parse in C++ in Python

After some research and a few questions, I ended up exploring libclang library in order to parse C++ source files in Python.Given a C++ source int fac(int n) {return (n>1) ? n∗fac(n−1) : 1; }for …

Python one class per module and packages

Im trying to structure my app in Python. Coming back from C#/Java background, I like the approach of one class per file. Id like my project tree to look like this:[Service][Database]DbClass1.pyDbClass2…

PyMySQL Access Denied using password (no) but using password

Headscratcher here for me.I am attempting to connect to a database on my local MySQL 8.0.11.0 install from Python.Heres the code Im using :conn = pymysql.connect(host=localhost, port=3306, user=root, p…

Trouble importing Python modules on Ninja IDE

I have been trying to import modules into Ninja IDE for python. These are modules that I have working on the terminal (numpy, scipy, scitools, matplotlib, and mpl_toolkits), but will not run correctly …

UTF-8 error with Python and gettext

I use UTF-8 in my editor, so all strings displayed here are UTF-8 in file.I have a python script like this:# -*- coding: utf-8 -*- ... parser = optparse.OptionParser(description=_(automates the dice ro…

Add build information in Jenkins using REST

Does anyone know how to add build information to an existing Jenkins build? What Im trying to do is replace the #1 build number with the actual full version number that the build represents. I can do …

Combining element-wise and matrix multiplication with multi-dimensional arrays in NumPy

I have two multidimensional NumPy arrays, A and B, with A.shape = (K, d, N) and B.shape = (K, N, d). I would like to perform an element-wise operation over axis 0 (K), with that operation being matrix …

Target array shape different to expected output using Tensorflow

Im trying to make a CNN (still a beginner). When trying to fit the model I am getting this error:ValueError: A target array with shape (10000, 10) was passed for output of shape (None, 6, 6, 10) while …

Using openpyxl to refresh pivot tables in Excle

I have a file that has several tabs that have pivot tables that are based on one data tab. I am able to write the data to the data tab without issue, but I cant figure out how to get all of the tabs wi…

python: is there a library function for chunking an input stream?

I want to chunk an input stream for batch processing. Given an input list or generator,x_in = [1, 2, 3, 4, 5, 6 ...]I want a function that will return chunks of that input. Say, if chunk_size=4, then,x…