Dash: [BUG]ModuleNotFoundError: No module named '_plotly_future_'

Created on 25 Jun 2019  路  11Comments  路  Source: plotly/dash

Describe your context
Please provide us your environment so we can easily reproduce the issue.
I am using Python 3.6.6 from the Anaconda rpi repository. I am using berryconda to create a conda virtual environment.

dash                 0.43.0
dash-core-components 0.48.0
dash-daq             0.1.5
dash-html-components 0.16.0
dash-renderer        0.24.0
dash-table           3.7.0
  • if frontend related, tell us your Browser, Version and OS

    • OS: [Raspbian Stretch]
    • Browser [Web ]
    • Version [ 3.8.2]

Describe the bug

Whenever I run a python script which imports the Dash module, a ModuleNotFoundExceptionError is thrown:

Exception has occurred: ModuleNotFoundError
No module named '_plotly_future_'
  File "/home/pi/tdunit/app.py", line 3, in <module>
    import dash
  File "/home/pi/berryconda3/envs/tdunitenv/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/pi/berryconda3/envs/tdunitenv/lib/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/home/pi/berryconda3/envs/tdunitenv/lib/python3.6/runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)

Expected behavior

I expect the program to execute normally. I have even tried the getting started example for Dash and the same error occurs.

Screenshots

Dash_error

dash-type-bug

All 11 comments

weird - _plotly_future_ should have come in with plotly. What version of the plotly package do you have?
@jonmmease any idea what's going on?

This kind of thing is usually caused by there being multiple copies of plotly.py installed at the same time. Can you check the output of

pip list

and

conda list

to see what versions of the plotly package are installed?

@alexjohnson, @jonmmease it appears that I have only 1 version of plotly:

(tdenv) pi@tdunit:~ $ conda list
# packages in environment at /home/pi/berryconda3/envs/tdenv:
#
# Name                    Version                   Build  Channel
attrs                     19.1.0                    <pip>
ca-certificates           2018.8.24                     0  
certifi                   2018.8.24                py36_1  
chardet                   3.0.4                     <pip>
Click                     7.0                       <pip>
dash                      0.36.0                    <pip>
dash-core-components      0.42.1                    <pip>
dash-daq                  0.1.4                     <pip>
dash-html-components      0.13.4                    <pip>
dash-renderer             1.0.0                     <pip>
DateTime                  4.2                       <pip>
decorator                 4.4.0                     <pip>
Flask                     1.0.3                     <pip>
Flask-Compress            1.4.0                     <pip>
gunicorn                  19.8.1                    <pip>
idna                      2.8                       <pip>
ipython-genutils          0.2.0                     <pip>
itsdangerous              1.1.0                     <pip>
Jinja2                    2.10.1                    <pip>
jsonschema                3.0.1                     <pip>
jupyter-core              4.5.0                     <pip>
libgfortran               3.0.0                         0  
MarkupSafe                1.1.1                     <pip>
nbformat                  4.4.0                     <pip>
ncurses                   6.1                  h4f752ac_1  
numpy                     1.14.0           py36h73aad69_0  
numpy                     1.16.1                    <pip>
openblas                  0.2.19                        0  
openssl                   1.0.2r               hdff2a78_0  
pandas                    0.23.4                    <pip>
pip                       18.0                     py36_1  
plotly                    3.1.0                     <pip>
pyrsistent                0.15.2                    <pip>
python                    3.6.6                hd0568c0_1  
python-dateutil           2.8.0                     <pip>
pytz                      2019.1                    <pip>
readline                  7.0                  hcb560eb_1  
requests                  2.22.0                    <pip>
retrying                  1.3.3                     <pip>
scipy                     1.0.0            py36h741f5fb_0  
setuptools                40.2.0                   py36_0  
six                       1.12.0                    <pip>
sqlite                    3.24.0               hfcb1bcf_1  
tk                        8.6.8                h849d6a0_0  
traitlets                 4.3.2                     <pip>
urllib3                   1.25.3                    <pip>
Werkzeug                  0.15.4                    <pip>
wheel                     0.31.1                   py36_1  
xz                        5.2.4                hdff2a78_1  
zlib                      1.2.11            hdff2a78_1003  
zope.interface            4.6.0                     <pip>

I get a segmentation fault if I do pip list inside the virtual environment.

(tdenv) pi@tdunit:~ $ pip list
Segmentation fault

Outside the virtual environment:

pi@tdunit:~ $ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
asn1crypto (0.22.0)
astroid (2.0.2)
certifi (2018.8.24)
cffi (1.10.0)
chardet (3.0.4)
conda (4.5.11)
cryptography (1.9)
idna (2.5)
isort (4.3.4)
lazy-object-proxy (1.3.1)
mccabe (0.6.1)
packaging (16.8)
pip (9.0.1)
pycosat (0.6.3)
pycparser (2.17)
pylint (2.1.1)
pyOpenSSL (16.2.0)
pyparsing (2.2.0)
requests (2.18.1)
ruamel.yaml (0.11.7)
setuptools (36.0.1)
six (1.10.0)
typed-ast (1.1.0)
urllib3 (1.21.1)
wheel (0.29.0)
wrapt (1.10.11)

