Weird import error python2

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>
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 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 :slight_smile:

···

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

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:

  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, [email protected] 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>
    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 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 :slight_smile:

----

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 [email protected].
To post to this group, send email to [email protected].
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\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.