LoginSignup
3
1

More than 5 years have passed since last update.

bbc1インストール時のエラー対処法(pyopenssl 18.0.0 has requirement cryptography>=2.2.1, but you'll have cryptography 2.1.4 which is incompatible.)

Posted at

問題概要

インストールガイドの以下コマンドを実行すると

$ pip install -r requirements.txt

次のような警告が出てきます。

$ pyopenssl 18.0.0 has requirement cryptography>=2.2.1, but you'll have cryptography 2.1.4 which is incompatible.

これではbbc_core.pyの起動時にエラーが発生します。

$ python bbc_core.py
Traceback (most recent call last):
  File "bbc_core.py", line 39, in <module>
    from bbc1.core import bbclib
  File "../../bbc1/core/bbclib.py", line 37, in <module>
    libbbcsig = CDLL("%s/libbbcsig.so" % directory)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/xxx/bbc1/bbc1/core/libbbcsig.so, 6): image not found

目的、目標

インストールガイドにあるbbc_core.pyの実行を成功させます。

対処方法

まずはじめにpip実行時のエラーを解決します。

$ pyopenssl 18.0.0 has requirement cryptography>=2.2.1, but you'll have cryptography 2.1.4 which is incompatible.

とあるのでcryptographyをv2.2.1にあげてみます。

$ pip install cryptography==2.2.1
Collecting cryptography==2.2.1
  Using cached https://files.pythonhosted.org/packages/bc/3e/e957a0e6abb012d49e6991fd54915b6d8cca9db51d6bc52ec875c2926d26/cryptography-2.2.1-cp34-abi3-macosx_10_6_intel.whl
Requirement already satisfied: idna>=2.1 in /Users/xxx/bbcenv/lib/python3.6/site-packages (from cryptography==2.2.1) (2.6)
Requirement already satisfied: cffi>=1.7; platform_python_implementation != "PyPy" in /Users/xxx/bbcenv/lib/python3.6/site-packages (from cryptography==2.2.1) (1.11.5)
Requirement already satisfied: six>=1.4.1 in /Users/xxx/bbcenv/lib/python3.6/site-packages (from cryptography==2.2.1) (1.11.0)
Requirement already satisfied: asn1crypto>=0.21.0 in /Users/xxx/bbcenv/lib/python3.6/site-packages (from cryptography==2.2.1) (0.24.0)
Requirement already satisfied: pycparser in /Users/xxx/bbcenv/lib/python3.6/site-packages (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography==2.2.1) (2.18)
Installing collected packages: cryptography
  Found existing installation: cryptography 2.1.4
    Uninstalling cryptography-2.1.4:
      Successfully uninstalled cryptography-2.1.4
Successfully installed cryptography-2.2.1

次に、bbc_core.pyの実行エラーを解決します。

$ python bbc_core.py
Traceback (most recent call last):
File "bbc_core.py", line 39, in
from bbc1.core import bbclib
File "../../bbc1/core/bbclib.py", line 37, in
libbbcsig = CDLL("%s/libbbcsig.so" % directory) # <-エラーの原因
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ctypes/init.py", line 348, in init
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/xxx/bbc1/bbc1/core/libbbcsig.so, 6): image not found #<-エラー事象

エラー内容は上記引用セクション2つ目の太字にあるように、imageファイルが見つからないというものです。その原因は引用セクションの1つ目の太字にありそうです。ファイルが見つからないということは参照しているディレクトリがおかしいはずなので直していきます。

まず、参照すべきディレクトリを見つけましょう。libbbcsigがあるディレクトリのパスはbbc1のソースツリーのトップに移動してから以下を実行してください。

$ ls
AUTHORS         Pipfile.lock        examples        setup.py
CHANGELOG.md        README.md       libs            tests
CONTRIBUTING.md     README.rst      prepare-apidoc.sh   utils
LICENSE         bbc1            prepare.py
MANIFEST.in     docker          prepare.sh
Pipfile         docs            requirements.txt

$ cd libs
$ ls
libbbcsig   libbbcsig.so    openssl

ありましたね、ファイルパスはbbc1/libs/libbbcsig.soです。実際にはbbclib.pyのインポートでエラーが出たため、そこからの相対パスは../../libs/libbbcsig.soですね。これをbbclib.pyにダイレクトに打ち込んでやります。


if os.name == "nt":
    libbbcsig = CDLL("%s/libbbcsig.dll" % directory)
else:
    libbbcsig = CDLL("../../libs/libbbcsig.so")# 修正後
#   libbbcsig = CDLL("%s/libbbcsig.so" % directory)# 修正前
# linux(windows10含む)ではos.name == "nt"がTrueになりますのでそちらでエラーが出た場合には同様に参照パスを変えてやれば良いです。

以上で完了です。実際にbbc_coreを立ち上げてみましょう。


$ python bbc_core.py --no_nodekey
2018/06/10 00:53:27| DEBUG   | core| config = {'workingdir': '.bbc1', 'client': {'port': 9000, 'use_node_key': False}, 'network': {'p2p_port': 6641, 'max_connections': 100}, 'domain_key': {'use': False, 'directory': '.bbc1/domain_keys', 'obsolete_timeout': 300}, 'domains': {'0000000000000000000000000000000000000000000000000000000000000000': {'module': 'p2p_domain0', 'static_nodes': {}, 'use_ledger_subsystem': False, 'ledger_subsystem': {'subsystem': 'ethereum', 'max_transactions': 4096, 'max_seconds': 3600}}}, 'ethereum': {'chain_id': 15, 'port': 30303, 'log': 'geth.log', 'account': '', 'passphrase': '', 'contract': 'BBcAnchor', 'contract_address': ''}}
2018/06/10 00:53:27| DEBUG   | bbc_network| Start udp_message_loop
2018/06/10 00:53:27| DEBUG   | bbc_network| Start tcpserver_loop

無事立ち上がりました。今回の対応は根本解決ではないので以降のサンプルファイルの実行などで何かしらの不具合が発生する場合があるかと思います。その場合はおしらせください。

3
1
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1