0

I was having trouble installing a package (plumed) using pip3.6. Specifically, with the command pip3.6 install --user plumed, I got the following error:

Collecting plumed
  Using cached plumed-2.6.1.tar.gz (189 kB)
Building wheels for collected packages: plumed
  Building wheel for plumed (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cnvim96k/plumed/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-js3bt49u
       cwd: /tmp/pip-install-cnvim96k/plumed/
  Complete output (17 lines):
  Module name plumed
  Version number 2.6.1
  using available plumed.cpp file
  running bdist_wheel
  running build
  running build_ext
  building 'plumed' extension
  creating build
  creating build/temp.linux-x86_64-3.6
  /home/wei-tse/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -g -fwrapv -O2 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/wei-tse/anaconda3/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/wei-tse/anaconda3/include -fPIC -I./include -I/usr/include/python3.6m -c plumed.cpp -o build/temp.linux-x86_64-3.6/plumed.o -D__PLUMED_HAS_DLOPEN -D__PLUMED_WRAPPER_LINK_RUNTIME=1 -D__PLUMED_WRAPPER_CXX=1 -D__PLUMED_WRAPPER_IMPLEMENTATION=1 -D__PLUMED_WRAPPER_EXTERN=0 -D__PLUMED_WRAPPER_CXX_DEFAULT_INVALID=1
  In file included from /usr/include/python3.6m/Python.h:8:0,
                   from plumed.cpp:31:
  /usr/include/python3.6m/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.6m/pyconfig.h: No such file or directory
   #  include <x86_64-linux-gnu/python3.6m/pyconfig.h>
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  compilation terminated.
  error: command '/home/wei-tse/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1       
  ----------------------------------------
  ERROR: Failed building wheel for plumed
  Running setup.py clean for plumed
Failed to build plumed
Installing collected packages: plumed
    Running setup.py install for plumed ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cnvim96k/plumed/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-5tvrlz45/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/wei-tse/.local/include/python3.6m/plumed
         cwd: /tmp/pip-install-cnvim96k/plumed/
    Complete output (17 lines):
    Module name plumed
    Version number 2.6.1
    using available plumed.cpp file
    running install
    running build
    running build_ext
    building 'plumed' extension
    creating build
    creating build/temp.linux-x86_64-3.6
    /home/wei-tse/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -g -fwrapv -O2 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/wei-tse/anaconda3/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/wei-tse/anaconda3/include -fPIC 
-I./include -I/usr/include/python3.6m -c plumed.cpp -o build/temp.linux-x86_64-3.6/plumed.o -D__PLUMED_HAS_DLOPEN -D__PLUMED_WRAPPER_LINK_RUNTIME=1 -D__PLUMED_WRAPPER_CXX=1 -D__PLUMED_WRAPPER_IMPLEMENTATION=1 -D__PLUMED_WRAPPER_EXTERN=0 -D__PLUMED_WRAPPER_CXX_DEFAULT_INVALID=1
    In file included from /usr/include/python3.6m/Python.h:8:0,
                     from plumed.cpp:31:
    /usr/include/python3.6m/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.6m/pyconfig.h: No such file or directory
     #  include <x86_64-linux-gnu/python3.6m/pyconfig.h>
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    error: command '/home/wei-tse/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1     
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cnvim96k/plumed/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cnvim96k/plumed/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-5tvrlz45/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/wei-tse/.local/include/python3.6m/plumed Check the logs for full command output.

I know that there are already a lot of relevant discussions on the forum, but none of the solutions worked for me. I've tried the following solutions:

  • sudo apt-get install python-dev libxml2-dev libxslt-dev
  • sudo apt-get install python3.6-dev
  • export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/x86_64-linux-gnu/python3.6m/pyconfig.h The weird thing is that I had pyconfig.h in /usr/include/x86_64-linux-gnu/python3.6m/ but it couldn't be found when I used pip3.6. I was using Ubuntu 18.04, so the systematic pip was associated with Python 3.6.9. I'm wondering if there is any solution that could deal with this problem. Thanks!
Jack
  • 81
  • 3
  • 11
  • Chack [This](https://stackoverflow.com/questions/19810940/ubuntu-linking-boost-python-fatal-error-pyconfig-cannot-be-found) Out. – Revisto Sep 11 '20 at 17:14
  • Thanks for the reply, but as I mentioned in my post, I've already tried adding `export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/x86_64-linux-gnu/python3.6m/pyconfig.h"` in my `.bashrc`. It didn't work for me. – Jack Sep 11 '20 at 21:26

1 Answers1

0

For me it turned out an old package wasn't fully installed somewhere. If you get apt-get -f install anywhere in your error messages, just run that, it'll re-install your packages. Not 100% certain it'll work for everyone, but that was my specific problem with this.

Revisto
  • 1,211
  • 7
  • 11