tiran/pysha3

Keccak implementations missing when installed from pip

sohkai opened this issue · 2 comments

The following error comes up when trying to import sha3 on Python 3.6, after using pip to install pysha3 (both 1.0.0 and 1.0.1):

Python 3.6.0 (default, Feb  2 2017, 12:13:44)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sha3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Brett/.pyenv/versions/bigchaindb-3.6/lib/python3.6/site-packages/sha3.py", line 8, in <module>
    from _sha3 import keccak_224, keccak_256, keccak_384, keccak_512
ImportError: cannot import name 'keccak_224'

Inspecting an imported _sha3:

>>> import _sha3
>>> dir(_sha3)
['__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'implementation', 'keccakopt', 'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512', 'shake_128', 'shake_256']

(So everything but the keccak implementations is available)

To install, I used a normal pip install:

pip install pysha3

This happens on native OSX (10.11), macOS (10.12), and on a docker container running the official 3.6 alpine image.

I'm not sure what's going on, since it looks like the PY_WITH_KECCAK flag is defined, but maybe it's not getting built with it?


Everything works fine on 3.5.

tiran commented

Thanks for your report. It was a conflict between Python 3.6's ext module and pysha3's ext module. They both used the same module name. It should be fixed now. Please checkout master and run tests with tox on your Mac.

Thanks!

I ran the tox tests for both the current master and for the commit before #5, but oddly, the tests were passing in each.

However, if I locally build and then import sha3, I can confirm that #5 does fix the issue.