Essay - Published: 2019.09.24 | asyncio | import-error | python | troubleshoot | tutorial |
DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)
I'm trying to use asyncio in my Python program but it keeps failing with ImportError: No module named asyncio. asyncio is supposed to be a built-in library so why is this failing?
Here's some example code I was able to reproduce it on:
import asyncio
async def main():
print("running")
asyncio.run(main())
You're write, asyncio is a built-in library for Python versions 3.7+. So if you're getting an error with the import, check your python version with python --version and make sure that you're running at least version 3.7.
I regularly post about tech topics I run into. You can get a periodic email containing updates on new posts and things I've built by subscribing here.
The best way to support my work is to like / comment / share for the algorithm and subscribe for future updates.