Conda list outside virtual environment:

pi@tdunit:~ $ conda list
# packages in environment at /home/pi/berryconda3:
#
# Name                    Version                   Build  Channel
asn1crypto                0.22.0                   py36_0  
astroid                   2.0.2                    py36_0  
ca-certificates           2018.8.24                     0  
certifi                   2018.8.24                py36_1  
cffi                      1.10.0                   py36_0  
chardet                   3.0.4                    py36_0  
conda                     4.5.11                   py36_0  
conda-env                 2.6.0                         1  
cryptography              1.9                      py36_0  
idna                      2.5                      py36_0  
isort                     4.3.4                    py36_0  
lazy-object-proxy         1.3.1                    py36_0  
libffi                    3.2.1                         0  
mccabe                    0.6.1                      py_1  
ncurses                   5.9                           0  
openssl                   1.0.2r               hdff2a78_0  
packaging                 16.8                     py36_0  
pip                       9.0.1                    py36_0  
pycosat                   0.6.3            py36hdff2a78_1  
pycparser                 2.17                     py36_0  
pylint                    2.1.1                    py36_0  
pyopenssl                 16.2.0                   py36_0  
pyparsing                 2.2.0                    py36_0  
python                    3.6.1                         0  
readline                  6.3                           0  
requests                  2.18.1                   py36_0  
ruamel_yaml               0.11.14                  py36_0  
setuptools                36.0.1                   py36_0  
six                       1.10.0                   py36_0  
sqlite                    3.15.0                        0  
tk                        8.6.6                         0  
typed-ast                 1.1.0            py36hdff2a78_0  
urllib3                   1.21.1                   py36_0  
wheel                     0.29.0                   py36_0  
wrapt                     1.10.11          py36hf843537_0  
xz                        5.2.2                         0  
yaml                      0.1.6                         0  
zlib                      1.2.11                        0  

Hi @tsokadev ,

Something odd is going on with the plotly vesions. The virtual environment reports plotly version 3.1.0, but this version predates the _plotly_future_ module. So the plotly.py file at site-packages/plotly/__init__.py somehow came from a different plotly installation. You could try uninstall plotly using pip and then reinstalling version 3.10.0.

Also, getting a segmentation fault when calling pip list from your virtual environment is a bit concerning. Perhaps there is some inconsistency in the environment that is causing both problems.

Hi, I've got the same problem as @tsokadev and when checking pip list and conda list, I have Plotly 3.10.0 on both.

I've uninstalled and reinstalled Plotly but the error still persists:
(base) Florence:dash florence.townend$ python app.py Traceback (most recent call last): File "app.py", line 2, in <module> import dash File "/Users/florence.townend/anaconda3/lib/python3.7/site-packages/dash/__init__.py", line 1, in <module> from .dash import Dash, no_update # noqa: F401 File "/Users/florence.townend/anaconda3/lib/python3.7/site-packages/dash/dash.py", line 22, in <module> import plotly File "/Users/florence.townend/anaconda3/lib/python3.7/site-packages/plotly/__init__.py", line 30, in <module> from _plotly_future_ import _future_flags ModuleNotFoundError: No module named '_plotly_future_'

Could there be another reason it's not working?

Hi @florencejt, how did you install plotly in the first place? Here's the uninstall/install sequence I mean.

$ conda uninstall plotly
$ pip uninstall plotly
$ pip install plotly

Then if things don't work after running that sequence, add the output of conda list and pip list here. Also, check the contents of your /Users/florence.townend/anaconda3/lib/python3.7/site-packages/ directory to see if there is a _plotly_future_ directory in there.

When I tired coda uninstall Plotly I got this:

(base) Florence:~ florence.townend$ conda uninstall plotly
Collecting package metadata: done
Solving environment: failed

PackagesNotFoundError: The following packages are missing from the target environment:
  - plotly

But when I did the pip uninstall and install again, for some reason it worked this time even though I think I did the same thing as before?

Well, I'm not getting an error anymore and the demo worked so thank you.

@tsokadev there's also something weird with the dash versions you've got. These ones:

dash                      0.36.0                    <pip>
dash-core-components      0.42.1                    <pip>
dash-daq                  0.1.4                     <pip>
dash-html-components      0.13.4                    <pip>
dash-renderer             1.0.0                     <pip>

[email protected] (the latest version, out last week) is only expected to work with [email protected], but you have much older dash, dash-core-components, and dash-html-components

The Plotly future flags only showed up in v3.8 or so and I see a v3.1 up there in the list. Best to upgrade to plotly v3.10 no?

I reinstalled everything in a new environment and the problem has gone away. @alexcjohnson the reason for the weird dash versions is that I installed them from a requirements.txt file which had fixed version numbers.
Thanks for all the help.

I'm running into the same issue. Can I ask for step by step on a fresh install?
Assume I'm not using conda.

@tsokadev would you mind posting a pip list?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mondrik picture Mondrik  路  3Comments

lochbrunner picture lochbrunner  路  3Comments

Chris8080 picture Chris8080  路  3Comments

T4rk1n picture T4rk1n  路  3Comments

Ricardo-C-Oliveira picture Ricardo-C-Oliveira  路  4Comments