pyca / pynacl

Python binding to the Networking and Cryptography (NaCl) library
https://pynacl.readthedocs.io/
Apache License 2.0
1.07k stars 232 forks source link

ImportError: /opt/svc_sig/royde-dir/nacl-env/lib/python3.5/site-packages/nacl/_sodium.cpython-35m-x86_64-linux-gnu.so: undefined symbol: crypto_pwhash_argon2id_opslimit_moderate #477

Closed DeTeReR closed 6 years ago

DeTeReR commented 6 years ago

Duplicate of/similar to https://github.com/pyca/pynacl/issues/474 or https://github.com/pyca/pynacl/issues/465 ?

On the release of pynacl 1.3.0 we started seeing this problem:

$ conda create -y  -p /opt/svc_sig/royde-dir/nacl-env python=3.5
$ source activate /opt/svc_sig/royde-dir/nacl-env
$ pip install paramiko
$ python -c "import paramiko"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/svc_sig/royde-dir/nacl-env/lib/python3.5/site-packages/paramiko/__init__.py", line 22, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "/opt/svc_sig/royde-dir/nacl-env/lib/python3.5/site-packages/paramiko/transport.py", line 90, in <module>
    from paramiko.ed25519key import Ed25519Key
  File "/opt/svc_sig/royde-dir/nacl-env/lib/python3.5/site-packages/paramiko/ed25519key.py", line 22, in <module>
    import nacl.signing
  File "/opt/svc_sig/royde-dir/nacl-env/lib/python3.5/site-packages/nacl/signing.py", line 17, in <module>
    import nacl.bindings
  File "/opt/svc_sig/royde-dir/nacl-env/lib/python3.5/site-packages/nacl/bindings/__init__.py", line 17, in <module>
    from nacl.bindings.crypto_aead import (
  File "/opt/svc_sig/royde-dir/nacl-env/lib/python3.5/site-packages/nacl/bindings/crypto_aead.py", line 18, in <module>
    from nacl._sodium import ffi, lib
ImportError: /opt/svc_sig/royde-dir/nacl-env/lib/python3.5/site-packages/nacl/_sodium.cpython-35m-x86_64-linux-gnu.so: undefined symbol: crypto_pwhash_argon2id_opslimit_moderate

We didn't see this with pynacl 1.2.1

Extra info:

bash-4.2$ pip freeze
asn1crypto==0.24.0
bcrypt==3.1.4
certifi==2016.2.28
cffi==1.11.5
cryptography==2.3.1
idna==2.7
paramiko==2.4.2
pyasn1==0.4.4
pycparser==2.19
PyNaCl==1.3.0
six==1.11.0

bash-4.2$ conda --version
conda 4.3.30

bash-4.2$ cat /etc/os-release.orig
NAME="Amazon Linux AMI"
VERSION="2017.09"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2017.09"
PRETTY_NAME="Amazon Linux AMI 2017.09"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2017.09:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"

I'm sorry that my example complicates things with conda.

If we instead just install pynacl, rather than paramiko:

bash-4.2$ pip install PyNaCl

bash-4.2$ python -c "import nacl.signing"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/svc_sig/royde-dir/nacl-env/lib/python3.5/site-packages/nacl/signing.py", line 17, in <module>
    import nacl.bindings
  File "/opt/svc_sig/royde-dir/nacl-env/lib/python3.5/site-packages/nacl/bindings/__init__.py", line 17, in <module>
    from nacl.bindings.crypto_aead import (
  File "/opt/svc_sig/royde-dir/nacl-env/lib/python3.5/site-packages/nacl/bindings/crypto_aead.py", line 18, in <module>
    from nacl._sodium import ffi, lib
ImportError: libsodium.so.18: cannot open shared object file: No such file or directory

bash-4.2$ pip freeze
certifi==2016.2.28
cffi==1.11.5
pycparser==2.19
PyNaCl==1.3.0
six==1.11.0

Any help/advice greatly appreciated.

reaperhulk commented 6 years ago

It apparently can't find your libsodium, which is odd. This may be an issue with compilation -- try doing the following pip uninstall pynacl && pip install --no-cache-dir pynacl. That will cause it to potentially download the 1.3.0 wheel (which may not have been uploaded when you encountered this problem)

DeTeReR commented 6 years ago

Using wheels does indeed fix it for me. Thank you @reaperhulk