wbolster / plyvel

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

Error compiling with pip install? error: command 'gcc' failed with exit status 1 #80

Closed chinitadelrey closed 5 years ago

chinitadelrey commented 6 years ago

Hi -- anyone here can please help me make some sense of how I should be fixing this issue? The key lines seem to be -- error: command 'gcc' failed with exit status 1 plyvel/_plyvel.cpp:547:10: fatal error: 'leveldb/db.h' file not found I have tried conda install gcc as well. thank you!

With pip, python3 (anaconda):

pip install plyvel
Collecting plyvel
  Using cached https://files.pythonhosted.org/packages/e0/7b/9302e33972c4af861f5a425cb37468b4dbb17d7a4d282a657bfdb240055e/plyvel-1.0.4.tar.gz
Building wheels for collected packages: plyvel
  Running setup.py bdist_wheel for plyvel ... error
  Complete output from command /Users/annjie/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-install-8u8wk8v3/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/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-wheel-i0gz7fag --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.6
  creating build/lib.macosx-10.7-x86_64-3.6/plyvel
  copying plyvel/_version.py -> build/lib.macosx-10.7-x86_64-3.6/plyvel
  copying plyvel/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/plyvel
  running build_ext
  building 'plyvel._plyvel' extension
  creating build/temp.macosx-10.7-x86_64-3.6
  creating build/temp.macosx-10.7-x86_64-3.6/plyvel
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/annjie/anaconda3/include -arch x86_64 -I/Users/annjie/anaconda3/include -arch x86_64 -I/Users/annjie/anaconda3/include/python3.6m -c plyvel/_plyvel.cpp -o build/temp.macosx-10.7-x86_64-3.6/plyvel/_plyvel.o -Wall -g -mmacosx-version-min=10.7 -stdlib=libc++
  plyvel/_plyvel.cpp:547:10: fatal error: 'leveldb/db.h' file not found
  #include "leveldb/db.h"
           ^~~~~~~~~~~~~~
  1 error generated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  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
    Complete output from command /Users/annjie/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-install-8u8wk8v3/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/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-record-5vgfs_mg/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.6
    creating build/lib.macosx-10.7-x86_64-3.6/plyvel
    copying plyvel/_version.py -> build/lib.macosx-10.7-x86_64-3.6/plyvel
    copying plyvel/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/plyvel
    running build_ext
    building 'plyvel._plyvel' extension
    creating build/temp.macosx-10.7-x86_64-3.6
    creating build/temp.macosx-10.7-x86_64-3.6/plyvel
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/annjie/anaconda3/include -arch x86_64 -I/Users/annjie/anaconda3/include -arch x86_64 -I/Users/annjie/anaconda3/include/python3.6m -c plyvel/_plyvel.cpp -o build/temp.macosx-10.7-x86_64-3.6/plyvel/_plyvel.o -Wall -g -mmacosx-version-min=10.7 -stdlib=libc++
    plyvel/_plyvel.cpp:547:10: fatal error: 'leveldb/db.h' file not found
    #include "leveldb/db.h"
             ^~~~~~~~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/Users/annjie/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-install-8u8wk8v3/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/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-record-5vgfs_mg/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-install-8u8wk8v3/plyvel/

============

With python 2.7's pip:

python2.7 -m pip install plyvel
Collecting plyvel
  Cache entry deserialization failed, entry ignored
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/e0/7b/9302e33972c4af861f5a425cb37468b4dbb17d7a4d282a657bfdb240055e/plyvel-1.0.4.tar.gz (338kB)
    100% |████████████████████████████████| 348kB 402kB/s 
Building wheels for collected packages: plyvel
  Running setup.py bdist_wheel for plyvel ... error
  Complete output from command /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-build-HVLOsu/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 /var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/tmpMD2QHXpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.13-intel-2.7
  creating build/lib.macosx-10.13-intel-2.7/plyvel
  copying plyvel/_version.py -> build/lib.macosx-10.13-intel-2.7/plyvel
  copying plyvel/__init__.py -> build/lib.macosx-10.13-intel-2.7/plyvel
  running build_ext
  building 'plyvel._plyvel' extension
  creating build/temp.macosx-10.13-intel-2.7
  creating build/temp.macosx-10.13-intel-2.7/plyvel
  cc -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 -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c plyvel/_plyvel.cpp -o build/temp.macosx-10.13-intel-2.7/plyvel/_plyvel.o -Wall -g -mmacosx-version-min=10.7 -stdlib=libc++
  plyvel/_plyvel.cpp:547:10: fatal error: 'leveldb/db.h' file not found
  #include "leveldb/db.h"
           ^~~~~~~~~~~~~~
  1 error generated.
  error: command 'cc' failed with exit status 1

  ----------------------------------------
  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
    Complete output from command /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-build-HVLOsu/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 /var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-u91mqJ-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.13-intel-2.7
    creating build/lib.macosx-10.13-intel-2.7/plyvel
    copying plyvel/_version.py -> build/lib.macosx-10.13-intel-2.7/plyvel
    copying plyvel/__init__.py -> build/lib.macosx-10.13-intel-2.7/plyvel
    running build_ext
    building 'plyvel._plyvel' extension
    creating build/temp.macosx-10.13-intel-2.7
    creating build/temp.macosx-10.13-intel-2.7/plyvel
    cc -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 -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c plyvel/_plyvel.cpp -o build/temp.macosx-10.13-intel-2.7/plyvel/_plyvel.o -Wall -g -mmacosx-version-min=10.7 -stdlib=libc++
    plyvel/_plyvel.cpp:547:10: fatal error: 'leveldb/db.h' file not found
    #include "leveldb/db.h"
             ^~~~~~~~~~~~~~
    1 error generated.
    error: command 'cc' failed with exit status 1

    ----------------------------------------
