Unable to run tutorial example app.py, ImportError: No module named dash

Sorry in advance if this is a duplicate thread. I was following the dash tutorial with installation:

and the first example:

but when I did python app.py from the terminal, I got the error:

  • Running on (Press CTRL+C to quit)
  • Restarting with stat
    Traceback (most recent call last):
    File “dash_toy.py”, line 2, in
    import dash
    ImportError: No module named dash

I am using Ubuntu 16.04 LTS, and anaconda. I have done a google search, and find this:

but there aren’t any explanation as to how the issue is resolved.

Please let me know what I need to do, as this is very new to me.

My guess is that the python installation that you’re using isn’t the same as the pip environment that you’re installing the packages into.

If you run:

which python


which pip

then they should be pointing to the same environment. For example, for me, this returns:

$ which python
$ which pip

If those paths are different, then that might give you a clue as to why. For example, sometimes I’ve seen this issue where people are running python3 app.py instead of python app.py while still running pip install dash. python3 has a different location than python and pip is referring to python not python3.

Another way to ensure that pip is installing things into the right python would be to invoke pip through python with:

python -m pip install dash

(and similarly for the rest of the packages).

Let us know if this helps! This has come up a few times and so it’d be good to have a really clear debugging guide :slight_smile:

Thank you very much! What ended up working for me is to add “sudo” in front of all the install, i.e.

sudo pip install dash==0.28.2
sudo pip install dash-html-components==0.13.2
sudo pip install dash-core-components==0.33.0

then, running python app.py will works. However, if I run the same code on a jupyter notebook ( I have not unistall the previous installation using pip, so I still have a version of dash on my:
/home/mike/anaconda/lib/python3.6/site-packages/dash/* ), it will result in a SystemExit: 1

Also, if I try to run the salesforce_crm dashboard (https://github.com/plotly/dash-salesforce-crm), it will show there are no packages called pandas.

Is there a way around so I don’t have to install all my python packages outside of anaconda?

Thanks in advance for all the help!

To run inside Jupyter, you’ll need to change:




You’ll have to do a similar sudo pip install pandas


Thank you very much! It works now.