Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'solana.rpc.async_api' #443

Closed
k3fjeee opened this issue Jul 25, 2024 · 6 comments
Closed

ModuleNotFoundError: No module named 'solana.rpc.async_api' #443

k3fjeee opened this issue Jul 25, 2024 · 6 comments

Comments

@k3fjeee
Copy link

k3fjeee commented Jul 25, 2024

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'

@michaelhly
Copy link
Owner

Can you run pip show solana? What does it output?

@joshephan
Copy link

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:

@michaelhly
Copy link
Owner

@joshephan would you mind updating to the latest and see if that issue still occurs?

@joshephan
Copy link

@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.

@memeboy111
Copy link

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.

@michaelhly
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants