solana-py
solana-py copied to clipboard
ModuleNotFoundError: No module named 'solana.rpc.async_api'
import asyncio from solana.rpc.async_api import AsyncClient
async def main(): async with AsyncClient("https://api.devnet.solana.com") as client: res = await client.is_connected() print(res) # True
# Alternatively, close the client explicitly instead of using a context manager:
client = AsyncClient("https://api.devnet.solana.com")
res = await client.is_connected()
print(res) # True
await client.close()
asyncio.run(main())
from solana.rpc.async_api import AsyncClient
ModuleNotFoundError: No module named 'solana.rpc.async_api'
Can you run pip show solana? What does it output?
Can you run
pip show solana? What does it output?
same, my pip show solana result this:
Name: solana Version: 0.30.2 Summary: Solana Python API Home-page: https://github.com/michaelhly/solanapy Author: Michael Huang Author-email: [email protected] License: MIT Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages Requires: cachetools, construct-typing, httpx, solders, types-cachetools, typing-extensions, websockets Required-by:
@joshephan would you mind updating to the latest and see if that issue still occurs?
@joshephan would you mind updating to the latest and see if that issue still occurs?
I've been tried multiple times to upgrade version, it's not working for me. Even if I install newest version of python 3.12.4. So I continued to check the problem and found that in the Mac environment I use, the Python file is called via python3, so I set alias python = python3 in .bash_profile and ran pip install --upgarde, and only then did the upgrade proceed.
The issue of not being detected after a version upgrade has now been resolved.
hey did you find out how to fix that error. Im using mac os and when i run my code, it is showing module not found : solana transaction. i have tried upgrading the solana and as well as downgrading. kindly help.
Please see https://michaelhly.com/solana-py/core/api/
Dont save your file as solana.py. if you saved it has solana.py change it to something else