Search code examples
pythonvirtualenvuwsgisudo

How do I link an extracted python-dev config to a virtualenv python installation?


I am trying to install a python project on a server where I don't have root access. I've managed to install virtualenv and pip locally, but the pip install is now failing when trying to install uwsgi (specifically trying to build wheel) with several error: Python.h: No such file or directory errors.

From what I've gathered I need to install python-dev, but as I don't have sudo access I've had to download and extract the python-dev package.

Where I'm stuck now is how to link python-dev to the python I've installed in my virtualenv.

Server details:

$ uname -a
4.9.0-12-amd64 #1 SMP Debian 4.9.210-1 (2020-01-20) x86_64 GNU/Linux
$ python --version
Python 3.5.3

Solution

  • First, could you ask your admin for help?

    OK, let's summarize: python.h: No such file or directory looks like the C compiler could not find the necessary header files. Those files are contained in the python-dev package, but you are not permitted to install it. You have downloaded the package and extracted its files somewhere.

    Now you should set the xx_PATH environment variables that gcc uses to find additional library and header files locations, see the docs and the example here for details and try the installation again.

    Anyway this fixes only the first compilation error.