I'm using python on a Linux cluster (without root access) and want to use the numpy module. After downloading numpy from Numerical Python, extracting and trying to install it with:

python setup.py install --home=/home/"myusername"/"myfolder" 

(as I have successfully done with previous python modules), I get the error:

SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.

So to try and locally install python-dev, I downloaded the .deb from python2.7-dev_2.7.10-2_amd64.deb and extracted it in "myfolder" as described in http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/, however this did not solve the previous error and I cannot find any more relevant help.

I do not have access to apt-get or dpkg.

  • 1
    Have you tried asking the system administrator to install the packages you require? It seems to me it would be a more sensible way forward than trying to pick packages apart and install them in non-standard places – roaima Jun 12 '15 at 21:26
  • I would if it was easiest, however I'm using a few different clusters, most of them without much installed and am trying to make my own setup across them as consistent as possible. – Luce Jun 15 '15 at 20:57

You can download the source for python-2.7.10 from the python.org site. Once you extract .tar.xz archive you will find the Include directory that contains the missing missing header files.

You can tell python setup.py ... to look in this directory as well by setting

export CPLUS_INCLUDE_PATH=/path/to/your/extracted/Python-2.7.10/Include
| improve this answer | |
  • This worked, I just have to from now on make sure I'm using my python installation and not the system wide one. – Luce Jun 15 '15 at 21:18

I agree with the comment @roaima made; however, you can always use alien to convert the .deb to a .tgz and then untar it.

So, after making alien you'd use alien -tc package.deb.

| improve this answer | |
  • I can't use alien either. – Luce Jun 15 '15 at 20:55
  • You can alien it on another system, upload the .tgz file to server and use it. – hegez Jan 27 '18 at 12:57

I realise that this is a very old question and my answer will be (slightly) off-topic as I am addressing only the problem of installing Python packages as an ordinary user.

The solution for this particular use case is to use virtual environments . See the Python documentation of the venv module for details.

As to the generic problem of installing Debian packages without root or sudo rights, I am still looking for an answer myself...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.