Search code examples
python-3.xpipleveldb

Installing pip3 packages. Getting "command 'clang' failed with exit status 1"


I'm following this guide: https://freedomnode.com/blog/69/how-to-install-an-electrum-server-using-full-bitcoin-node-and-electrumx

Currently stuck at this step, to install the pip3 deps Install required Python packages

pip3 install aiohttp pylru leveldb plyvel

After running that command I get the follow error/warnings

1 warning generated.
   clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c leveldb/util/cache.cc -o build/temp.macosx-10.13-x86_64-3.6/leveldb/util/cache.o -I./leveldb/include -I./leveldb -I./snappy -I. -fno-builtin-memcmp -O2 -fPIC -DNDEBUG -DSNAPPY -DOS_MACOSX -DLEVELDB_PLATFORM_POSIX -Wno-error=unused-command-line-argument-hard-error-in-future
   warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
   In file included from leveldb/util/cache.cc:10:
   In file included from ./leveldb/port/port.h:14:
   In file included from ./leveldb/port/port_posix.h:50:
   ./leveldb/port/atomic_pointer.h:56:3: warning: 'OSMemoryBarrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_thread_fence() from <atomic> instead [-Wdeprecated-declarations]
     OSMemoryBarrier();
     ^
   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libkern/OSAtomicDeprecated.h:749:9: note: 'OSMemoryBarrier' has been explicitly marked deprecated here
   void    OSMemoryBarrier( void );
           ^
   leveldb/util/cache.cc:322:14: error: allocating an object of abstract class type 'leveldb::(anonymous namespace)::ShardedLRUCache'
     return new ShardedLRUCache(capacity);
                ^
   /usr/local/include/leveldb/cache.h:94:18: note: unimplemented pure virtual method 'TotalCharge' in 'ShardedLRUCache'
     virtual size_t TotalCharge() const = 0;
                    ^
2 warnings and 1 error generated.
   error: command 'clang' failed with exit status 1

   ----------------------------------------
Command "/usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/mv/63xqwfld3sbc4dk63fwj7f4h0000gn/T/pip-build-5vi7gmvb/leveldb/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/mv/63xqwfld3sbc4dk63fwj7f4h0000gn/T/pip-t8d4xlfy-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/mv/63xqwfld3sbc4dk63fwj7f4h0000gn/T/pip-build-5vi7gmvb/leveldb/

Doing pip3 list will display the following, leveldb did not get installed.

enter image description here


Solution

  • Googling error message finds this https://github.com/peercoin/peercoin/issues/234

    It seems your compiling against the system installed leveldb instead of the leveldb in src directory. If possible try uninstalling leveldb from your system (if it is not needed by other applications of course).

    I suggest you install leveldb via brew

     brew install leveldb