0

I was trying to access the CPU, Ram and storage details of the EdgeGateway hence wanted to use python and psutil to get the job done

When Trying to install psutil in azure edge python module getting bellow error while building. How I can use psuitl here, I want to measure CPU and Ram details of edge gateway.

tep 4/6 : RUN pip install -r requirements.txt
 ---> Running in d65864318578
Collecting azure-iot-device~=2.0.0
  Downloading azure_iot_device-2.0.1-py2.py3-none-any.whl (271 kB)
Collecting psutil
  Downloading psutil-5.7.3.tar.gz (465 kB)
Collecting six<2.0.0,>=1.12.0
  Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting requests<3.0.0,>=2.20.0
  Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting requests-unixsocket<1.0.0,>=0.1.5
  Downloading requests_unixsocket-0.2.0-py2.py3-none-any.whl (11 kB)
Collecting janus<1.0.0,>=0.4.0; python_version >= "3.5"
  Downloading janus-0.6.1-py3-none-any.whl (11 kB)
Collecting transitions<1.0.0,>=0.6.8
  Downloading transitions-0.8.4-py2.py3-none-any.whl (77 kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>1.21.1; python_version != "3.4"
  Downloading urllib3-1.25.11-py2.py3-none-any.whl (127 kB)
Collecting paho-mqtt<2.0.0,>=1.4.0
  Downloading paho-mqtt-1.5.1.tar.gz (101 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
Collecting chardet<4,>=3.0.2
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting idna<3,>=2.5
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
Building wheels for collected packages: psutil, paho-mqtt
  Building wheel for psutil (setup.py): started
  Building wheel for psutil (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rde7gv_j/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rde7gv_j/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/pip-wheel-x3f7r1fq
       cwd: /tmp/pip-install-rde7gv_j/psutil/
  Complete output (44 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/psutil
  copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_psaix.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_psosx.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_common.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_compat.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_psposix.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/__init__.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.7/psutil
  creating build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_memleaks.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_testutils.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.7/psutil/tests
  running build_ext
  building 'psutil._psutil_linux' extension
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/psutil
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=573 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/usr/local/include/python3.7m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.7/psutil/_psutil_common.o
  unable to execute 'gcc': No such file or directory
  C compiler or Python headers are not installed on this system. Try to run:
  sudo apt-get install gcc python3-dev
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for psutil
  Running setup.py clean for psutil
  Building wheel for paho-mqtt (setup.py): started
  Building wheel for paho-mqtt (setup.py): finished with status 'done'
  Created wheel for paho-mqtt: filename=paho_mqtt-1.5.1-py3-none-any.whl size=61543 sha256=f27a76a9f3b030cdc789284e823441f35b5deb9b4f021f0bad8d8cbc0c324b53
  Stored in directory: /root/.cache/pip/wheels/c9/be/2a/883db47312c70ef7ffcaff281f3294e3075f62da075474d4bb
Successfully built paho-mqtt
Failed to build psutil
Installing collected packages: six, certifi, chardet, urllib3, idna, requests, requests-unixsocket, janus, transitions, paho-mqtt, azure-iot-device, psutil
    Running setup.py install for psutil: started
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rde7gv_j/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rde7gv_j/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-record-ygf_yh8g/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/psutil
         cwd: /tmp/pip-install-rde7gv_j/psutil/
    Complete output (44 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/psutil
    copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.7/psutil
    copying psutil/_psaix.py -> build/lib.linux-x86_64-3.7/psutil
    copying psutil/_psosx.py -> build/lib.linux-x86_64-3.7/psutil
    copying psutil/_common.py -> build/lib.linux-x86_64-3.7/psutil
    copying psutil/_compat.py -> build/lib.linux-x86_64-3.7/psutil
    copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.7/psutil
    copying psutil/_psposix.py -> build/lib.linux-x86_64-3.7/psutil
    copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.7/psutil
    copying psutil/__init__.py -> build/lib.linux-x86_64-3.7/psutil
    copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.7/psutil
    creating build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_memleaks.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_testutils.py -> build/lib.linux-x86_64-3.7/psutil/tests
    copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.7/psutil/tests
    running build_ext
    building 'psutil._psutil_linux' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/psutil
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=573 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/usr/local/include/python3.7m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.7/psutil/_psutil_common.o
    unable to execute 'gcc': No such file or directory
    C compiler or Python headers are not installed on this system. Try to run:
    sudo apt-get install gcc python3-dev
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
    Running setup.py install for psutil: finished with status 'error'
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rde7gv_j/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rde7gv_j/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-record-ygf_yh8g/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/psutil Check the logs for full command output.
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
ArnabGhosh
  • 35
  • 6
  • Looks like you are missing a package `gcc`. It says so in your error log. If that doesn't fix it, please also include your Dockerfile. – Matthijs van der Veer Nov 04 '20 at 12:37
  • Duplicate of https://stackoverflow.com/questions/8282231/i-have-python-on-my-ubuntu-system-but-gcc-cant-find-python-h – tripleee Nov 04 '20 at 12:47
  • Does this answer your question? [I have Python on my Ubuntu system, but gcc can't find Python.h](https://stackoverflow.com/questions/8282231/i-have-python-on-my-ubuntu-system-but-gcc-cant-find-python-h) – Tomerikoo Nov 04 '20 at 12:55

0 Answers0