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.

Permission Denied error when invoking export_png() or export_svgs from inside Jupyter Notebook

See original GitHub issue

READ AND FOLLOW THESE INSTRUCTIONS CAREFULLY

ISSUES THAT DO NOT CONTAIN NECESSARY INFORMATION MAY BE CLOSED, IMMEDIATELY

The issue tracker is NOT the place for general support. For questions and technical assistance, come ask the Bokeh mailing list or join the chat on Gitter. For feature requests, please provide a detailed description or proposal of the new capability or behavior.

For defects or deficiencies, please provide ALL OF THE FOLLOWING:

ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)

bokeh==0.12.15 jupyter==1.0.0 jupyter-client==5.1.0 jupyter-console==5.2.0 jupyter-contrib-core==0.3.1 jupyter-contrib-nbextensions==0.2.8 jupyter-core==4.3.0 jupyter-highlight-selected-word==0.0.11 jupyter-latex-envs==1.3.8.4 jupyter-nbextensions-configurator==0.2.5 python-dateutil==2.6.1 selenium==3.11.0

How jupyter notebook is launched: C:\Users<username>\AppData\Local\Programs\Python\Python36-32\Scripts\jupyter.exe notebook OS: Windows 7 64 bit Browser: Chrome Version 66.0.3359.66 (Official Build) beta (64-bit) Notebook is set to trusted.

Description of expected behavior and the observed behavior

Expected behavior is that the line: export_svgs(p, filename=“%s/”%script_outdir +str(1).zfill(3) + “_” +“output.svg”) will save 001_output.svg in the same directory that the notebook is.

Complete, minimal, self-contained example code that reproduces the issue

# code goes here between backticks
from bokeh.plotting import figure, show, save, output_notebook, output_file, reset_output
from bokeh.io import export_svgs,export_png
from bokeh.models import HoverTool
hover = HoverTool(tooltips=[("data (x,y)", "($x, $y)")])
TOOLS=[hover]
p = figure(width=1400, height=700,tools=TOOLS)
p.line([1, 2, 3], [5, 3, 4])
reset_output()
output_notebook()
show(p)
#reset_output()
#output_file("%s/"%"." +str(1).zfill(3) + "_" +"output.svg")
#save(p)
export_svgs(p, filename="%s/"%"." +str(1).zfill(3) + "_" +"filename.svg")
#export_png(p,filename="plot.png")

Stack traceback and/or browser JavaScript console output

PermissionError Traceback (most recent call last) <ipython-input-42-55a2a21e9ee8> in <module>() 17 #p.border_fill_color = None 18 #p.output_backend = “svg” —> 19 export_svgs(p, filename=“%s/”%“.” +str(1).zfill(3) + “_” +“filename.svg”) 20 #export_png(p,filename=“plot.png”)

c:\users<username>\appdata\local\programs\python\python36-32\lib\site-packages\bokeh\util\api.py in wrapper(*args, **kw) 188 @wraps(obj) 189 def wrapper(*args, **kw): –> 190 return obj(*args, **kw) 191 192 wrapper.bkversion = version

c:\users<username>\appdata\local\programs\python\python36-32\lib\site-packages\bokeh\io\export.py in export_svgs(obj, filename, height, width, webdriver) 125 126 ‘’’ –> 127 svgs = get_svgs(obj, height=height, width=width, driver=webdriver) 128 129 if len(svgs) == 0:

c:\users<username>\appdata\local\programs\python\python36-32\lib\site-packages\bokeh\util\api.py in wrapper(*args, **kw) 188 @wraps(obj) 189 def wrapper(*args, **kw): –> 190 return obj(*args, **kw) 191 192 wrapper.bkversion = version

c:\users<username>\appdata\local\programs\python\python36-32\lib\site-packages\bokeh\io\export.py in get_svgs(obj, driver, **kwargs) 197 html_path = tmp.name 198 –> 199 save_layout_html(obj, html_path, **kwargs) 200 201 web_driver = driver if driver is not None else _create_default_webdriver()

c:\users<username>\appdata\local\programs\python\python36-32\lib\site-packages\bokeh\util\api.py in wrapper(*args, **kw) 188 @wraps(obj) 189 def wrapper(*args, **kw): –> 190 return obj(*args, **kw) 191 192 wrapper.bkversion = version

c:\users<username>\appdata\local\programs\python\python36-32\lib\site-packages\bokeh\io\export.py in save_layout_html(obj, html_path, resources, **kwargs) 229 obj.plot_width = kwargs.get(‘width’, old_width) 230 –> 231 save(obj, filename=html_path, resources=resources, title=“”) 232 233 if resize:

c:\users<username>\appdata\local\programs\python\python36-32\lib\site-packages\bokeh\util\api.py in wrapper(*args, **kw) 188 @wraps(obj) 189 def wrapper(*args, **kw): –> 190 return obj(*args, **kw) 191 192 wrapper.bkversion = version

c:\users<username>\appdata\local\programs\python\python36-32\lib\site-packages\bokeh\io\saving.py in save(obj, filename, resources, title, state, **kwargs) 84 85 filename, resources, title = _get_save_args(state, filename, resources, title) —> 86 _save_helper(obj, filename, resources, title) 87 return abspath(filename) 88

c:\users<username>\appdata\local\programs\python\python36-32\lib\site-packages\bokeh\io\saving.py in _save_helper(obj, filename, resources, title) 148 html = file_html(obj, resources, title=title) 149 –> 150 with io.open(filename, mode=“w”, encoding=“utf-8”) as f: 151 f.write(decode_utf8(html)) 152

PermissionError: [Errno 13] Permission denied: ‘C:\Users\<username>\AppData\Local\Temp\tmpc8jqeews.html’

Screenshots or screencasts of the bug in action

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mattpapcommented, Apr 9, 2018

@jonreade, please submit a new issue with this. There’s an obvious bug in phantomjs detection code on Python 3.

1reaction
jonreadecommented, Apr 9, 2018

Hi Bryevdv, Hadn’t spotted any other posts on this so thought I’d give the 0.12.16 dev version a try as I was seeing similar issues with outputting a figure to a .PNG/.SVG file. Hopefully this is useful to you, but please let me know if I need to post more. I saw exactly the same issue as @Restmon saw above around permission errors with 0.12.15. With 0.12.16dev1, there’s still an error being generated from exactly the same point in the (my) source code, but now the error’s different. Nothing’s changed from the 0.12.15 call.

The OS is Windows(10), Python 3.6.1 x64 running in PyCharm rather than a notebook, Bokeh 0.12.16.dev1 (0.12.16dev1 without the final ‘.’ is also present in the package list) :

SOURCE: print(“About to plot test map”) p.circle(x=-21335.123, y=6699175.56789, size=10,color=“blue”) p.square(x=‘LonMercatorBinned’, y=‘LatMercatorBinned’, source=pbinnedsource, size=8, color={‘field’: ‘ElevationMetresBinned’, ‘transform’: color_mapper},)

output_file(“C:\Users\User\Anaconda3\LondonNew.html”) save(p) print(“Test map plot completed”)

from bokeh.io import export_svgs p.output_backend=“svg” print(“Output backend set to SVG”) export_svgs(p, filename=“C:\Users\User\Anaconda3\plot.svg”) # Fails on this call

OUTPUT: About to plot test map Test map plot completed Output backend set to SVG Traceback (most recent call last): File “C:/Users/User/PycharmProjects/GeoPandas/GeoPandas.py”, line 117, in <module> export_svgs(p, filename=“C:\Users\User\Anaconda3\plot.svg”) File “C:\Users\User\Anaconda3\lib\site-packages\bokeh\util\api.py”, line 190, in wrapper return obj(*args, **kw) File “C:\Users\User\Anaconda3\lib\site-packages\bokeh\io\export.py”, line 127, in export_svgs svgs = get_svgs(obj, height=height, width=width, driver=webdriver) File “C:\Users\User\Anaconda3\lib\site-packages\bokeh\util\api.py”, line 190, in wrapper return obj(*args, **kw) File “C:\Users\User\Anaconda3\lib\site-packages\bokeh\io\export.py”, line 197, in get_svgs web_driver = driver if driver is not None else _create_default_webdriver() File “C:\Users\User\Anaconda3\lib\site-packages\bokeh\io\export.py”, line 326, in _create_default_webdriver phantomjs_path = detect_phantomjs() File “C:\Users\User\Anaconda3\lib\site-packages\bokeh\util\dependencies.py”, line 78, in detect_phantomjs proc = Popen([phantomjs_path, “–version”], stdout=PIPE, stderr=PIPE) File “C:\Users\User\Anaconda3\lib\subprocess.py”, line 707, in init restore_signals, start_new_session) File “C:\Users\User\Anaconda3\lib\subprocess.py”, line 964, in _execute_child args = list2cmdline(args) File “C:\Users\User\Anaconda3\lib\subprocess.py”, line 461, in list2cmdline needquote = (" " in arg) or (“\t” in arg) or not arg TypeError: argument of type ‘NoneType’ is not iterable

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot open new Jupyter Notebook [Permission Denied]
It opens and shows a list of current path directories. But I cannot create a new notebook(Python3). It says. Unexpected error while saving...
Read more >
Error: Creating Notebook Failed. An error occurred while ...
Technical Article Details : Error: Creating Notebook Failed. An error occurred while creating a new notebook. Permission denied: .ipynb.
Read more >
Jupyter/base-notebook user permission issue - JupyterHub
Hi Manics,. Please provide the config.yaml file as still i am getting the error while launching the pod. Thank You Atul Yadav.
Read more >
IPython fails to start during DSS start PermissionError: [Errno ...
This of course implies that there is some permission error where the user running dataiku can't access /home/.jupyter. However, going into /home/ as...
Read more >
Permission issue for /run/user/0/jupyter when ... - Google Groups
If I run jupyter notebook without being root I get. PermissionError: [Errno 13] Permission denied: '/run/user/0/jupyter'.
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