spesmilo / electrumx

Alternative implementation of spesmilo/electrum-server
MIT License
432 stars 343 forks source link

PIP Install error: Plyvel latest version [1.4.0] #184

Closed tadeubas closed 2 years ago

tadeubas commented 2 years ago

Error appear on branch master or tag 1.16.0, when executing python3.8 -m pip install . on electrumx folder

FIX: add this version requirement for plyvel on setup.py 'plyvel>=1.0.5,<1.4.0'

Building wheels for collected packages: plyvel
  Running setup.py bdist_wheel for plyvel ... error
  Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-071h8f8b/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 /tmp/tmptcg7zo_opip-wheel- --python-tag cp38:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/plyvel
  copying plyvel/__init__.py -> build/lib.linux-x86_64-3.8/plyvel
  copying plyvel/_version.py -> build/lib.linux-x86_64-3.8/plyvel
  running build_ext
  building 'plyvel._plyvel' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/plyvel
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c plyvel/_plyvel.cpp -o build/temp.linux-x86_64-3.8/plyvel/_plyvel.o -Wall -g -x c++ -std=c++11
  x86_64-linux-gnu-gcc: warning: ‘-x c++’ after last input file has no effect
  plyvel/_plyvel.cpp: In function ‘PyObject* __pyx_pf_6plyvel_7_plyvel_10WriteBatch_12approximate_size(__pyx_obj_6plyvel_7_plyvel_WriteBatch*)’:
  plyvel/_plyvel.cpp:11010:66: error: ‘class leveldb::WriteBatch’ has no member named ‘ApproximateSize’
     __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_write_batch->ApproximateSize()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error)
                                                                    ^~~~~~~~~~~~~~~
  plyvel/_plyvel.cpp: In function ‘PyObject* __pyx_pf_6plyvel_7_plyvel_10WriteBatch_14append(__pyx_obj_6plyvel_7_plyvel_WriteBatch*, __pyx_obj_6plyvel_7_plyvel_WriteBatch*)’:
  plyvel/_plyvel.cpp:11114:31: error: ‘class leveldb::WriteBatch’ has no member named ‘Append’
     __pyx_v_self->_write_batch->Append((__pyx_v_source->_write_batch[0]));
                                 ^~~~~~
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for plyvel
  Running setup.py clean for plyvel
Failed to build plyvel
Installing collected packages: multidict, attrs, frozenlist, aiosignal, async-timeout, charset-normalizer, idna, yarl, aiohttp, websockets, aiorpcX, plyvel, pylru, ujson, e-x
  Running setup.py install for plyvel ... error
    Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-071h8f8b/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 /tmp/pip-zulvewfa-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/plyvel
    copying plyvel/__init__.py -> build/lib.linux-x86_64-3.8/plyvel
    copying plyvel/_version.py -> build/lib.linux-x86_64-3.8/plyvel
    running build_ext
    building 'plyvel._plyvel' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/plyvel
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c plyvel/_plyvel.cpp -o build/temp.linux-x86_64-3.8/plyvel/_plyvel.o -Wall -g -x c++ -std=c++11
    x86_64-linux-gnu-gcc: warning: ‘-x c++’ after last input file has no effect
    plyvel/_plyvel.cpp: In function ‘PyObject* __pyx_pf_6plyvel_7_plyvel_10WriteBatch_12approximate_size(__pyx_obj_6plyvel_7_plyvel_WriteBatch*)’:
    plyvel/_plyvel.cpp:11010:66: error: ‘class leveldb::WriteBatch’ has no member named ‘ApproximateSize’
       __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_write_batch->ApproximateSize()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error)
                                                                      ^~~~~~~~~~~~~~~
    plyvel/_plyvel.cpp: In function ‘PyObject* __pyx_pf_6plyvel_7_plyvel_10WriteBatch_14append(__pyx_obj_6plyvel_7_plyvel_WriteBatch*, __pyx_obj_6plyvel_7_plyvel_WriteBatch*)’:
    plyvel/_plyvel.cpp:11114:31: error: ‘class leveldb::WriteBatch’ has no member named ‘Append’
       __pyx_v_self->_write_batch->Append((__pyx_v_source->_write_batch[0]));
                                   ^~~~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-071h8f8b/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 /tmp/pip-zulvewfa-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-071h8f8b/plyvel/
SomberNight commented 2 years ago

Looks like pip picked the source distributable for plyvel for you and is trying to compile from source. You might not have the required libraries (or not have the expected versions of them).

When I try python3 -m pip install plyvel, on Ubuntu 20.04, it chooses the binary wheels instead of the source tar.gz, and it installs nicely. Any idea why pip does not simply use the prebuilt .whl files for you? What Linux distro are you using and which CPU architecture?

tadeubas commented 2 years ago

It is Ubuntu for Windows (WSL 1):

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic

Linux DESKTOP 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux

If it is only on my end only, I will close the issue... but would be nice to tell in README: If you have any ERROR installing some Python dependency, try updating Python or selecting an older version of the dependency library that is generating the error.