iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
The error AttributeError: module 'matplotlib' has no attribute 'artist' happens while Python is importing Matplotlib, often before your code gets as far as drawing a plot. The message alone does not identify the cause. Check the traceback, confirm which Python and Matplotlib installation your failing process is using, and then investigate local name conflicts or repair that specific environment.
What the error means—and what it does not prove
In a 2018 Matplotlib issue, the reported traceback occurred during import matplotlib.pyplot: Matplotlib’s colorbar module attempted import matplotlib.artist as martist, and the import failed. The reporter was using Windows 10, Python 3.6.7, and Matplotlib 3.0.0 installed from Anaconda’s default channel. The report followed package updates, but the reporter did not establish that an update caused the failure. Matplotlib issue #12626
That is a historical, environment-specific example—not proof that every occurrence has the same cause. The exception tells you an import failed; by itself it does not establish whether the installation is damaged, the wrong Python environment is active, a project file is interfering with imports, or another condition is involved.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsStart with the traceback
Read the complete traceback from the bottom upward, then identify the first frame outside Matplotlib and the import that failed. In the historical report, the failing import was in matplotlib.colorbar; your traceback may point elsewhere. Save the full output rather than relying only on the final line, because the preceding frames show how execution reached the error.
#1 Best Overall
Verify the Python interpreter and Matplotlib path
Run these checks in the same terminal, IDE, or notebook kernel that produces the error. They show the package version and the file Python resolved as Matplotlib:
import matplotlib
print(matplotlib.__version__)
print(matplotlib.__file__)
Compare the printed path with the environment you intended to use. If it points to a different environment, changing packages elsewhere will not change what the failing process imports. Matplotlib's installation guide documents these checks and installation options. Matplotlib installation and troubleshooting
Rank #2
Check for project files that shadow Matplotlib
Python imports modules by name. A file named matplotlib.py or a directory named matplotlib in your project can therefore affect what Python finds. This is a diagnostic possibility, not a confirmed explanation for the historical Matplotlib issue.
Free tools Windows power users keep installed
One-click scans. No signup required.
- Inspect the working directory and project for
matplotlib.pyor amatplotlib/directory. - If you find a conflicting name, rename it and remove any stale
__pycache__associated with it. - Restart the Python process, IDE kernel, or notebook kernel before testing again.
Python's module documentation explains that modules are imported by name. Python tutorial: Modules
Test in a clean process
Try a short script from a shell or command prompt, using the Python executable for the environment you expect to run. Matplotlib's troubleshooting guidance recommends testing outside interactive shells or IDEs when those tools may add complexity. If the import works in the clean process but fails only in a notebook or IDE, check that tool's selected interpreter or kernel and restart it before changing packages. Matplotlib installation and troubleshooting
Repair the environment that is actually running
Use the package manager and Python executable associated with the failing environment. Matplotlib documents pip, conda, pixi, and uv installation routes; for production installations, it recommends using prebuilt packages where possible. Avoid mixing package managers without first confirming how that environment is managed. Matplotlib installation and troubleshooting
If the environment uses pip
Activate the intended environment, then run:
python -m pip install -U matplotlib
Using python -m pip ties pip to the selected Python executable more directly than invoking a standalone pip command. If your system requires a versioned executable, use that executable consistently for both installation and verification.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
If the environment uses conda or another manager
Follow Matplotlib's documented instructions for that manager and the environment in question. In particular, do not run a pip repair command in one environment and assume it changed a conda-managed environment used by a different interpreter. The official guide lists the supported installation routes. Matplotlib installation and troubleshooting
Best Value
Verify the result
After a repair, restart the failing process and repeat the version and __file__ checks in that process. Then retry the original import. If the path did not change as expected, the install command likely targeted a different Python environment; resolve that mismatch before repeating the repair.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

