0

I am trying to install pgAdmin4 on Ubuntu 18.04 following this tutorial, but I get the following error with command pip install pgadmin4-2.1-py2.py3-none-any.whl:

src/_fastmath.c:31:10: fatal error: Python.h: No such file or directory
     #include "Python.h"
              ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/hugolvc/pgAdmin4/pgAdmin4/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-Eiam7O/pycrypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-xfTq9G/install-record.txt --single-version-externally-managed --compile --install-headers /home/hugolvc/pgAdmin4/pgAdmin4/include/site/python2.7/pycrypto" failed with error code 1 in /tmp/pip-install-Eiam7O/pycrypto/

I just followed the tutorial step by step.

EDIT

The result of python --version is Python 2.7.15rc1, but I also have installed 3.6 and 3.7.

The result of locate x86_64-linux-gnu-gcc is:

/usr/bin/x86_64-linux-gnu-gcc
/usr/bin/x86_64-linux-gnu-gcc-5
/usr/bin/x86_64-linux-gnu-gcc-7
/usr/bin/x86_64-linux-gnu-gcc-ar
/usr/bin/x86_64-linux-gnu-gcc-ar-5
/usr/bin/x86_64-linux-gnu-gcc-ar-7
/usr/bin/x86_64-linux-gnu-gcc-nm
/usr/bin/x86_64-linux-gnu-gcc-nm-5
/usr/bin/x86_64-linux-gnu-gcc-nm-7
/usr/bin/x86_64-linux-gnu-gcc-ranlib
/usr/bin/x86_64-linux-gnu-gcc-ranlib-5
/usr/bin/x86_64-linux-gnu-gcc-ranlib-7
/usr/share/man/man1/x86_64-linux-gnu-gcc-5.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gcc-7.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gcc-ar-5.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gcc-ar-7.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gcc-ar.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gcc-nm-5.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gcc-nm-7.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gcc-nm.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gcc-ranlib-5.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gcc-ranlib-7.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gcc-ranlib.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gcc.1.gz

The result of sudo find / -name "Python.h" is:

/home/hugolvc/.local/share/Trash/files/Python-3.7.0/Include/Python.h
find: ‘/run/user/1000/gvfs’: Permission denied
  • you have python-dev installed? – George Udosen Mar 30 '19 at 10:27
  • Give python --version and post it. Also Type locate x86_64-linux-gnu-gcc and output will be like /usr/bin/x86_64-linux-gnu-gcc – Marmayogi Mar 30 '19 at 11:32
  • The include "Python.h" is missing in your system. Issue command sudo find / -name "Python.h" and output should be such as /usr/include/python3.7m/Python.h, and/or /usr/include/python2.7/Python.h. Please @Hugo Luis Villalobos Canto, post all the output of commands as part of your question (i.e. edit your question and post!) – Marmayogi Mar 30 '19 at 11:45
  • Just now, I tried to install pgAdmin4 based on your tutorial and I was successful! I suspect that the problem is with your Python installation. Type command python3 --version and you should see output as Python 3.6.7. Have you run command such as sudo apt-get install build-essential libssl-dev libffi-dev python-dev python3-venv during python installation? – Marmayogi Mar 30 '19 at 12:05
  • FYI, after installation of pgAdmin4, I typed pip3 -V whose output is pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6) – Marmayogi Mar 30 '19 at 12:11
1

Install python-dev package using the command below:

sudo apt-get install python-dev   # for python2
sudo apt-get install python3-dev  # for python3
  • sudo apt-get install python-dev Reading package lists... Done Building dependency tree Reading state information... Done python-dev is already the newest version (2.7.15~rc1-1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. – HuLu ViCa Mar 30 '19 at 14:35
  • Do you use pip3 or pip? You must install python3-dev for pip3. – M.Fooladgar Mar 30 '19 at 14:40
  • Ok, that was it. It worked. Thanks a lot!!! – HuLu ViCa Mar 30 '19 at 15:34

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.