question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linux/Python3 pip install fails on compilation error with _psutil_common.o

See original GitHub issue

Platform: Linux

  • OS version : Arch Linux (Antergos - all packages updated on Apr 7)
  • Using miniconda (python 3.6.8)
  • psutil version : 5.6.1
  • gcc version: 8.2.1

Hi @giampaolo, Just stepped on this while installing using pip install psutil.

pip install failed due to compilation error with gcc while linking with _psutil_common.o Fixing #824 would be really helpful.

Installation logs

Collecting psutil
  Using cached https://files.pythonhosted.org/packages/2f/b8/11ec5006d2ec2998cb68349b8d1317c24c284cf918ecd6729739388e4c56/psutil-5.6.1.tar.gz
Building wheels for collected packages: psutil
  Building wheel for psutil (setup.py) ... error
  Complete output from command /home/himanshu/Downloads/learning-airflow/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-97_h0006/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-qot5kyqg --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/psutil
  copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.6/psutil
  copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.6/psutil
  copying psutil/_psposix.py -> build/lib.linux-x86_64-3.6/psutil
  copying psutil/_psosx.py -> build/lib.linux-x86_64-3.6/psutil
  copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.6/psutil
  copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.6/psutil
  copying psutil/_psaix.py -> build/lib.linux-x86_64-3.6/psutil
  copying psutil/_compat.py -> build/lib.linux-x86_64-3.6/psutil
  copying psutil/_common.py -> build/lib.linux-x86_64-3.6/psutil
  copying psutil/__init__.py -> build/lib.linux-x86_64-3.6/psutil
  creating build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.6/psutil/tests
  copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.6/psutil/tests
  running build_ext
  building 'psutil._psutil_linux' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/psutil
  gcc -pthread -B /home/himanshu/.miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=561 -DPSUTIL_LINUX=1 -I/home/himanshu/.miniconda3/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
  gcc -pthread -B /home/himanshu/.miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=561 -DPSUTIL_LINUX=1 -I/home/himanshu/.miniconda3/include/python3.6m -c psutil/_psutil_posix.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_posix.o
  psutil/_psutil_posix.c: In function ‘psutil_net_if_flags’:
  psutil/_psutil_posix.c:415:5: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
       strncpy(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  psutil/_psutil_posix.c: In function ‘psutil_net_if_mtu’:
  psutil/_psutil_posix.c:376:5: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
       strncpy(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  gcc -pthread -B /home/himanshu/.miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=561 -DPSUTIL_LINUX=1 -I/home/himanshu/.miniconda3/include/python3.6m -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_linux.o
  psutil/_psutil_linux.c: In function ‘psutil_net_if_duplex_speed’:
  psutil/_psutil_linux.c:539:5: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
       strncpy(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  gcc -pthread -shared -B /home/himanshu/.miniconda3/compiler_compat -L/home/himanshu/.miniconda3/lib -Wl,-rpath=/home/himanshu/.miniconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/psutil/_psutil_common.o build/temp.linux-x86_64-3.6/psutil/_psutil_posix.o build/temp.linux-x86_64-3.6/psutil/_psutil_linux.o -o build/lib.linux-x86_64-3.6/psutil/_psutil_linux.cpython-36m-x86_64-linux-gnu.so
  /home/himanshu/.miniconda3/compiler_compat/ld: build/temp.linux-x86_64-3.6/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
  /home/himanshu/.miniconda3/compiler_compat/ld: build/temp.linux-x86_64-3.6/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
  /home/himanshu/.miniconda3/compiler_compat/ld: build/temp.linux-x86_64-3.6/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
  /home/himanshu/.miniconda3/compiler_compat/ld: build/temp.linux-x86_64-3.6/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
  build/temp.linux-x86_64-3.6/psutil/_psutil_common.o: file not recognized: file format not recognized
  collect2: error: ld returned 1 exit status
  error: command '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
  Running setup.py install for psutil ... error
    Complete output from command /home/himanshu/Downloads/learning-airflow/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-97_h0006/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-317tvpc9/install-record.txt --single-version-externally-managed --compile --install-headers /home/himanshu/Downloads/learning-airflow/venv/include/site/python3.6/psutil:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/psutil
    copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.6/psutil
    copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.6/psutil
    copying psutil/_psposix.py -> build/lib.linux-x86_64-3.6/psutil
    copying psutil/_psosx.py -> build/lib.linux-x86_64-3.6/psutil
    copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.6/psutil
    copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.6/psutil
    copying psutil/_psaix.py -> build/lib.linux-x86_64-3.6/psutil
    copying psutil/_compat.py -> build/lib.linux-x86_64-3.6/psutil
    copying psutil/_common.py -> build/lib.linux-x86_64-3.6/psutil
    copying psutil/__init__.py -> build/lib.linux-x86_64-3.6/psutil
    creating build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.6/psutil/tests
    copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.6/psutil/tests
    running build_ext
    building 'psutil._psutil_linux' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/psutil
    gcc -pthread -B /home/himanshu/.miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=561 -DPSUTIL_LINUX=1 -I/home/himanshu/.miniconda3/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
    gcc -pthread -B /home/himanshu/.miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=561 -DPSUTIL_LINUX=1 -I/home/himanshu/.miniconda3/include/python3.6m -c psutil/_psutil_posix.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_posix.o
    psutil/_psutil_posix.c: In function ‘psutil_net_if_flags’:
    psutil/_psutil_posix.c:415:5: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
         strncpy(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    psutil/_psutil_posix.c: In function ‘psutil_net_if_mtu’:
    psutil/_psutil_posix.c:376:5: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
         strncpy(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    gcc -pthread -B /home/himanshu/.miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=561 -DPSUTIL_LINUX=1 -I/home/himanshu/.miniconda3/include/python3.6m -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_linux.o
    psutil/_psutil_linux.c: In function ‘psutil_net_if_duplex_speed’:
    psutil/_psutil_linux.c:539:5: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
         strncpy(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    gcc -pthread -shared -B /home/himanshu/.miniconda3/compiler_compat -L/home/himanshu/.miniconda3/lib -Wl,-rpath=/home/himanshu/.miniconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/psutil/_psutil_common.o build/temp.linux-x86_64-3.6/psutil/_psutil_posix.o build/temp.linux-x86_64-3.6/psutil/_psutil_linux.o -o build/lib.linux-x86_64-3.6/psutil/_psutil_linux.cpython-36m-x86_64-linux-gnu.so
    /home/himanshu/.miniconda3/compiler_compat/ld: build/temp.linux-x86_64-3.6/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
    /home/himanshu/.miniconda3/compiler_compat/ld: build/temp.linux-x86_64-3.6/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
    /home/himanshu/.miniconda3/compiler_compat/ld: build/temp.linux-x86_64-3.6/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
    /home/himanshu/.miniconda3/compiler_compat/ld: build/temp.linux-x86_64-3.6/psutil/_psutil_common.o: unable to initialize decompress status for section .debug_info
    build/temp.linux-x86_64-3.6/psutil/_psutil_common.o: file not recognized: file format not recognized
    collect2: error: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/home/himanshu/Downloads/learning-airflow/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-97_h0006/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-317tvpc9/install-record.txt --single-version-externally-managed --compile --install-headers /home/himanshu/Downloads/learning-airflow/venv/include/site/python3.6/psutil" failed with error code 1 in /tmp/pip-install-97_h0006/psutil/

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
andrhuacommented, Oct 2, 2019

As mentioned here, problem is in built-in conda ld linker which shades the system one. Quick workaround is mv ld ld-old, run pip install psutil or whatever package is failing to install, and then probably rename ld back. In particular, Arch had fixed this issue a long time ago, so it’s entirely up to you. Conda is aware of this bug.

0reactions
giampaolocommented, Dec 29, 2020

Closing as it seems related to Conda (also now there are Linux wheels).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why I do get an error when installing the psutil package for ...
1 Answer 1 · Install missing package pip install wheel · Install this tools https://visualstudio.microsoft.com/visual-cpp-build-tools/ · Restart ...
Read more >
Error with gcc installing psutil (and it's dependants) with pip
I installed the CentOS repository. I tried downloading the python3-devel package from there, but there was a problem with the dependencies, ...
Read more >
ERROR: Could not build wheels for psutil in Python | bobbyhadz
To solve the error "Could not build wheels for psutil", run the pip install --upgrade pip command to upgrade your pip version and...
Read more >
fatal error :"python.h" no file or directory? - Ask Ubuntu
For Python 3: sudo apt-get install python-dev python3-dev. You can also install it for specific versions of Python (if available for your ...
Read more >
Error when installing on Elementary OS 6.1 - Support
Hello, I am new to mycroft and I have issues installing on Elementary OS ... copying psutil/_common.py → build/lib.linux-x86_64-3.9/psutil
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found