Do note if you have multiple installations, using the command python/pip or python3/pip3, might execute a different python version.
Within your current Python environment, make sure you have installed the package. Check using "pip list" command or, run a Python shell, then type out "help('modules')", to see if those particular packages exist. If it does not, the PATH variable on your terminal might haven't yet been set up correctly.
As last resort, You should try to install the package using "conda install
" way or install the package directly.
When I do pip list (from within the virtualenv) I see:
bitcoin 1.1.42
pip 22.3.1
python-bitcoinrpc 1.0
setuptools 65.6.3
wheel 0.38.4
When I run the script:
import bitcoin
from bitcoin.rpc import Proxy
# create a connection to the local bitcoin node
conn = Proxy(
service_url='http://user:pass@localhost:8332/'
)
print("conn is ")
print(conn)
# list the transactions in the wallet
print(conn.listtransactions())
I get the error:
from bitcoin.rpc import Proxy
ModuleNotFoundError: No module named 'bitcoin.rpc'
When I deactivate and run again, I get:
print(conn.listtransactions())
AttributeError: 'Proxy' object has no attribute 'listtransactions'
Which is a new problem, but does show that for whatever reason, the bitcoin lib cant be used within a virtual env