beardypig / streamlink-portable

A script to build a portable version of Streamlink for Windows
Apache License 2.0
77 stars 18 forks source link

OSError: Cannot load native module 'Crypto.Cipher._raw_ecb' #21

Open sdaau opened 3 years ago

sdaau commented 3 years ago

Just downloaded streamlink-portable-2.1.1-py3.6.5-amd64.zip, unpacked the streamlink folder inside in C:\bin.

Tried this, then, on Windows 10 Home 64-bit:

C:\>cd C:\bin\streamlink

C:\bin\streamlink>streamlink.bat
Traceback (most recent call last):
  File "C:\bin\streamlink\\streamlink-script.py", line 11, in <module>
    from streamlink_cli.main import main
  File "C:\bin\streamlink\packages\streamlink_cli\main.py", line 25, in <module>
    from streamlink.stream import StreamProcess
  File "C:\bin\streamlink\packages\streamlink\stream\__init__.py", line 5, in <module>
    from streamlink.stream.hls import HLSStream
  File "C:\bin\streamlink\packages\streamlink\stream\hls.py", line 8, in <module>
    from Crypto.Cipher import AES
  File "C:\bin\streamlink\packages\Crypto\Cipher\__init__.py", line 27, in <module>
    from Crypto.Cipher._mode_ecb import _create_ecb_cipher
  File "C:\bin\streamlink\packages\Crypto\Cipher\_mode_ecb.py", line 47, in <module>
    """
  File "C:\bin\streamlink\packages\Crypto\Util\_raw_api.py", line 297, in load_pycryptodome_raw_lib
    raise OSError("Cannot load native module '%s': %s" % (name, ", ".join(attempts)))
OSError: Cannot load native module 'Crypto.Cipher._raw_ecb': Trying '_raw_ecb.cp36-win_amd64.pyd': [WinError 126] The specified module could not be found, Trying '_raw_ecb.pyd': [WinError 193] %1 is not a valid Win32 application

C:\bin\streamlink>

Not sure what the problem is ... Ah, i guess this - in MSYS2 bash terminal:

$ find packages/Crypto/ -name '*ecb*'
packages/Crypto/Cipher/_mode_ecb.py
packages/Crypto/Cipher/_mode_ecb.pyi
packages/Crypto/Cipher/_raw_ecb.pyd
packages/Crypto/Cipher/__pycache__/_mode_ecb.cpython-36.pyc

$ file packages/Crypto/Cipher/_raw_ecb.pyd
packages/Crypto/Cipher/_raw_ecb.pyd: PE32 executable (DLL) (GUI) Intel 80386, for MS Windows

So, the .pyd is 32-bit - but as this is a 64-build, maybe that is the problem?

Tried deleting, byt .pyd does not get reconstructed automatically:

$ find packages/ -name '*.pyd' | while read file; do rm -v $file; done
removed 'packages/Crypto/Cipher/_ARC4.pyd'
removed 'packages/Crypto/Cipher/_chacha20.pyd'
removed 'packages/Crypto/Cipher/_raw_aes.pyd'
removed 'packages/Crypto/Cipher/_raw_aesni.pyd'
removed 'packages/Crypto/Cipher/_raw_arc2.pyd'
removed 'packages/Crypto/Cipher/_raw_blowfish.pyd'
removed 'packages/Crypto/Cipher/_raw_cast.pyd'
removed 'packages/Crypto/Cipher/_raw_cbc.pyd'
removed 'packages/Crypto/Cipher/_raw_cfb.pyd'
removed 'packages/Crypto/Cipher/_raw_ctr.pyd'
removed 'packages/Crypto/Cipher/_raw_des.pyd'
removed 'packages/Crypto/Cipher/_raw_des3.pyd'
removed 'packages/Crypto/Cipher/_raw_ecb.pyd'
removed 'packages/Crypto/Cipher/_raw_eksblowfish.pyd'
removed 'packages/Crypto/Cipher/_raw_ocb.pyd'
removed 'packages/Crypto/Cipher/_raw_ofb.pyd'
removed 'packages/Crypto/Cipher/_Salsa20.pyd'
removed 'packages/Crypto/Hash/_BLAKE2b.pyd'
removed 'packages/Crypto/Hash/_BLAKE2s.pyd'
removed 'packages/Crypto/Hash/_ghash_clmul.pyd'
removed 'packages/Crypto/Hash/_ghash_portable.pyd'
removed 'packages/Crypto/Hash/_keccak.pyd'
removed 'packages/Crypto/Hash/_MD2.pyd'
removed 'packages/Crypto/Hash/_MD4.pyd'
removed 'packages/Crypto/Hash/_MD5.pyd'
removed 'packages/Crypto/Hash/_poly1305.pyd'
removed 'packages/Crypto/Hash/_RIPEMD160.pyd'
removed 'packages/Crypto/Hash/_SHA1.pyd'
removed 'packages/Crypto/Hash/_SHA224.pyd'
removed 'packages/Crypto/Hash/_SHA256.pyd'
removed 'packages/Crypto/Hash/_SHA384.pyd'
removed 'packages/Crypto/Hash/_SHA512.pyd'
removed 'packages/Crypto/Math/_modexp.pyd'
removed 'packages/Crypto/Protocol/_scrypt.pyd'
removed 'packages/Crypto/PublicKey/_ec_ws.pyd'
removed 'packages/Crypto/Util/_cpuid_c.pyd'
removed 'packages/Crypto/Util/_strxor.pyd'

$ cmd.exe //c streamlink.bat
Traceback (most recent call last):
  File "C:\bin\streamlink\\streamlink-script.py", line 11, in <module>
    from streamlink_cli.main import main
  File "C:\bin\streamlink\packages\streamlink_cli\main.py", line 25, in <module>
    from streamlink.stream import StreamProcess
  File "C:\bin\streamlink\packages\streamlink\stream\__init__.py", line 5, in <module>
    from streamlink.stream.hls import HLSStream
  File "C:\bin\streamlink\packages\streamlink\stream\hls.py", line 8, in <module>
    from Crypto.Cipher import AES
  File "C:\bin\streamlink\packages\Crypto\Cipher\__init__.py", line 27, in <module>
    from Crypto.Cipher._mode_ecb import _create_ecb_cipher
  File "C:\bin\streamlink\packages\Crypto\Cipher\_mode_ecb.py", line 47, in <module>
    """
  File "C:\bin\streamlink\packages\Crypto\Util\_raw_api.py", line 297, in load_pycryptodome_raw_lib
    raise OSError("Cannot load native module '%s': %s" % (name, ", ".join(attempts)))
