Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plyvel not linked correctly to leveldb in MacOS #134

Open
julianmrodri opened this issue Sep 10, 2021 · 6 comments
Open

Plyvel not linked correctly to leveldb in MacOS #134

julianmrodri opened this issue Sep 10, 2021 · 6 comments

Comments

@julianmrodri
Copy link

Issue

Getting the following error when trying to import plyvel in Python console after installing leveldb.

Additional information and context can be found in this issue (ConsenSysDiligence/mythril#1509). Redirected from their repo.

Steps I followed to install (which include leveldb).

brew update
brew upgrade
brew tap ethereum/ethereum
brew install leveldb
brew install solidity
pip3 install mythril

But after installation if I try to run simple plyvel import in Python console I get this error.
It is likely the leveldb packages aren't linked to plyvel correctly?

Python 3.7.7 (v3.7.7:d7c567b08f, Mar 10 2020, 02:56:16) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import plyvel 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/plyvel/__init__.py", line 6, in <module>
    from ._plyvel import (  # noqa
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/plyvel/_plyvel.cpython-37m-darwin.so, 2): Symbol not found: __ZTIN7leveldb10ComparatorE
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/plyvel/_plyvel.cpython-37m-darwin.so
  Expected in: flat namespace
 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/plyvel/_plyvel.cpython-37m-darwin.so
>>> 

Enviroment

Python version: python -V returns Python 2.7.161. python3 -V returns Python 3.7.7
OS and Version: MacOS Big Sur

@edopelawi
Copy link

@julianmrodri Hey there, I stumbled upon similar issue. Do you happen to find any solution yet?

@julianmrodri
Copy link
Author

@julianmrodri Hey there, I stumbled upon similar issue. Do you happen to find any solution yet?

No.. had to move to another installation method using Docker.

@ksato9700
Copy link

It looks like this issue is a duplication of #114. In the latest version (1.23), it disabled RTTI, that causes this issue.
I resolved the problem by uninstalling homebrew version and install leveldb 1.22 from the source code.

@AlexV525
Copy link

AlexV525 commented Nov 10, 2024

To solve Symbol not found: __ZTIN7leveldb10ComparatorE on MacOS:

brew uninstall leveldb
# Fetches the LevelDB v1.22 formula.
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/e2c833d326c45d9aaf4e26af6dd8b2f31564dc04/Formula/leveldb.rb
brew install --formula ./leveldb.rb
export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib"
export CPATH="$CPATH:$(brew --prefix)/include"
# Use pip3 maybe.
pip install plyvel

There are a few noticeable setups with my device:

  1. I'm using the Python installed with Homebrew, rather than from /usr/bin/python3.
  2. I've aliased python to python3, and pip to pip3.
  3. I'm using Python 3.10.

@evgtmld
Copy link

evgtmld commented Dec 2, 2024

To solve Symbol not found: __ZTIN7leveldb10ComparatorE on MacOS:

brew uninstall leveldb
# Fetches the LevelDB v1.22 formula.
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/e2c833d326c45d9aaf4e26af6dd8b2f31564dc04/Formula/leveldb.rb
brew install --formula ./leveldb.rb
export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib"
export CPATH="$CPATH:$(brew --prefix)/include"
# Use pip3 maybe.
pip install plyvel

There are a few noticeable setups with my device:

1. I'm using the Python installed with Homebrew, rather than from `/usr/bin/python3`.

2. I've aliased `python` to `python3`, and `pip` to `pip3`.

3. I'm using Python 3.10.

I guess brew removed old version as now i have this in console output:

==> Fetching dependencies for leveldb: gperftools
==> Downloading https://ghcr.io/v2/homebrew/core/gperftools/manifests/2.16
Already downloaded: /Users/tester/Library/Caches/Homebrew/downloads/6c8f2164a1a664aa3889b79a8acab298531d952d4b6cd8903acb551ca74bc058--gperftools-2.16.bottle_manifest.json
==> Fetching gperftools
==> Downloading https://ghcr.io/v2/homebrew/core/gperftools/blobs/sha256:b0f53d444765abb98c3c6756b4453898c59ff9664801f3f8f753b391e9481a1d
Already downloaded: /Users/tester/Library/Caches/Homebrew/downloads/832dc08cde185d296f59115536c0d01a2fd99c02eaf83bd834ed3a20065fc981--gperftools--2.16.sonoma.bottle.tar.gz
==> Fetching leveldb
==> Downloading https://ghcr.io/v2/homebrew/core/leveldb/blobs/sha256:410c6f27c9bf8381020c866be9c45e84a41bcb61161061e8219710bb7a5aff0d
curl: (56) The requested URL returned error: 404                                                                                                                                                                                                              

Error: leveldb: Failed to download resource "leveldb"

@LiuChangFreeman
Copy link

To solve Symbol not found: __ZTIN7leveldb10ComparatorE on MacOS:

brew uninstall leveldb

Fetches the LevelDB v1.22 formula.

wget https://raw.githubusercontent.com/Homebrew/homebrew-core/e2c833d326c45d9aaf4e26af6dd8b2f31564dc04/Formula/leveldb.rb
brew install --formula ./leveldb.rb
export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib"
export CPATH="$CPATH:$(brew --prefix)/include"

Use pip3 maybe.

pip install plyvel
There are a few noticeable setups with my device:

  1. I'm using the Python installed with Homebrew, rather than from /usr/bin/python3.
  2. I've aliased python to python3, and pip to pip3.
  3. I'm using Python 3.10.

Work for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants