Black Lives Matter. Please consider donating to Black Girls Code today.

API installation problems: Ubuntu 16.04, Python 3.5.2, Anaconda 4.2.0

Greetings,

I enjoyed using Plot.ly last year and was looking forward to using it again this year. But when I went to install Plot.ly on my Ubuntu 16.04 distribution, everything went well (following Plot.ly’s instructions) until I tried importing plotly.

import plotly
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named ‘plotly’

I suspect Python is looking for Plotly in the wrong directory. Should I perhaps move Plot.ly or perhaps tell Python to look somewhere else? “locate plotly” finds it in /usr/local/lib/python3.5/dist-packages/plotly

It looks like perhaps this is a problem created by Anaconda. The output of sys.path:

print(’\n’.join(sys.path))

/home/rybu/prog/anaconda3/lib/python35.zip
/home/rybu/prog/anaconda3/lib/python3.5
/home/rybu/prog/anaconda3/lib/python3.5/plat-linux
/home/rybu/prog/anaconda3/lib/python3.5/lib-dynload
/home/rybu/prog/anaconda3/lib/python3.5/site-packages
/home/rybu/prog/anaconda3/lib/python3.5/site-packages/Sphinx-1.4.6-py3.5.egg
/home/rybu/prog/anaconda3/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg

I installed plotly using the plotly instructions, i.e. using pip. Last year I did not have Anaconda installed, but it was also an earlier distribution of Ubuntu.

edit: after adding

import sys
sys.path.append("/usr/local/lib/python3.5/dist-packages")

plotly works fine. . . as far as I can tell. It appears my trouble is Anaconda and pip don’t fully “get along”. It’s unclear if this is the most useful solution, but it works for now.