poljar / weechat-matrix

Weechat Matrix protocol script written in python
Other
957 stars 119 forks source link

OSError: Cannot load native module 'Cryptodome.Cipher._raw_ecb' #301

Closed anadahz closed 2 years ago

anadahz commented 2 years ago

It seems that after an upgrade I am unable to run weechat-matrix. Happy to provide more details.

python: 3.7.3

python: loading script "/home/user/.weechat/python/matrix.py"
python: stdout/stderr (?): Traceback (most recent call last):
python: stdout/stderr (?):   File "/home/user/.weechat/python/matrix.py", line 53, in <module>
python: stdout/stderr (?):     from nio import RemoteProtocolError, RemoteTransportError, TransportType
python: stdout/stderr (?):   File "/usr/lib/python3/dist-packages/nio/__init__.py", line 2, in <module>
python: stdout/stderr (?):     from .client import *
python: stdout/stderr (?):   File "/usr/lib/python3/dist-packages/nio/client/__init__.py", line 3, in <module>
python: stdout/stderr (?):     from .base_client import Client, ClientConfig
python: stdout/stderr (?):   File "/usr/lib/python3/dist-packages/nio/client/base_client.py", line 35, in <module>
python: stdout/stderr (?):     from ..crypto import ENCRYPTION_ENABLED
python: stdout/stderr (?):   File "/usr/lib/python3/dist-packages/nio/crypto/__init__.py", line 16, in <module>
python: stdout/stderr (?):     from .attachments import encrypt_attachment, decrypt_attachment
python: stdout/stderr (?):   File "/usr/lib/python3/dist-packages/nio/crypto/attachments.py", line 25, in <module>
python: stdout/stderr (?):     from Cryptodome.Cipher import AES
python: stdout/stderr (?):   File "/usr/lib/python3/dist-packages/Cryptodome/Cipher/__init__.py", line 27, in <module>
python: stdout/stderr (?):     from Cryptodome.Cipher._mode_ecb import _create_ecb_cipher
python: stdout/stderr (?):   File "/usr/lib/python3/dist-packages/Cryptodome/Cipher/_mode_ecb.py", line 47, in <module>
python: stdout/stderr (?):     """
python: stdout/stderr (?):   File "/usr/lib/python3/dist-packages/Cryptodome/Util/_raw_api.py", line 303, in load_pycryptodome_raw_lib
python: stdout/stderr (?):     raise OSError("Cannot load native module '%s': %s" % (name, ", ".join(attempts)))
python: stdout/stderr (?): OSError: Cannot load native module 'Cryptodome.Cipher._raw_ecb': Trying '_raw_ecb.cpython-37m-x86_64-linux-gnu.so': cannot load library '/usr/lib/python3/dist-packages/Cryptodome/Util/../Cipher/_raw_ecb.cpython-37m-x86_64-linux-gnu.so': /usr/lib/python3/dist-packages/Cryptodome/Util/../Cipher/_raw_ecb.cpython-37m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/usr/lib/python3/dist-packages/Cryptodome/Util/../Cipher/_raw_ecb.cpython-37m-x86_64-linux-gnu.so', Trying '_raw_ecb.abi3.so': cannot load library '/usr/lib/python3/dist-packages/Cryptodome/Util/../Cipher/_raw_ecb.abi3.so': /usr/lib/python3/dist-packages/Cryptodome/Util/../Cipher/_raw_ecb.abi3.so: cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/usr/lib/python3/dist-packages/Cryptodome/Util/../Cipher/_raw_ecb.abi3.so', Trying '_raw_ecb.so': cannot load library '/usr/lib/python3/dist-packages/Cryptodome/Util/../Cipher/_raw_ecb.so': /usr/lib/python3/dist-packages/Cryptodome/Util/../Cipher/_raw_ecb.so: cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/usr/lib/python3/dist-packages/Cryptodome/Util/../Cipher/_raw_ecb.so'
=!= python: unable to parse file "/home/user/.weechat/python/matrix.py"
$ python3 -m Cryptodome.SelfTest
Ran 2549 tests in 468.532s
$ pip3 freeze

aiofiles==0.4.0
aiohttp==3.8.0
aiohttp-socks==0.5.5
aiosignal==1.2.0
appdirs==1.4.4
asn1crypto==0.24.0
async-timeout==4.0.0
atomicwrites==1.4.0
attrs==21.2.0
cachetools==4.0.0
certifi==2018.8.24
cffi==1.15.0
chardet==3.0.4
charset-normalizer==2.0.7
cryptography==35.0.0
dbus-python==1.2.16
distlib==0.3.1
distro-info==0.21
entrypoints==0.3
filelock==3.0.12
frozenlist==1.2.0
future==0.18.2
h11==0.9.0
h2==3.2.0
hpack==3.0.0
httplib2==0.11.3
hyperframe==5.2.0
idna==2.6
importlib-metadata==1.6.0
jsonschema==3.2.0
keyring==17.1.1
keyrings.alt==4.0.2
Logbook==1.5.3
matrix-nio==0.17.0
more-itertools==4.2.0
multidict==5.1.0
mysqlclient==1.4.4
peewee==3.14.1
psycopg2==2.8.6
pycparser==2.20
pycryptodome==3.11.0
pycryptodomex==3.11.0
pycurl==7.43.0.6
Pygments==2.10.0
PyGObject==3.38.0
pyOpenSSL==21.0.0
pyrsistent==0.15.5
PySimpleSOAP==1.16.2
python-apt==2.2.1
python-debian==0.1.35
python-debianbts==2.8.2
python-magic==0.4.24
python-olm==3.2.1
python-potr==1.0.2
python-socks==1.2.4
pyxdg==0.25
reportbug===7.5.3-deb10u1
requests==2.26.0
SecretStorage==2.3.1
six==1.12.0
typing-extensions==3.7.4.3
unattended-upgrades==0.1
unpaddedbase64==1.1.0
urllib3==1.24.1
virtualenv==20.4.0+ds
webcolors==1.11.1
websocket-client==0.53.0
yarl==1.6.3
zipp==1.0.0
poljar commented 2 years ago

Seems like the pycryptodome install is broken somehow. Interestingly the self test doesn't fail, are you sure the same version is running inside of Weechat?

anadahz commented 2 years ago

Seems like the pycryptodome install is broken somehow. Interestingly the self test doesn't fail, are you sure the same version is running inside of Weechat?

Yes, I restarted Weechat to test it and again the self test succeeded.

anadahz commented 2 years ago

This was an issue related to an incorrect Python version Weechat was running.