0

I am trying to install transcrypt into a python virtual environment using pip. Here's what happens:

username@host:~/Pycryptor$ source env/bin/activate
(env) username@host:~/Pycryptor$ pip install transcrypt
Collecting transcrypt
Collecting mypy (from transcrypt)
  Using cached mypy-0.560-py3-none-any.whl
Requirement already satisfied: typed-ast<1.2.0,>=1.1.0 in ./env/lib/python3.6/site-packages (from mypy->transcrypt)
Collecting psutil<5.5.0,>=5.4.0 (from mypy->transcrypt)
  Using cached psutil-5.4.3.tar.gz
Building wheels for collected packages: psutil
  Running setup.py bdist_wheel for psutil ... error
  Complete output from command /home/username/Pycryptor/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-izw5bnzb/psutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpzqu0yyxlpip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-i686-3.6
  creating build/lib.linux-i686-3.6/psutil
  copying psutil/__init__.py -> build/lib.linux-i686-3.6/psutil
  copying psutil/_psposix.py -> build/lib.linux-i686-3.6/psutil
  copying psutil/_psosx.py -> build/lib.linux-i686-3.6/psutil
  copying psutil/_pssunos.py -> build/lib.linux-i686-3.6/psutil
  copying psutil/_psbsd.py -> build/lib.linux-i686-3.6/psutil
  copying psutil/_common.py -> build/lib.linux-i686-3.6/psutil
  copying psutil/_compat.py -> build/lib.linux-i686-3.6/psutil
  copying psutil/_psaix.py -> build/lib.linux-i686-3.6/psutil
  copying psutil/_pswindows.py -> build/lib.linux-i686-3.6/psutil
  copying psutil/_exceptions.py -> build/lib.linux-i686-3.6/psutil
  copying psutil/_pslinux.py -> build/lib.linux-i686-3.6/psutil
  creating build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/__init__.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_windows.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/__main__.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_connections.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_bsd.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_posix.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_unicode.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_osx.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_contracts.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_memory_leaks.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_misc.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_aix.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_sunos.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_linux.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_process.py -> build/lib.linux-i686-3.6/psutil/tests
  copying psutil/tests/test_system.py -> build/lib.linux-i686-3.6/psutil/tests
  running build_ext
  building 'psutil._psutil_linux' extension
  creating build/temp.linux-i686-3.6
  creating build/temp.linux-i686-3.6/psutil
  i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-XcUuhr/python3.6-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=543 -DPSUTIL_LINUX=1 -I/usr/include/python3.6m -I/home/username/Pycryptor/env/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-i686-3.6/psutil/_psutil_common.o
  psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
   #include <Python.h>
                      ^
  compilation terminated.
  error: command 'i686-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for psutil
  Running setup.py clean for psutil
Failed to build psutil
Installing collected packages: psutil, mypy, transcrypt
  Running setup.py install for psutil ... error
    Complete output from command /home/username/Pycryptor/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-izw5bnzb/psutil/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-q1g8wrzk-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/username/Pycryptor/env/include/site/python3.6/psutil:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-i686-3.6
    creating build/lib.linux-i686-3.6/psutil
    copying psutil/__init__.py -> build/lib.linux-i686-3.6/psutil
    copying psutil/_psposix.py -> build/lib.linux-i686-3.6/psutil
    copying psutil/_psosx.py -> build/lib.linux-i686-3.6/psutil
    copying psutil/_pssunos.py -> build/lib.linux-i686-3.6/psutil
    copying psutil/_psbsd.py -> build/lib.linux-i686-3.6/psutil
    copying psutil/_common.py -> build/lib.linux-i686-3.6/psutil
    copying psutil/_compat.py -> build/lib.linux-i686-3.6/psutil
    copying psutil/_psaix.py -> build/lib.linux-i686-3.6/psutil
    copying psutil/_pswindows.py -> build/lib.linux-i686-3.6/psutil
    copying psutil/_exceptions.py -> build/lib.linux-i686-3.6/psutil
    copying psutil/_pslinux.py -> build/lib.linux-i686-3.6/psutil
    creating build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/__init__.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_windows.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/__main__.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_connections.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_bsd.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_posix.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_unicode.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_osx.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_contracts.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_memory_leaks.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_misc.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_aix.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_sunos.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_linux.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_process.py -> build/lib.linux-i686-3.6/psutil/tests
    copying psutil/tests/test_system.py -> build/lib.linux-i686-3.6/psutil/tests
    running build_ext
    building 'psutil._psutil_linux' extension
    creating build/temp.linux-i686-3.6
    creating build/temp.linux-i686-3.6/psutil
    i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-XcUuhr/python3.6-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=543 -DPSUTIL_LINUX=1 -I/usr/include/python3.6m -I/home/username/Pycryptor/env/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-i686-3.6/psutil/_psutil_common.o
    psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    error: command 'i686-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/username/Pycryptor/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-izw5bnzb/psutil/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-q1g8wrzk-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/username/Pycryptor/env/include/site/python3.6/psutil" failed with error code 1 in /tmp/pip-build-izw5bnzb/psutil/
(env) username@host:~/Pycryptor$

Same result when I use pip3.

I have python 3.5 and 3.6 installed. python3-dev version is 3.5.3-1. Python.h is located in /usr/include/python3.5m/Python.h. GCC is already the newest version (4:6.3.0-2ubuntu1).

What could be causing this error:

error: command 'i686-linux-gnu-gcc' failed with exit status 1 ?

DorkOrc
  • 103
  • 4
  • 9
  • Your output is trying to install for python 3.6. You need the "-dev" package, including Python.h for that version. – jordanm Jan 24 '18 at 06:58
  • Possible duplicate of [can't pip install mysql-python](https://stackoverflow.com/questions/18564745/cant-pip-install-mysql-python) – phd Jan 24 '18 at 14:21
  • While the solution to this question is indeed given by the link provided by @phd, it's probably wise to keep it open, since someone running into this problem is unlikely to look there, given the title that specifically includes mysql-python. – Jacques de Hooge Jan 25 '18 at 08:34
  • apt install python3-dev – ART GALLERY Apr 16 '19 at 02:43

0 Answers0