Author

Topic: python-bitcoinrpc: modulenotfounderror no module named 'bitcoinrpc' (Read 258 times)

newbie
Activity: 5
Merit: 2
Is there a video tutorial on Youtube/elsewhere on how to make json-rpc calls from python, or to use this python-bitcoinrpc library? The instructions are very sparse on the github page and I'm keen to learn this. I'm sure many people are as keen as I am, but I can't find any such video.
newbie
Activity: 5
Merit: 2
Thanksfor your reply! How/ where do I adjust the path, please? I installed the package directly using "pip3 install python-bitcoinrpc". And then I tried importing it from within my python script (I use spyder IDE). Sorry for the noob question but where should I be adjusting paths and what should the new path be, please?
legendary
Activity: 1624
Merit: 2481
Actually it should also work with python3.

Python can be quite cocky with the 'Module not found' errors.
You might have to adjust the path to get it working.

But syntactically there is not a lot of difference between python3 and python2. Those are just minimal.
If you are familiar with python3, you will easily be able to get your code working in python2.


Your only 2 options are to either get it working via adjusting paths / making changes to the package or using python2.
newbie
Activity: 5
Merit: 2
Thank you for your reply. Afraid I haven't tried with python 2.7. I'm new to python and have spent quite a lot of time making stuff with python 3 so I would like to avoid moving to python 2 now. Would you happen to know any other way in which I can make the json-rpc calls to bitcoind from python 3? Appreciate your help.
HCP
legendary
Activity: 2086
Merit: 4361
I'm running bitcoind/ bitcoind -regtest on Windows 10 and am already able to use bitcoin-cli -regtest along with json-rpc methods to perform basic operations and get balances etc. When I try to do this programmatically on python 3 using Jeff Garzik's python-bitcoinrpc package (https://github.com/jgarzik/python-bitcoinrpc)
 I get a modulenotfounderror. However, my pip3 freeze shows python-bitcoinlib==0.10.1 and also python-bitcoinrpc==1.0.
What am I doing wrong?

Well... according to the install instructions on github... it looks like this might be Python 2 only...
change the first line of setup.py to point to the directory of your installation of python 2.*

Have you tried it with a Python 2.7 install? Huh
newbie
Activity: 5
Merit: 2
I'm running bitcoind/ bitcoind -regtest on Windows 10 and am already able to use bitcoin-cli -regtest along with json-rpc methods to perform basic operations and get balances etc. When I try to do this programmatically on python 3 using Jeff Garzik's python-bitcoinrpc package (https://github.com/jgarzik/python-bitcoinrpc) I get a modulenotfounderror. However, my pip3 freeze shows python-bitcoinlib==0.10.1 and also python-bitcoinrpc==1.0.

My code is below (18443 is the regtest port):
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException

rpc_connection = AuthServiceProxy("http://%s:%[email protected]:18443"%("myrpcuser", "myrpcpassword"))
best_block_hash = rpc_connection.getbestblockhash()
print(rpc_connection.getblock(best_block_hash))

What am I doing wrong?
Jump to: