question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError: cannot import name utils

See original GitHub issue

Not able to run Plot.ly because of error:

Traceback:

import plotly
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-35-9c23c5c2643a> in <module>()
      2 import numpy as np
      3 import dateutil
----> 4 import plotly

~/ipython-venv/lib/python2.7/site-packages/plotly/__init__.py in <module>()
     29 from __future__ import absolute_import
     30 
---> 31 from plotly import (plotly, graph_objs, grid_objs, tools, utils, session,
     32                     offline)
     33 from plotly.version import __version__

~/ipython-venv/lib/python2.7/site-packages/plotly/plotly/__init__.py in <module>()
      8 
      9 """
---> 10 from . plotly import (
     11     sign_in,
     12     update_plot_options,

~/ipython-venv/lib/python2.7/site-packages/plotly/plotly/plotly.py in <module>()
     29 from requests.auth import HTTPBasicAuth
     30 
---> 31 from plotly import exceptions, tools, utils, version, files
     32 from plotly.plotly import chunked_requests
     33 from plotly.session import (sign_in, update_session_plot_options,

~/ipython-venv/lib/python2.7/site-packages/plotly/tools.py in <module>()
     16 import math
     17 
---> 18 from plotly import utils
     19 from plotly import exceptions
     20 from plotly import graph_reference

ImportError: cannot import name utils

Requirements.txt:

appnope (0.1.0)
backports-abc (0.4)
backports.ssl-match-hostname (3.5.0.1)
beautifulsoup4 (4.4.1)
brewer2mpl (1.4.1)
certifi (2015.11.20.1)
cycler (0.9.0)
decorator (4.0.9)
functools32 (3.2.3.post2)
ggplot (0.6.8)
gnureadline (6.3.3)
ipykernel (4.2.2)
ipython (4.1.1)
ipython-genutils (0.1.0)
Jinja2 (2.8)
jsonschema (2.5.1)
jupyter-client (4.1.1)
jupyter-core (4.0.6)
MarkupSafe (0.23)
matplotlib (1.5.1)
mechanize (0.2.5)
mistune (0.7.1)
nbconvert (4.1.0)
nbformat (4.0.1)
notebook (4.1.0)
numpy (1.10.4)
pandas (0.17.1)
path.py (8.1.2)
patsy (0.4.1)
pexpect (4.0.1)
pickleshare (0.6)
pip (8.0.2)
plotly (1.9.5)
ptyprocess (0.5.1)
Pygments (2.1.1)
pyparsing (2.1.0)
python-dateutil (2.4.2)
pytz (2015.7)
pyzmq (15.2.0)
requests (2.9.1)
scipy (0.17.0)
selenium (2.52.0)
setuptools (20.1.1)
simplegeneric (0.8.1)
singledispatch (3.4.0.3)
six (1.10.0)
statsmodels (0.6.1)
termcolor (1.1.0)
terminado (0.6)
tornado (4.3)
traitlets (4.1.0)
utils (0.9.0)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
actongortoncommented, Feb 16, 2016

Okay, I think that I’ve found something more consistent with this.

If I import matplotlib before trying to import plotly, then the “cannot import name utils” error appears.

If I restart the Python kernel and skip trying to load matplotlib, then the utils error does not appear.

I’m using inotebook and have been trying to figure out why I’ve been getting the insecure string pickle error with matplotlib, which is why I was trampling on top of other libraries.

0reactions
jonmmeasecommented, Sep 21, 2018

Hi @actongorton, I’m going to close this issue for now since plotly.py has been largely rewritten over the last two years, but feel free to open a new issue if you’re having similar problems with ploty.py version 3. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python ImportError: cannot import name utils - Stack Overflow
We may see the unable to import utils error in multiple contexts. I got this error message when I was migrating scripts from...
Read more >
ImportError: cannot import name util · Issue #739 - GitHub
Run cli command 'pip install checkov'. root@buster:~# pip install checkov Collecting checkov Downloading ...
Read more >
[Django] #16136: Error was: cannot import name utils
File "/usr/share/django/Django-1.3/django/db/backends/mysql/base.py", line 28, in <module> from django.db import utils ImportError: cannot import name utils
Read more >
How to Fix : “ImportError: Cannot import name X” in Python
The following are the major reasons for the occurrence of "ImportError: cannot import name": The imported class is in a circular dependency.
Read more >
How to Fix ImportError: Cannot Import Name in Python - Rollbar
The Python ImportError: cannot import name error occurs when an imported class is not accessible or is in a circular dependency.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found