Cannot import python-bitcoinrpc I am unable to import the package bitcoinrpc.
I have installed it in python2 and python3 using python3 -m pip install python-bitcoinrpc/python -m pip install python-bitcoinrpc AND by cloning the repo and editing the python environment in setup.py to my python2 and 3 path. Which returns Requirement already satisfied: python-bitcoinrpc in /home/a/.local/lib/python3.6/site-packages (1.0)
Even after that I get the following errors:
Python2: ImportError: No module named authproxy
Python3: ModuleNotFoundError: No module named 'bitcoinrpc.authproxy'; 'bitcoinrpc' is not a package
Following is my code:
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException

# rpc_user and rpc_password are set in the bitcoin.conf file
rpc_user = &quot;xxx&quot;
rpc_password = &quot;xxx&quot;
rpc_connection = AuthServiceProxy(&quot;http://%s:%s@127.0.0.1:8332&quot;%(rpc_user, rpc_password))

print(rpc_connection.get_info())

I have searched as much as I could but, cannot find anyting except for this bitcoin stackexchange question without an answer.
ENV: OS: Mint 19.1 with Anaconda where which python(3) return /usr/bin/python(3)
Is the setup broken or am I missing something?
Any help is appreciated. Thank you!
I had named my script bitcoinrpc.py and had the import bitcoinrpc. Naturally it couldn't find the package. Renamed the script and it works.
Lesson: DO NOT have a file of the same name as the package you are trying to import.