3

I am installing locust using command pip3 install locust. I am faced with a series of errors which I am unable to understand and debug, kindly help me with what went wrong. Any help is appreciated.I have python 3.8 and python 2.7 both installed on my system.

Here are the errors shown to me

Building wheels for collected packages: ConfigArgParse, psutil, Flask-BasicAuth
  Building wheel for ConfigArgParse (setup.py) ... done
  Created wheel for ConfigArgParse: filename=ConfigArgParse-1.2.3-py3-none-any.whl size=19328 sha256=54fe7f6915dc7cc03d14e51ca38e015ba107e0e1234a06bdc0641dcc1ee72ab3
  Stored in directory: /home/saranyagupta05/.cache/pip/wheels/b4/12/fe/1e4628f6ec22a9580d9e8fbef23df7a03948a1edde0821d7f5
  Building wheel for psutil (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-myqwf0hr/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-myqwf0hr/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-sk_etsgc
       cwd: /tmp/pip-install-myqwf0hr/psutil/
  Complete output (45 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/psutil
  copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.8/psutil
  copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.8/psutil
  copying psutil/_psposix.py -> build/lib.linux-x86_64-3.8/psutil
  copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.8/psutil
  copying psutil/_common.py -> build/lib.linux-x86_64-3.8/psutil
  copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.8/psutil
  copying psutil/_psosx.py -> build/lib.linux-x86_64-3.8/psutil
  copying psutil/__init__.py -> build/lib.linux-x86_64-3.8/psutil
  copying psutil/_compat.py -> build/lib.linux-x86_64-3.8/psutil
  copying psutil/_psaix.py -> build/lib.linux-x86_64-3.8/psutil
  creating build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_memleaks.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_testutils.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.8/psutil/tests
  copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.8/psutil/tests
  running build_ext
  building 'psutil._psutil_linux' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/psutil
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=572 -DPSUTIL_LINUX=1 -I/usr/include/python3.8 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.8/psutil/_psutil_common.o
  psutil/_psutil_common.c:9:10: fatal error: Python.h: No such file or directory
      9 | #include <Python.h>
        |          ^~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
Cyberwiz
  • 11,027
  • 3
  • 20
  • 40
Saranya Gupta
  • 1,945
  • 2
  • 10
  • 14

1 Answers1

1

Looks like you have Python installed, but not the header files/libraries for it.

Have a look at this answer to other question with the same underlying issue https://stackoverflow.com/a/21530768/1591921

Cyberwiz
  • 11,027
  • 3
  • 20
  • 40
  • Hi, on running sudo apt-get install python3-dev, I have got the error -> ```Package python3-dev is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'python3-dev' has no installation candidate``` – Saranya Gupta Aug 19 '20 at 03:48
  • Python version on my system is Python 3.8.2 – Saranya Gupta Aug 19 '20 at 03:50
  • which linux distribution are you running? – Cyberwiz Aug 19 '20 at 07:17
  • 1
    hmm.. looks like lots of people have this error. try sudo apt-get update and then retry. If that doesnt help, google the error message and try everything you find :) depending on your setup you may need to add an additional repo for apt. – Cyberwiz Aug 19 '20 at 07:50
  • 1
    You might also want to try: sudo apt-get install libpython3-dev – Cyberwiz Aug 19 '20 at 07:55
  • My Linux distribution/version- 20.04 LTS (Focal Fossa). I tried `sudo apt-get install libpython3-dev` but its says `E: Unable to locate package libpython3-dev`. – Saranya Gupta Aug 20 '20 at 05:30
  • Try libpython3.8-dev – Cyberwiz Aug 20 '20 at 06:10
  • I get this - `E: Unable to locate package libpython3.8-dev E: Couldn't find any package by glob 'libpython3.8-dev' E: Couldn't find any package by regex 'libpython3.8-dev` – Saranya Gupta Aug 20 '20 at 13:58
  • I see some answers with the same error for python 3.6 and ubuntu 16.04 but not for my versions – Saranya Gupta Aug 20 '20 at 14:00
  • Sorry, I’m out of ideas. – Cyberwiz Aug 20 '20 at 15:10
  • This is a follow up question, it would be great if you could help, is there a way to simulate faults in my application using locust? Something similar to fault injection – Saranya Gupta Aug 25 '20 at 17:38
  • `sudo apt-get install libpython3-dev` worked on 20.04 LTS. – simanacci Sep 11 '20 at 21:37