Importerror: install s3fs to access s3
Have you ever come across the error message Importerror: install s3fs to access s3 while trying to access S3 buckets? It can be frustrating, especially when you need to upload …
itsourcecode.com hosts 67+ documented fixes for Python ImportError messages — the error class raised when a library is found but a specific name or sub-module within it can’t be imported. Almost every ImportError in modern Python comes from version conflicts: you have the library installed, but the version you have removed/renamed the specific function or class you’re trying to import. Browse the fixes below by library or scenario.
This trips up almost every Python developer:
import requests when requests isn’t pip-installed. Fix with pip install requests. We have a separate ModuleNotFoundError reference (198+ posts).from requests import nonexistent. Fix usually means upgrading or downgrading the library to the version that contains that name.ModuleNotFoundError is actually a subclass of ImportError, introduced in Python 3.6. If you catch ImportError, you catch both.
ImportError: cannot import name 'parse_rule' from 'werkzeug.routing' — the name is parse_rule, the module is werkzeug.routing.pip show <library>. Note the version number.pip install werkzeug<2.0. (b) Find the new import location: from werkzeug.routing.rules import parse_rule (or whatever the new path is). Update your code.collections.Mapping moved to collections.abc.Mapping in Python 3.10sklearn.externalsWerkzeug 2.0+ moved many internal helpers. Flask 2.0+ moved imports. Jinja2 3.1+ removed deprecated names.
ML libraries reorganize internals frequently between major versions.
Python 3.10+ moved many names between standard library locations. Older code breaks.
Errors at the C-extension level — numpy, scipy, OpenCV, or system libraries.
You’re hitting “cannot import name X from Y” — the package IS installed, but the specific name (function, class, attribute) you’re trying to import isn’t in the version you have. This is different from ModuleNotFoundError. Check the library’s release notes for when the name was added/removed/renamed, then either: (a) install the version that has it, or (b) update your import to the new location.
Python 3.10 removed deprecated imports from collections that were moved to collections.abc in Python 3.3. The deprecation warnings ran for 7 years before removal. Fix: change from collections import Mapping to from collections.abc import Mapping. The same applies to Iterable, Hashable, Callable, and other ABCs.
Flask 2.0+ requires Werkzeug 2.0+ and removed many internal helpers. If you see cannot import name X from werkzeug..., you have two options: (1) pin compatible versions in requirements.txt: Flask==2.3.2 Werkzeug==2.3.7. (2) Update your code to use the new import locations (the Werkzeug 2.0 migration guide documents most of them). Don’t try to mix old Werkzeug with new Flask or vice versa.
Two of YOUR modules import from each other, creating a chicken-and-egg problem. Module A starts loading and imports B; B tries to import something from A; A isn’t fully loaded yet → ImportError. Fix by restructuring: (1) move shared code into a third module both can import from; (2) move the import statement inside the function instead of at module top; (3) refactor to remove the circular dependency.
You used from ..parent import X in a script you ran directly with python script.py. Relative imports only work when Python knows the package structure — meaning the script must be loaded as part of a package, not run as a standalone file. Fix: run with python -m mypackage.script instead, OR use absolute imports.
ModuleNotFoundError reference (198+ posts) covers errors where the whole package isn’t installed — “No module named requests” means run pip install requests. This ImportError reference covers errors where the package IS installed but a specific name within it can’t be imported — usually a version conflict. Different root causes, different fixes. See ModuleNotFoundError reference →
New posts are added weekly. Existing posts are revised when major library versions ship breaking changes (Flask 3, Werkzeug 3, NumPy 2, etc.). This page was last refreshed in May 2026.
This ImportError reference has been built since 2015 by PIES Information Technology Solutions in Binalbagan, Negros Occidental, Philippines. Every post comes from a real error encountered in production. Used by 12,000+ Python developers monthly across the Philippines, India, the United States, and beyond. If your ImportError isn’t here, send the full traceback to our contact form and we’ll add it.
Have you ever come across the error message Importerror: install s3fs to access s3 while trying to access S3 buckets? It can be frustrating, especially when you need to upload …
When you encounter ImportError cannot import name ‘safe_str_cmp’ from ‘werkzeug.security’ while working with Python, it can be a frustrating experience. Obviously, this error indicates that there is an issue with …
Have you ever come across the “ImportError: cannot import name ‘legacyversion’ from ‘packaging.version‘” error message? If you’re a Python developer, there’s a good chance you have. This error message can …
Have you come across ImportError: Failed to import any Qt binding error at some point? Well, this article will explore the ImportError: Failed to import any Qt binding error in …
Had a chance to come across the “ImportError: Cannot Import Name ‘log’ from ‘distutils.log’” error? Well, you will encounter this when trying to import the log module from the Distutils …
Are you encountering reads “ImportError: cannot import name ‘iterable’ from collections“? This error means that the code is trying to import the “iterable” module from the “collections” package, but it …
Working in Python as a developer, it’s likely to face the “ImportError: lxml not found please install it” error message. In particular, this error arises when you try to import …
When working with Python, chances are that you may encounter ImportError: No module named pathlib. Particularly, pathlib is a module in the Python Standard Library that provides an object-oriented approach …
Being a Python programmer who uses Jupyter Notebook, you may have come across the importerror: iprogress not found. please update jupyter and ipywidgets. error. This error specifically implies that the …
If you are a Python developer and working with AWS SDK, you might have encountered the “ImportError: cannot import name ‘docevents’ from ‘botocore.docs.bcdoc‘” error at some point. Actually this error …
“ImportError: No module named ‘site’” is a common error that can occur when trying to run a Python script or program. This error indicates that the Python interpreter is unable …
“ImportError: cannot import name dataclass_transform” error is one of the common errors you might encounter while working with Python code. This error occurs for various reasons, this is why in …
At some point in your Python programming journey, chances you have come across the “ImportError: cannot import name ‘contextfilter’ from ‘jinja2‘” error. This error can be frustrating, especially if you …