3rdIteration / btcrecover

BTCRecover is an open source wallet password and seed recovery tool. For seed based recovery, this is primarily useful in situations where you have lost/forgotten parts of your mnemonic, or have made an error transcribing it. (So you are either seeing an empty wallet or gettign an error that your seed is invalid) For wallet password or passphrase recovery, it is primarily useful if you have a reasonable idea about what your password might be.
https://btcrecover.readthedocs.io/
GNU General Public License v2.0
551 stars 178 forks source link

Issue with OpenCL on Mac M1 #391

Open pmorange opened 1 year ago

pmorange commented 1 year ago

When activating opencl, seedrecover.py crashes with the following errors. I have everything installed and it seems to work otherwise (I launched samples of pyopencl where the problem seems to occur and they do not show any error). I may be missing something but I can't find what. Launching the script without opencl works well.

I am on a Mac M1 on Ventura 13.2 Python 3.10.9 pyopencl 2022.3 (also tried with 2022.2.4)



Interrupted after finishing password # 0
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/pyopencl/__init__.py", line 457, in __getattr__
    knl = Kernel(self, attr)
  File "/opt/homebrew/lib/python3.10/site-packages/pyopencl/__init__.py", line 812, in kernel_init
    kernel_old_init(self, prg, name)
pyopencl._cl.LogicError: clCreateKernel failed: INVALID_KERNEL

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/Users/N862667/btc_bruteForce/btcrecover/btcrecover/btcrpass.py", line 8117, in return_verified_password_or_false
    return loaded_wallet.return_verified_password_or_false(passwords)
  File "/Users/N862667/btc_bruteForce/btcrecover/btcrecover/btcrseed.py", line 948, in return_verified_password_or_false
    return self._return_verified_password_or_false_opencl(mnemonic_ids_list) if not isinstance(self.opencl_algo,int) \
  File "/Users/N862667/btc_bruteForce/btcrecover/btcrecover/btcrseed.py", line 1000, in _return_verified_password_or_false_opencl
    clResult = self.opencl_algo.cl_pbkdf2(self.opencl_context_pbkdf2_sha512[i], cleaned_mnemonic_ids_list,
  File "/Users/N862667/btc_bruteForce/btcrecover/lib/opencl_brute/opencl.py", line 706, in cl_pbkdf2
    result = concat(self.opencl_ctx.run(bufStructs, func, iter(passwordlist), salt))
  File "/Users/N862667/btc_bruteForce/btcrecover/lib/opencl_brute/opencl.py", line 525, in concat
    return [obj for lval in ll for obj in lval]
  File "/Users/N862667/btc_bruteForce/btcrecover/lib/opencl_brute/opencl.py", line 525, in <listcomp>
    return [obj for lval in ll for obj in lval]
  File "/Users/N862667/btc_bruteForce/btcrecover/lib/opencl_brute/opencl.py", line 264, in run
    func(self, pwdim, pass_g, salt_g, result_g)
  File "/Users/N862667/btc_bruteForce/btcrecover/lib/opencl_brute/opencl.py", line 703, in func
    prg.pbkdf2(s.queue, pwdim, None, pass_g, salt_g, result_g,
  File "/opt/homebrew/lib/python3.10/site-packages/pyopencl/__init__.py", line 474, in __getattr__
    raise AttributeError("'%s' was not found as a program "
AttributeError: 'pbkdf2' was not found as a program info attribute or as a kernel name
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/N862667/btc_bruteForce/btcrecover/./seedrecover.py", line 38, in <module>
    mnemonic_sentence, path_coin = btcrseed.main(sys.argv[1:])
  File "/Users/N862667/btc_bruteForce/btcrecover/btcrecover/btcrseed.py", line 3619, in main
    mnemonic_found = run_btcrecover(**phase_params)
  File "/Users/N862667/btc_bruteForce/btcrecover/btcrecover/btcrseed.py", line 3012, in run_btcrecover
    (mnemonic_found, not_found_msg) = btcrpass.main()
  File "/Users/N862667/btc_bruteForce/btcrecover/btcrecover/btcrpass.py", line 8683, in main
    for password_found, passwords_tried_last in password_found_iterator:
  File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 873, in next
    raise value
AttributeError: 'pbkdf2' was not found as a program info attribute or as a kernel name
UNSUPPORTED (log once): createKernel: newComputePipelineState failed```
3rdIteration commented 1 year ago

OpenCL on M1 isn't currently supported

pmorange commented 1 year ago

Oh ok, thanks for clarifying that, at least I'll stop trying to work around the problem :-p

dvncan commented 4 months ago

does this still exist? I am getting this output from an M2.

***@***-MBP-2 btcrecover % python3 run-all-tests.py -vv
Traceback (most recent call last):
  File "run-all-tests.py", line 58, in <module>
    from btcrecover.test import test_passwords
  File "/Users/***/Developer/btcrecover/btcrecover/__init__.py", line 2, in <module>
    from .btcrpass import *
  File "/Users/***/Developer/btcrecover/btcrecover/btcrpass.py", line 60, in <module>
    from Crypto.Cipher import AES
ModuleNotFoundError: No module named 'Crypto'
3rdIteration commented 4 months ago

does this still exist? I am getting this output from an M2.

***@***-MBP-2 btcrecover % python3 run-all-tests.py -vv
Traceback (most recent call last):
  File "run-all-tests.py", line 58, in <module>
    from btcrecover.test import test_passwords
  File "/Users/***/Developer/btcrecover/btcrecover/__init__.py", line 2, in <module>
    from .btcrpass import *
  File "/Users/***/Developer/btcrecover/btcrecover/btcrpass.py", line 60, in <module>
    from Crypto.Cipher import AES
ModuleNotFoundError: No module named 'Crypto'

I don't understand the question, but you just need to follow the installation guide... (As you are missing a required module)