Command "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-build-HVLOsu/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 /var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-u91mqJ-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-build-HVLOsu/plyvel/
You are using pip version 9.0.1, however version 10.0.1 is available.
wbolster commented 6 years ago

no leveldb installed on your system

wbolster commented 6 years ago

it seems you are on osx. try "brew install leveldb"

chinitadelrey commented 6 years ago

hi @wbolster, thank you!! so I ran "brew install leveldb" but still received errors at the gcc level. what do you make of the following?

python 3:

    gcc: error: unrecognized command line option ‘-stdlib=libc++’
    error: command 'gcc' failed with exit status 1

I've updated conda install gcc as mentioned earlier.

python 2:

I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c plyvel/_plyvel.cpp -o build/temp.macosx-10.13-intel-2.7/plyvel/_plyvel.o -Wall -g -mmacosx-version-min=10.7 -stdlib=libc++
    cc: error: unrecognized command line option ‘-Wshorten-64-to-32’
    cc: error: unrecognized command line option ‘-stdlib=libc++’
    error: command 'cc' failed with exit status 1

full error messages:

with python 3

    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/annjie/anaconda3/include -arch x86_64 -I/Users/annjie/anaconda3/include -arch x86_64 -I/Users/annjie/anaconda3/include/python3.6m -c plyvel/_plyvel.cpp -o build/temp.macosx-10.7-x86_64-3.6/plyvel/_plyvel.o -Wall -g -mmacosx-version-min=10.7 -stdlib=libc++
    gcc: error: unrecognized command line option ‘-stdlib=libc++’
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/Users/annjie/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-install-9pziobeu/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/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-record-nmqbok3r/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-install-9pziobeu/plyvel/

python 2:

    cc -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 -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c plyvel/_plyvel.cpp -o build/temp.macosx-10.13-intel-2.7/plyvel/_plyvel.o -Wall -g -mmacosx-version-min=10.7 -stdlib=libc++
    cc: error: unrecognized command line option ‘-Wshorten-64-to-32’
    cc: error: unrecognized command line option ‘-stdlib=libc++’
    error: command 'cc' failed with exit status 1

    ----------------------------------------
Command "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-build-mOrbZp/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 /var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-Cr1q6f-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/59/zbz4xf_s3f74kd26nrd2pk4h0000gn/T/pip-build-mOrbZp/plyvel/
wbolster commented 6 years ago

hmmm. something weird with your compiler setup. g++ or other c++ packages not installed? i am not really familiar with osx. this issue is very likely not plyvel related, so perhaps you can find answers/help elsewhere on the web since it seems this would manifest when compiling a lot of software, not just plyvel.

wbolster commented 6 years ago

btw on osx i think you should try to use clang, not gcc:

https://stackoverflow.com/questions/34654682/unrecognized-command-line-option-stdlib-libc-gcc-homebrew-gcc-5-3-0-5-3-0

wbolster commented 6 years ago

alternatively, try to remove the flag from setup.py: https://github.com/wbolster/plyvel/blob/8a272611bef4a05c1349b24019cf8b843c6e8ce1/setup.py#L19

xDigital commented 5 years ago

I am getting a long list of warnings and in the end error: command 'gcc' failed with exit status 1 this on CentOS (GoDaddy Delux Hosting). Any help in installation would be welcome. Thanks.

