wbolster / plyvel

Plyvel, a fast and feature-rich Python interface to LevelDB
https://plyvel.readthedocs.io/
Other
529 stars 75 forks source link

Issue Installing pyvel 1.1.0 on MacOS Via pip #106

Closed muerl closed 4 years ago

muerl commented 4 years ago

This is to some degrees a duplicate of this issue: https://github.com/wbolster/plyvel/issues/66 and https://github.com/wbolster/plyvel/issues/85 however @importjake asked me to create a new issue if I was able to reproduce it.

MacOS Mojave (10.14.6)

$clang -v
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$python -V
Python 3.7.3

$ conda -V
conda 4.7.10

I have XCode installed, v10.2.1 Install LevelDB:

brew install leveldb
==> Installing dependencies for leveldb: gperftools and snappy
==> Installing leveldb dependency: gperftools
==> Downloading https://homebrew.bintray.com/bottles/gperftools-2.7.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/eb/ebc68c4f401b6a77f8256a5ae84054803248b0e1ef1403f879893653ffd74cee?__gda__=exp=1570203325~hmac=83067fd204a58e7e96f7a4cb9ef066d
######################################################################## 100.0%
==> Pouring gperftools-2.7.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/gperftools/2.7: 103 files, 4.3MB
==> Installing leveldb dependency: snappy
==> Downloading https://homebrew.bintray.com/bottles/snappy-1.1.7_1.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring snappy-1.1.7_1.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/snappy/1.1.7_1: 18 files, 115.8KB
==> Installing leveldb
==> Downloading https://homebrew.bintray.com/bottles/leveldb-1.22.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/22/22e4a129bedd5030525f749a5b5ec978bf6da0a9b0625fe829da482a5ab85755?__gda__=exp=1570203332~hmac=7d1c2970457f0917f3394bd169ea217
######################################################################## 100.0%
==> Pouring leveldb-1.22.mojave.bottle.tar.gz

Trying to Install:

$ pip install plyvel==1.1.0
Collecting plyvel==1.1.0
  Downloading https://files.pythonhosted.org/packages/73/e5/471a3bb63a7fc0c75a5b595a88e0d45038a33c123ec9baec959741d4e851/plyvel-1.1.0.tar.gz (143kB)
     |████████████████████████████████| 153kB 624kB/s 
Building wheels for collected packages: plyvel
  Building wheel for plyvel (setup.py) ... error
  ERROR: Complete output from command /Users/matt/miniconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/qh/b_sh9g9x4yx_kc4zqmbzg01h0000gp/T/pip-install-7t87g6zo/plyvel/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 /private/var/folders/qh/b_sh9g9x4yx_kc4zqmbzg01h0000gp/T/pip-wheel-9fu_a3vr --python-tag cp37:
  ERROR: running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.7
  creating build/lib.macosx-10.7-x86_64-3.7/plyvel
  copying plyvel/_version.py -> build/lib.macosx-10.7-x86_64-3.7/plyvel
  copying plyvel/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/plyvel
  running build_ext
  building 'plyvel._plyvel' extension
  creating build/temp.macosx-10.7-x86_64-3.7
  creating build/temp.macosx-10.7-x86_64-3.7/plyvel
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/matt/miniconda3/include -arch x86_64 -I/Users/matt/miniconda3/include -arch x86_64 -I/Users/matt/miniconda3/include/python3.7m -c plyvel/_plyvel.cpp -o build/temp.macosx-10.7-x86_64-3.7/plyvel/_plyvel.o -Wall -g -x c++ -std=c++11
  warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
  plyvel/_plyvel.cpp:610:10: fatal error: 'ios' file not found
  #include "ios"
           ^~~~~
  1 warning and 1 error generated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for plyvel
  Running setup.py clean for plyvel
Failed to build plyvel
Installing collected packages: plyvel
  Running setup.py install for plyvel ... error
    ERROR: Complete output from command /Users/matt/miniconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/qh/b_sh9g9x4yx_kc4zqmbzg01h0000gp/T/pip-install-7t87g6zo/plyvel/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/qh/b_sh9g9x4yx_kc4zqmbzg01h0000gp/T/pip-record-7ff_gw01/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.7
    creating build/lib.macosx-10.7-x86_64-3.7/plyvel
    copying plyvel/_version.py -> build/lib.macosx-10.7-x86_64-3.7/plyvel
    copying plyvel/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/plyvel
    running build_ext
    building 'plyvel._plyvel' extension
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/plyvel
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/matt/miniconda3/include -arch x86_64 -I/Users/matt/miniconda3/include -arch x86_64 -I/Users/matt/miniconda3/include/python3.7m -c plyvel/_plyvel.cpp -o build/temp.macosx-10.7-x86_64-3.7/plyvel/_plyvel.o -Wall -g -x c++ -std=c++11
    warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    plyvel/_plyvel.cpp:610:10: fatal error: 'ios' file not found
    #include "ios"
             ^~~~~
    1 warning and 1 error generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/Users/matt/miniconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/qh/b_sh9g9x4yx_kc4zqmbzg01h0000gp/T/pip-install-7t87g6zo/plyvel/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/qh/b_sh9g9x4yx_kc4zqmbzg01h0000gp/T/pip-record-7ff_gw01/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/qh/b_sh9g9x4yx_kc4zqmbzg01h0000gp/T/pip-install-7t87g6zo/plyvel/

This works to install:

$ CFLAGS='-stdlib=libc++' pip install plyvel==1.1.0
Collecting plyvel==1.1.0
  Using cached https://files.pythonhosted.org/packages/73/e5/471a3bb63a7fc0c75a5b595a88e0d45038a33c123ec9baec959741d4e851/plyvel-1.1.0.tar.gz
Building wheels for collected packages: plyvel
  Building wheel for plyvel (setup.py) ... done
  Stored in directory: /Users/matt/Library/Caches/pip/wheels/e4/69/c6/055d710a9101831e73a056cb081a45744e5d567cbddd09fd3a
Successfully built plyvel
Installing collected packages: plyvel
Successfully installed plyvel-1.1.0

I hope that is enough detail. Please let me know if there is anything else I can provide.

schmty commented 4 years ago

I'd say best bet would be to just add that -stdlib=libc++ to the extra_compile_args in setup.py I can probably get to that sometime soon but feel free to make a PR if I am slow to do so.

Still curious as to how the ios header thing happens though, maybe that is something specific to the conda variant of python? Anyways, seems like a relatively simple fix. Thanks for giving more detail 👍