This is a classic version incompatibility problem, and the good news is that the solution is simple.
In short, the error happens because you are trying to run a script
written for Python 2 with a
Python 3 interpreter.
- `cPickle` was a module in Python 2, used to save the program's progress. It was a faster version, written in the C language.
- In Python 3, `cPickle` was discontinued and its optimizations were incorporated directly into the standard `pickle` module. Therefore, Python 3 no longer recognizes the `import cPickle` command.
[\*] If you are seeing this error, it's almost certain that you have downloaded an old and outdated version of `btcrecover`, probably from the original "gurnec" repository, which hasn't been updated in years and was made for Python 2.7.
The Correct and Secure Solution: Use the Modern Version of BTCRecoverThe right way to solve this is to
ignore the old version and use the modern, actively maintained version of `btcrecover`, which is fully compatible with Python 3 and supports a much wider range of wallets and cryptocurrencies.
Follow these steps:
Step 1: Download the correct version of BTCRecoverGo to the official and current `btcrecover` repository on GitHub, maintained by "3rdIteration".
Step 2: Install Python 3If you don't have Python 3 yet, download the latest version. The modern version of `btcrecover` supports Python 3.9 or higher.
Step 3: Install dependenciesNow, let's install the libraries the script needs to run.
- Open the folder you unzipped in Step 1.
- In the Windows Explorer address bar, type `cmd` and press Enter. This will open the Command Prompt directly in the correct location.
- In the Command Prompt, type the following command and press Enter:
pip install -r requirements.txt
- Wait for the installation to finish. `pip` will automatically download and install everything needed.
Step 4: Run BTCRecoverDone\! Now you can run `btcrecover` without errors. The exact command depends on your wallet, but an example for a Bitcoin Core wallet with a password list would be:
python btcrecover.py --wallet "wallet.dat" --passwordlist "passwords.txt"
To verify that the installation was successful, you can run the included test script:
python run-all-tests.py -vv
Alternative Path (NOT RECOMMENDED\!)Someone might suggest installing Python 2.7 to run the old script.
DO NOT DO THIS.- Insecure: Python 2 has not received security updates since 2020. Using it to handle wallet files is an unnecessary risk.
- Outdated: The old version of `btcrecover` does not support newer wallet formats, like SegWit, or many altcoins that the modern version supports.
- Unstable: Installing old dependencies on modern operating systems can be a nightmare and cause more errors.
The effort is not worth it and the risks are high. Always use the modern and secure version.
Hope this helps! Good luck with your wallet recovery.