8

I am trying to install pyamg in my virtual environment. However, I am getting the following error. I am using mac OS.

c++: pyamg/amg_core/amg_core_wrap.cxx
clang: error: no such file or directory: '“-I/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0”'
clang: error: no such file or directory: '“-I/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0”'
error: Command "c++ -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE “-I/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0” -arch x86_64 -arch i386 -pipe -D__STDC_FORMAT_MACROS=1 -I/Users/mas/PycharmProjects/Whale/Zahraa5/lib/python2.7/site-packages/numpy/core/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pyamg/amg_core/amg_core_wrap.cxx -o build/temp.macosx-10.10-intel-2.7/pyamg/amg_core/amg_core_wrap.o" failed with exit status 1
ali_m
  • 71,714
  • 23
  • 223
  • 298
MAS
  • 4,503
  • 7
  • 32
  • 55
  • 2
    These quotes look funny to me. Where are those paths set? I would think they should be `"` symbols. – oarfish Nov 27 '15 at 20:54
  • Fwiw, I installation with pip fails for me as well, albeit with a different error. – oarfish Nov 27 '15 at 21:08
  • 1
    Could you add some more information showing exactly how you are attempting to install pyamg? Are you attempting to build it directly from the source directory (i.e. with `python setup.py install`)? The error seems to be caused by an invalid path to the Boost include directory (`-I/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0`). Do you have Boost installed somewhere? If so, where? – ali_m Nov 28 '15 at 20:27
  • 1
    @ali_m Problem solved by deleting the invalid paths from my .bash_profile – MAS Nov 29 '15 at 05:28
  • @ali_m I don't know why. – MAS Dec 04 '15 at 05:01
  • @MAS OK, then could you tell me which paths you removed from your `.bash_profile`? – ali_m Dec 04 '15 at 12:47
  • 1
    @ali_m those are the lines I removes:export CPPFLAGS=“-I/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0” export LIBS=“-L/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0/stage/lib” – MAS Dec 04 '15 at 17:34

3 Answers3

4

Use Anaconda or Miniconda

conda install pyamg

takes only a few seconds.

You can create an environment with:

conda create --name my_env python=2.7

Change into it:

source activate my_env

and install pyamg:

conda install pyamg

You can still use pip to install packages conda cannot find.

Life is too short to spent time on compilation issues. ;)

Mike Müller
  • 82,630
  • 20
  • 166
  • 161
  • 1
    Life indeed is much easier with Anaconda. It saved me so much time after trying to get libraries installed on different OS environments. – Matt Dec 04 '15 at 13:31
2

I'm pretty sure that the -I at the beginning of the paths is what's screwing everything up. I bet if you tried adding those export statements back to .bashrc but took out the -I and -L prefixes then your original command would start working.

Perhaps you had those there for a reason, I've never seen that, but removing those prefixes would probably work.

dknuth
  • 29
  • 1
  • Those paths would be meaningless without the `-I` and `-L` flags, [which are used to specify directories to be added to the head of the compiler's search path for header and library files respectively](https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html). As it happens, the paths are not needed anyway (since `pyamg` does not require Boost), but removing the `-I` and `-L` prefixes makes no sense. – ali_m Dec 05 '15 at 14:57
1

Actually, I think @oarfish called it correctly in the comments. The problem seems to be the funny and characters in those paths, which are distinct from the usual " double quote symbol.

The following reproduces the error for me:

~$ CPPFLAGS=“-I/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0” \
   LIBS=“-L/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0/stage/lib” \
   pip install pyamg

Collecting pyamg
  Downloading pyamg-3.0.1.tar.gz (759kB)
    100% |████████████████████████████████| 761kB 33.2MB/s 
Installing collected packages: pyamg
  Running setup.py install for pyamg
...
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/pyamg
    creating build/temp.linux-x86_64-2.7/pyamg/amg_core
    compile options: '-D__STDC_FORMAT_MACROS=1 -I/home/alistair/.venvs/pyamg/local/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c'
    c++: pyamg/amg_core/amg_core_wrap.cxx
    g++: error: “-I/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0”: No such file or directory
    g++: error: “-I/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0”: No such file or directory
    error: Command "c++ -pthread -DNDEBUG -g -fwrapv -O2 -Wall -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security “-I/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0” -fPIC -D__STDC_FO
RMAT_MACROS=1 -I/home/alistair/.venvs/pyamg/local/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c pyamg/amg_core/amg_core_wrap.cxx -o build/temp.linux-x86_64-2.7/pyamg/amg_core/amg_core_wrap.o" failed with exit 
status 1

    ----------------------------------------
Command "/home/alistair/.venvs/pyamg/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-Cl5_2g/pyamg/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" insta
ll --record /tmp/pip-kkjcoa-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/alistair/.venvs/pyamg/include/site/python2.7/pyamg" failed with error code 1 in /tmp/pip-build-Cl5_2g/pyamg

Whereas with " symbols the installation succeeds:

~$ CPPFLAGS="-I/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0" \
   LIBS="-L/Users/mas/PycharmProjects/kaggle-ndsb/boost_1_59_0/stage/lib" \
   pip install pyamg
Collecting pyamg
  Using cached pyamg-3.0.1.tar.gz
Installing collected packages: pyamg
  Running setup.py install for pyamg
Successfully installed pyamg-3.0.1

The paths themselves are irrelevant - the compilation succeeds in spite of the fact that those directories don't actually exist on my machine.

ali_m
  • 71,714
  • 23
  • 223
  • 298