OSError: Cannot load native module 'Crypto.Cipher._raw_ecb': Trying '_raw_ecb.cp36-win_amd64.pyd': [WinError 126] The specified module could not be found, Trying '_raw_ecb.pyd': [WinError 126] The specified module could not be found

Well, at least no more of "is not a valid Win32 application" ...


EDIT: tried latest nightly, streamlink-portable-2.1.1+9.g44d4afa-py3.7.9-amd64.zip - that one seems to work:

C:\bin\streamlink>streamlink.bat
usage: streamlink [OPTIONS] <URL> [STREAM]

Use -h/--help to see the available options or read the manual at https://streamlink.github.io

So, that's good - I'm OK, but I'll leave the bug open, since as I understood it, streamlink-portable-2.1.1-py3.6.5-amd64.zip is still official stable release, and it seems it is broken.

beardypig commented 3 years ago

I will take a look.

valery1707 commented 3 years ago

I have the same problem. The nightly build streamlink-portable-2.1.1+14.g2884485-py3.7.9-amd64.zip works fine.

beardypig commented 3 years ago

It could be a transient issue, lemme rebuild the latest stables. @sdaau did you do a clean install or overwrite an older version?

beardypig commented 3 years ago

Shortly a new Python 3.7 base build will be available (when GitHub Actions decides to run the job) which might fix this issue for you @sdaau @valery1707

beardypig commented 3 years ago

Has this issue resolved itself @sdaau ?