Q:

AttributeError: module 'ternary' has no attribute 'figure'

I'm trying out the supplied examples for ternary plots, but I'm getting the error 

AttributeError: module 'ternary' has no attribute 'figure'

As far as I can tell based on some searching this seems to be due to the way the package is imported. Don't see how I can do this differently though. (did try to reinstall the package)
To be clear: the file is not called ternary.py
import ternary
import matplotlib.pyplot as plt

## Boundary and Gridlines
scale = 30
figure, tax = ternary.figure(scale=scale)
figure.set_size_inches(10, 10)
figure.set_dpi(600)

# Draw Boundary and Gridlines
tax.boundary(linewidth=2.0)
tax.gridlines(color="black", multiple=6)
tax.gridlines(color="blue", multiple=2, linewidth=0.5)

# Set Axis labels and Title
fontsize = 20
tax.set_title("Simplex Boundary and Gridlines", fontsize=fontsize)
tax.left_axis_label("Left label $\\alpha^2$", fontsize=fontsize)
tax.right_axis_label("Right label $\\beta^2$", fontsize=fontsize)
tax.bottom_axis_label("Bottom label $\\Gamma - \\Omega$", fontsize=fontsize)

# Set ticks
tax.ticks(axis='lbr', linewidth=1)

# Remove default Matplotlib Axes
tax.clear_matplotlib_ticks()

ternary.plt.show()

Any ideas on how to solve this?

A:

Nice simple one. There are two libraries with "ternary" in their name. You must have done:
pip install ternary

This installs the wrong library; the library you want is from:
pip install python-ternary

You will want to run:
pip uninstall ternary

Prior to installing the correct version.

