# Weird import error python2

**URL:** <https://discourse.bokeh.org/t/weird-import-error-python2/2393>\
**Category:** Community Support\
**Created:** [August 21, 2017, 9:17pm UTC](https://discourse.bokeh.org/t/weird-import-error-python2/2393 "2017-08-21T21:17:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dds.nexus](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/d/ac8455/32.png) [@dds.nexus](https://discourse.bokeh.org/u/dds.nexus)\
**Post date:** [August 21, 2017, 9:17pm UTC](https://discourse.bokeh.org/t/weird-import-error-python2/2393/1 "2017-08-21T21:17:14Z")

</div>

copy paste from a message in the github issues, sorry i didnt know this forum existed.

Sorry im not a native english speaker, so my language isnt very good.  
First of all i was trying to install bokeh because someone tell me is very similar to Shiny (Rstudio), so i installed the bokeh following the instructions in the website(im using Ubuntu 16.04). Basically i installed every dependence and then tried installing bokeh via pip. everything went well, no errors, but went i try to run the example script:

```auto

from bokeh.plotting import figure, output_file, show
# prepare some data
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]
# output to static HTML file
output_file("lines.html")
# create a new plot with a title and axis labels
p = figure(title="simple line example", x_axis_label='x', y_axis_label='y')
# add a line renderer with legend and line thickness
p.line(x, y, legend="Temp.", line_width=2)
# show the results
show(p)

```

i get the error that the module isnt installed:

```auto
 File "/home/bokeh.py", line 1, in <module>
from bokeh.plotting import figure, output_file, show
ImportError: No module named plotting
 

```

tried everything, then i found out that the entire script cant be run(using: python file.py), but single lines can. So i started from there. Trying to find a solution, i installed anaconda and created a new  
enviroment with all the needed dependencies and i got the same issue. Cant run a entire python script, but if i execute python in terminal and  
then line by line i can execute the script. Aaand right now isnt working at all, neither line by line nor trying to execute the entire script.

```auto
  Python 2.7.13 |Anaconda custom (64-bit)| (default, Dec 20 2016, 23:09:15) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import bokeh
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "bokeh.py", line 1, in <module>
from bokeh.plotting import figure, output_file, show
ImportError: No module named plotting
>>> exit()

```

Dont know how to fix the issue. by the way… bokeh just works line by line?  
tried removing everything related to bokeh and then installing from pip and conda again, with no success  
hope you can help me

Greetings 🙂

> **···**
>
> * * *
> 
> ignore the bokeh.py file, if isnt there the import isnt working

---

<div class="post-metadata">

**Author:** ![Bryan](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/bryan/32/3625_2.png) [@Bryan](https://discourse.bokeh.org/u/Bryan)\
**Post date:** [August 21, 2017, 9:21pm UTC](https://discourse.bokeh.org/t/weird-import-error-python2/2393/2 "2017-08-21T21:21:12Z")

</div>

It appears that you have made a script with the filename "bokeh.py" This is conflicting with the actual Bokeh library that is installed, because python 2 has relative imports. That is, when you do:

&nbsp;&nbsp;from bokeh.plotting import figure

Python is trying to import from \*your\* bokeh.py, not from he Bokeh library. The solution is to rename your local script to something else.

Thanks,

Bryan

> **···**
>
> > On Aug 21, 2017, at 16:17, dds.nexus@gmail.com wrote:
> > 
> > copy paste from a message in the github issues, sorry i didnt know this forum existed.
> > 
> > Sorry im not a native english speaker, so my language isnt very good.  
> > First of all i was trying to install bokeh because someone tell me is very similar to Shiny (Rstudio), so i installed the bokeh following the instructions in the website(im using Ubuntu 16.04). Basically i installed every dependence and then tried installing bokeh via pip. everything went well, no errors, but went i try to run the example script:
> > 
> > from bokeh.plotting import figure, output\_file, show
> > 
> > # prepare some data  
> > x = [1, 2, 3, 4, 5]  
> > y = [6, 7, 2, 4, 5]
> > 
> > # output to static HTML file  
> > output\_file("lines.html")
> > 
> > # create a new plot with a title and axis labels  
> > p = figure(title="simple line example", x\_axis\_label='x', y\_axis\_label='y')
> > 
> > # add a line renderer with legend and line thickness  
> > p.line(x, y, legend="Temp.", line\_width=2)
> > 
> > # show the results  
> > show(p)
> > 
> > i get the error that the module isnt installed:
> > 
> > File "/home/bokeh.py", line 1, in \<module\>  
> > &nbsp;&nbsp;&nbsp;&nbsp;from bokeh.plotting import figure, output\_file, show  
> > ImportError: No module named plotting
> > 
> > tried everything, then i found out that the entire script cant be run(using: python file.py), but single lines can. So i started from there. Trying to find a solution, i installed anaconda and created a new enviroment with all the needed dependencies and i got the same issue. Cant run a entire python script, but if i execute python in terminal and then line by line i can execute the script. Aaand right now isnt working at all, neither line by line nor trying to execute the entire script.
> > 
> > Python 2.7.13 |Anaconda custom (64-bit)| (default, Dec 20 2016, 23:09:15)  
> > [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2  
> > Type "help", "copyright", "credits" or "license" for more information.  
> > Anaconda is brought to you by Continuum Analytics.  
> > Please check out: [http://continuum.io/thanks](http://continuum.io/thanks) and [https://anaconda.org](https://anaconda.org)  
> > \>\>\> import bokeh  
> > Traceback (most recent call last):  
> > &nbsp;&nbsp;File "\<stdin\>", line 1, in \<module\>  
> > &nbsp;&nbsp;File "bokeh.py", line 1, in \<module\>  
> > &nbsp;&nbsp;&nbsp;&nbsp;from bokeh.plotting import figure, output\_file, show  
> > ImportError: No module named plotting  
> > \>\>\> exit()
> > 
> > Dont know how to fix the issue. by the way.. bokeh just works line by line?  
> > tried removing everything related to bokeh and then installing from pip and conda again, with no success  
> > hope you can help me
> > 
> > Greetings 🙂
> > 
> > ----
> > 
> > ignore the bokeh.py file, if isnt there the import isnt working
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.  
> > To post to this group, send email to bokeh@continuum.io.  
> > To view this discussion on the web visit [https://groups.google.com/a/continuum.io/d/msgid/bokeh/ef93be1e-f4f8-48b1-9968-24ef3a14638d%40continuum.io\](https://groups.google.com/a/continuum.io/d/msgid/bokeh/ef93be1e-f4f8-48b1-9968-24ef3a14638d%40continuum.io%5C).  
> > For more options, visit [https://groups.google.com/a/continuum.io/d/optout\](https://groups.google.com/a/continuum.io/d/optout%5C).

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads.bokeh.org/original/2X/1/14eb24f9e10e4e9b78e3f10f66c04ffa96446e5a.svg) [@system](https://discourse.bokeh.org/u/system)\
**Post date:** [July 21, 2021, 9:12pm UTC](https://discourse.bokeh.org/t/weird-import-error-python2/2393/3 "2021-07-21T21:12:41Z")

</div>


