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.
What is the difference between ImportError and ModuleNotFoundError?
This trips up almost every Python developer:
ModuleNotFoundError = the whole package isn’t installed. import requests when requests isn’t pip-installed. Fix with pip install requests. We have a separate ModuleNotFoundError reference (198+ posts).
ImportError = the package IS installed, but a specific name/sub-module within it can’t be imported. 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.
How to fix any ImportError in 4 steps
Read the exact name and source module in quotes. The error has two parts: what you tried to import and which module it should be in. Example: ImportError: cannot import name 'parse_rule' from 'werkzeug.routing', the name is parse_rule, the module is werkzeug.routing.
Check the installed version of the source library. Run pip show . Note the version number.
Check when the name was added or removed. Look at the library’s CHANGELOG.md, GitHub release notes, or PyPI page. Often a function/class was removed in a major version (e.g., Werkzeug 2.0+ removed many internal helpers).
Pin the working version or update your import. Two paths: (a) Downgrade to the version that has the name: 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.
Most common ImportError patterns (in order of frequency)
Library version conflict: name was removed/renamed in a newer version (60%+ of errors here)
Python 2 → 3 migration: collections.Mapping moved to collections.abc.Mapping in Python 3.10
Sub-package reorganization: sklearn moved many internals out of sklearn.externals
Library reorg between versions: Flask, Werkzeug, Jinja2 frequently move internal helpers
Beta or development imports: trying to use features from main branch that aren’t in your installed version
Circular imports: your own code structure has two modules that import each other
DLL load failed: binary dependency (numpy, scipy) needs system library installed
Featured ImportError fixes by source library
🐍 Werkzeug / Flask / Jinja2 (web framework family)
Werkzeug 2.0+ moved many internal helpers. Flask 2.0+ moved imports. Jinja2 3.1+ removed deprecated names.
cannot import name ‘parse_rule’ from ‘werkzeug.routing’
cannot import name ‘cached_property’ from ‘werkzeug’
cannot import name ‘environmentfilter’ from ‘jinja2’
cannot import name ‘escape’ from ‘jinja2’
cannot import name ‘url’ from ‘django.conf.urls’ (Django 4.0+)
🤖 Machine Learning (TensorFlow, PyTorch, sklearn, torchmetrics)
ML libraries reorganize internals frequently between major versions.
cannot import name ‘container_abcs’ from ‘torch._six’
cannot import name ‘get_num_classes’ from ‘torchmetrics’
cannot import name ‘get_config’ from ‘tensorflow’ (eager context)
cannot import name ‘joblib’ from ‘sklearn.externals’
cannot import name ‘safe_weights_name’ from ‘transformers’
numba needs numpy 1.21 or less
🗄️ Database & SQLAlchemy
cannot import name ‘_rfc_1738_quote’ from ‘sqlalchemy.engine.url’
cannot import name ‘bigquery’ from ‘google.cloud’
cannot import name ‘CompilationException’ from ‘dbt.exceptions’
🐍 Python stdlib / typing / collections
Python 3.10+ moved many names between standard library locations. Older code breaks.
cannot import name ‘Mapping’ from ‘collections’ (Py3.10+)
cannot import name ‘TypeAlias’ from ‘typing’ (Py3.10+)
cannot import name ‘ParamSpec’ from ‘typing_extensions’
📦 setuptools / pip / packaging
cannot import name ‘Feature’ from ‘setuptools’, Quick Fixes
cannot import name ‘_unicodefun’ from ‘click’
🔁 Relative imports / circular imports / test modules
attempted relative import beyond top-level package
ImportError while importing test module
Failed to import test module
⚙️ Binary / DLL / native library load failures
Errors at the C-extension level, numpy, scipy, OpenCV, or system libraries.
numpy.core.multiarray failed to import
ImportError: dlopen
Failed to find libmagic, check your installation
Initialization failed (TensorFlow)
Unable to import required dependencies (numpy)
lxml not found, please install it
2026 Updated Guides: featured ImportError fixes
Failed to find libmagic, Quick Fixes: python-magic install
cannot import name ‘Feature’ from ‘setuptools’: setuptools migration
ImportError: dlopen: macOS native library load
Related error categories
ImportError is one of 10 hubs in our Python & JavaScript error reference cluster, 980+ documented fixes total. If your error isn’t an ImportError, jump to the right hub below:
TypeError Reference, 220+ Python & JS TypeError fixes
ModuleNotFoundError Reference, 198+ “No module named X” install errors
AttributeError Reference, 173+ “object has no attribute X” fixes
ValueError Reference, 100+ library-specific Python ValueError fixes
NameError Reference, 49+ Python “name X is not defined” fixes
RuntimeError Reference, 49+ PyTorch CUDA, asyncio, Flask runtime errors
SyntaxError Reference, 48+ Python & JavaScript parsing errors
ReferenceError Reference, 34+ JavaScript “is not defined” fixes
HTTP Error Reference, 35+ HTTP status code fixes
Python Tutorial, beginner-to-intermediate Python lessons
About this ImportError reference
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 …