Collecting ta-lib Using cached https://files.pythonhosted.org/packages/90/05/d4c6a778d7a7de0be366bc4a850b4ffaeac2abad927f95fa8ba6f355a082/TA-Lib-0.4.17.tar.gz Requirement already satisfied: numpy in ./.local/lib/python3.6/site-packages (from ta-lib) (1.15.4) Installing collected packages: ta-lib Running setup.py install for ta-lib ... error Complete output from command /home/fzutljptf41p/.local/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-c3vivc27/ta-lib/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-c8ruyrkw/install-record.txt --single-version-externally-managed --compile: /tmp/pip-install-c3vivc27/ta-lib/setup.py:79: UserWarning: Cannot find ta-lib library, installation may fail. warnings.warn('Cannot find ta-lib library, installation may fail.') 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/talib copying talib/abstract.py -> build/lib.linux-x86_64-3.6/talib copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib copying talib/stream.py -> build/lib.linux-x86_64-3.6/talib copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib copying talib/test_pandas.py -> build/lib.linux-x86_64-3.6/talib copying talib/init.py -> build/lib.linux-x86_64-3.6/talib running build_ext building 'talib._ta_lib' extension creating build/temp.linux-x86_64-3.6 creating build/temp.linux-x86_64-3.6/talib gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/fzutljptf41p/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/home/fzutljptf41p/.local/include/python3.6m -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.6/talib/_ta_lib.o talib/_ta_lib.c:526:28: error: ta-lib/ta_defs.h: No such file or directory talib/_ta_lib.c:527:30: error: ta-lib/ta_common.h: No such file or directory talib/_ta_lib.c:528:32: error: ta-lib/ta_abstract.h: No such file or directory talib/_ta_lib.c:529:28: error: ta-lib/ta_func.h: No such file or directory In file included from /home/fzutljptf41p/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1821, from /home/fzutljptf41p/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18, from /home/fzutljptf41p/.local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4, from talib/_ta_lib.c:533: /home/fzutljptf41p/.local/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" talib/_ta_lib.c:243887: warning: passing argument 1 of 'PyBytes_FromString' makes pointer from integer without a cast /home/MaximusIndus/.local/include/python3.6m/bytesobject.h:52: note: expected 'const char *' but argument is of type 'int' talib/_ta_lib.c: At top level: talib/_ta_lib.c:253063: error: expected ')' before 'value' talib/_ta_lib.c:253156: error: expected ')' before 'value' talib/_ta_lib.c:253218: error: expected ')' before 'value' talib/_ta_lib.c:253249: error: expected ')' before 'value' talib/_ta_lib.c:253280: error: expected ')' before 'value' talib/_ta_lib.c:253652: error: expected '=', ',', ';', 'asm' or 'attribute' before 'Pyx_PyInt_As_TA_RetCode' talib/_ta_lib.c:254030: error: expected '=', ',', ';', 'asm' or 'attribute' before 'Pyx_PyInt_As_TA_FuncUnstId' talib/_ta_lib.c:254408: error: expected '=', ',', ';', 'asm' or 'attribute' before 'Pyx_PyInt_As_TA_CandleSettingType' talib/_ta_lib.c:254597: error: expected '=', ',', ';', 'asm' or 'attribute' before 'Pyx_PyInt_As_TA_RangeType' error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/home/MaximusIndus/.local/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-d72_9_ef/TA-Lib/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-12rea9i4/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-d72_9_ef/TA-Lib/

wbolster commented 5 years ago

@MaximusIndus your error is not about plyvel at all. also, this issue is closed

Bluscream commented 4 years ago

I do have the same error: https://github.com/kdrag0n/pyrobud/issues/6

blu@minopia:~/bots/telegram/pyrobud $ sudo apt install leveldb
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package leveldb

even after doing sudo apt install libleveldb1d python3-leveldb still the same error :c

wbolster commented 4 years ago

you didn't install development headers. see docs

also, this issue is closed.

Bluscream commented 4 years ago

so i was able to get it running with sudo apt install libleveldb1d libleveldb-dev python3-leveldb but i think it's not really clear from the error what's wrong. And someone installing this through a third party python app might not immediatly run over to the plyvel docs so it is very much of use for you to insert a check or a notice for that. Otherwise people with this problem will keep appearing.

also, this issue is closed.

Opening a new issue when there's a existing closed issue is generally considered spam or would lead to a duplicate label. If you really prefer people opening a new issue for questions about known problems you should probably add a issue template and add that info into it to avoid confusion.

wbolster commented 4 years ago

did you read https://plyvel.readthedocs.io/en/latest/installation.html?

pull requests to improve the wording are welcome

Bluscream commented 4 years ago

So you would expect a user of some other python app (In this example https://github.com/kdrag0n/pyrobud) to read the docs of all it's dependencies? :thinking:

wbolster commented 4 years ago

no, actually i would expect the user of some other python app to use that app's bug tracker to report installation errors instead of making that the problem of their pretty well-documented dependencies :thinking: :stuck_out_tongue_winking_eye:

Bluscream commented 4 years ago

use that app's bug tracker to report installation errors

Look at comment 553280317. Also i think most apps using a lib would just redirect a user having issues with installing that lib to the lib's bugtracker.

wbolster commented 4 years ago

so you figured out it was related to leveldb. you then figured out its python bindings (plyvel, this project) couldn't be installed. that means you're almost there already.

but somehow your didn't read this project's installation instructions. 🤷‍♀️

(also, as i said, PR with suggested doc improvements welcome.)

Bluscream commented 4 years ago

If at all the pr should focus on the wheel not on the docs

wbolster commented 4 years ago

if you're on modern linux i think you should be able to use the prebuilt wheels, avoiding the build step completely.

not sure why your system didn't pick those up. recent python, recent pip, recent plyvel? (this would be something for a new plyvel issue though)