I am working through Master Bitcoin. I got the bitcoin client up and running. I am now trying to access the client from python. In the example, there is a line that says from bitcoin.rpc import Rawproxy.

I get the error message no module named rpc. When I run pip freeze, I have python-bitcoinrpc==1.0 listed. Why can't this module be found?

3 Answers 3


in debian =)

sudo apt-get install libssl-dev

pip install python-bitcoinlib or pip3 install python-bitcoinlib

  • Thank you. That worked. Can I ask how you knew this? there seems to be no association to the library name in import and what you install. I looked everywhere online trying to figure out the library. Sep 25, 2017 at 19:57

bicoinlib is the module you try to use to handle bitcoind, bitcoin-cli in python, rpc module is part of bitcoinlib.

libssl-dev is needed to handle SSL and TLS cryptographic protocols .

if bitcoinlib not work in newer bitcoin core versions 0.15 or newer just use raw bitcoinrpc.authProxy module.


First, install libssl-dev:

sudo apt-get install libssl-dev

Install python3-pip if not yet:

sudo apt install python3-pip

Lastly, install python-bitcoinlib:

pip3 install python-bitcoinlib

In the example code, it is

info = p.getinfo()

Ran the example, I got "bitcoin.rpc.JSONRPCError: {'code': -32601, 'message': 'Method not found'}"

Change it to:

info = p.getblockchaininfo()

(see https://bitcoincore.org/en/doc/0.21.0/rpc/blockchain/getblockchaininfo/)

It works fine. I got the total number of blocks. In my case, it is 682903.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.