In this Python tutorial, we will discuss the value error **“matplotlib unknown projection ‘3d’ in python”**. Here we’ll cover the reason and solution related to this error using matplotlib. And we’ll also cover the following topics:

- Oldest Version Issue
- Installation Issue
- Syntax Error

## Matplotlib unknown projection ‘3d’

Here in this section, we will discuss various reasons and their solution for the error “**Matplotlib unknown projection ‘3d’**“

### Error#1: Oldest Version

Firstly understand that **mplot3D** works differently in different versions of matplotlib. Here we discuss the **ValueError: matplotlib unknown projection ‘3d**‘ in matplotlib version 0.99.

So firstly you have to confirm that which version are you using?

**Syntax to check the version:**

**# Import library**
import matplotlib
**# Check Version**
print matplotlib."__version__"

If you’re using **matplotlib 0.99**, in which case you’ll need to use slightly different syntax or upgrade to a more recent version.

**Let’s see the solution for this:**

#### Solution#1

The first and easiest way, to resolve this attribute error is to upgrade matplotlib to a recent version.

**Jupyter Notebook:**

The below command is used to upgrade matplotlib to the latest version in Jupyter Notebook.

`pip install --upgrade matplotlib`

**Anaconda Distribution:**

If you have Anaconda Prompt in your system, you can easily update matplotlib to the latest version, from here using the below-mentioned commands.

```
conda update matplotlib
#OR
conda update -all
```

Here the first command only updates the matplotlib package and the second updates all the packages.

#### Solution#2

The second way to resolve this error is to use a slightly different syntax instead of using the projection keyword argument.

**Use the following syntax:**

**# Import Library**
from mpl_toolkits.mplot3d import axes3d, Axes3D
**# Set Projection**
Axes3D()

### Error #2 Installation Issue

The first, reason is that maybe matplotlib is not installed.

**Jupyter Notebook:**

- To install matplotlib use the pip command.

`pip install matplotlib`

**Anaconda Distribution:**

- To install matplotlib use the conda command.

`conda install matplotlib`

The second, reason is that may be matplotlib is not properly installed. So, firstly, uninstall the matplotlib package and again install it. Above we discuss the installation of matplotlib. Here we discuss the uninstallation of matplotlib.

**Jupyter Notebook:**

- To uninstall matplotlib use the pip command.

`pip uninstall matplotlib`

**Anaconda Distribution:**

- To uninstall matplotlib use the conda command.

`conda uninstall matplotlib`

### Error#3 Syntax Error

If you are not using matplotlib’s oldest version and the matplotlib package is properly installed, but still, you get an error then maybe you have a syntax error.

**Below is the proper syntax:**

**# Import Library
**
from mpl_toolkits import mplot3d
**# Projection**
ax = plt.axes(projection="3d")

You may also like to read the following Matplotlib tutorials.

- How to install matplotlib python
- Matplotlib rotate tick labels
- What is add_axes matplotlib
- Matplotlib change background color
- Matplotlib plot a line (Detailed Guide)
- Matplotlib plot_date – Complete tutorial
- Matplotlib 1.3.1 requires nose which is not installed

In this Python tutorial, we have discussed **“matplotlib unknown projection ‘3d’”** and we have also covered the reason and solution related to it. These are the following topics that we have discussed in this tutorial.

- Oldest Version
- Installation Issue
- Syntax Error

Python is one of the most popular languages in the United States of America. I have been working with Python for a long time and I have expertise in working with various libraries on Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… I have experience in working with various clients in countries like United States, Canada, United Kingdom, Australia, New Zealand, etc. Check out my profile.