13

Here's my python import statements

import plotly as py
import pandas as pd
import numpy as np

import plotly.plotly as py
import plotly.tools as plotly_tools
from plotly.graph_objs import *

os.environ['MPLCONFIGDIR'] = tempfile.mkdtemp()
from matplotlib.finance import quotes_historical_yahoo
import matplotlib.pyplot as plt

from scipy.stats import gaussian_kde

from IPython.display import HTML

It throws and ImportError ImportError: libSM.so.6: cannot open shared object file: No such file or directory

I know there is problem with this import statement import matplotlib.pyplot as plt

CodeNinja101
  • 1,091
  • 4
  • 11
  • 19

3 Answers3

26

Try this command if you are using ubuntu: pyqt4 might be missing

sudo apt-get install -y python-qt4

It worked for me.

Ganesh Pandey
  • 5,216
  • 1
  • 33
  • 39
  • If you're using Amazon Linux (ie. on AWS) or Red Hat Linux, this becomes `sudo yum install python-qt4` – StackG Nov 14 '18 at 04:55
  • This also resolves this warning after installing R through Conda on Ubuntu: ```doTryCatch(return(expr), name, parentenv, handler) : unable to load shared object '/var/opt/miniconda3/lib/R/modules//R_X11.so': libSM.so.6: cannot open shared object file: No such file or directory``` – Jas Mar 16 '19 at 02:29
1

This depends on the backend you're using for matplotlib.

It appears you're on the Qt backend. To avoid installing Qt, you can change it to something native to your distribution, such as GTKAgg

Ciprian Tomoiagă
  • 3,773
  • 4
  • 41
  • 65
0
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
lleiou
  • 475
  • 7
  • 13