Dash: error UnsupportedOperation: not writable

Created on 10 May 2018  Â·  29Comments  Â·  Source: plotly/dash

I had dash running on my pc before without problems. I had to reinstall and now I can't get it to work.
Even when I use the most basic code I get the same error.
Here I used the very first code example of the tutorial with montreal and sf https://dash.plot.ly/getting-started#installation

I still always get this error:


File "", line 25, in
app.run_server(debug=True)

File "/Users/Wheez/anaconda3/envs/py36/lib/python3.6/site-packages/dash/dash.py", line 568, in run_server
self.server.run(port=port, debug=debug, **flask_run_options)

File "/Users/Wheez/anaconda3/envs/py36/lib/python3.6/site-packages/flask/app.py", line 938, in run
cli.show_server_banner(self.env, self.debug, self.name, False)

File "/Users/Wheez/anaconda3/envs/py36/lib/python3.6/site-packages/flask/cli.py", line 629, in show_server_banner
click.echo(message)

File "/Users/Wheez/anaconda3/envs/py36/lib/python3.6/site-packages/click/utils.py", line 259, in echo
file.write(message)

UnsupportedOperation: not writable


I run it on python 3.6 with anaconda and spyder and followed the installation tutorial.
I have no idea what to do. Thanks for any help.

Most helpful comment

You need to edit the echo function definition at ../site-packages/click/utils.py the default value for the file parameter must be sys.stdout instead of None.
Do the same for the secho function definition at ../site-packages/click/termui.py

All 29 comments

Same issue for me. Ran fine this morning. Then ran conda updates and received the same error as wheeeeeeee with the 1st dash tutorial. i'm assuming an issue with the flask update?!? (shrug)

Python 3.6.5 |Anaconda custom (64-bit)| (default, Apr 29 2018, 16:14:56)

app.run_server(debug=True)

File "/opt/anaconda3/lib/python3.6/site-packages/dash/dash.py", line 566, in run_server
self.server.run(port=port, debug=debug, **flask_run_options)

File "/opt/anaconda3/lib/python3.6/site-packages/flask/app.py", line 938, in run
cli.show_server_banner(self.env, self.debug, self.name, False)

File "/opt/anaconda3/lib/python3.6/site-packages/flask/cli.py", line 629, in show_server_banner
click.echo(message)

File "/opt/anaconda3/lib/python3.6/site-packages/click/utils.py", line 259, in echo
file.write(message)

UnsupportedOperation: not writable

Same errors seen here.

Python 3.6 running on ARMv7l. Jupyter notebook.

UnsupportedOperation                      Traceback (most recent call last)
/opt/python3.6/lib/python3.6/site-packages/spyn/lib/dash_app.py in <module>()
----> 1 show_app(app)

/opt/python3.6/lib/python3.6/site-packages/spyn/lib/dash_app.py in show_app(app, port, width, height, offline, style, **dash_flask_kwargs)
     85                           port=port,
     86                           host="0.0.0.0",
---> 87                           **dash_flask_kwargs)

/opt/python3.6/lib/python3.6/site-packages/dash/dash.py in run_server(self, port, debug, **flask_run_options)
    566                    debug=False,
    567                    **flask_run_options):
--> 568         self.server.run(port=port, debug=debug, **flask_run_options)

/opt/python3.6/lib/python3.6/site-packages/flask/app.py in run(self, host, port, debug, load_dotenv, **options)
    936         options.setdefault('threaded', True)
    937 
--> 938         cli.show_server_banner(self.env, self.debug, self.name, False)
    939 
    940         from werkzeug.serving import run_simple

/opt/python3.6/lib/python3.6/site-packages/flask/cli.py in show_server_banner(env, debug, app_import_path, eager_loading)
    627             message += ' (lazy loading)'
    628 
--> 629         click.echo(message)
    630 
    631     click.echo(' * Environment: {0}'.format(env))

/opt/python3.6/lib/python3.6/site-packages/click/utils.py in echo(message, file, nl, err, color)
    257 
    258     if message:
--> 259         file.write(message)
    260     file.flush()
    261 

UnsupportedOperation: not writable

Python : 3.6
Same error. But, I tried to run the code through command prompt, and it ran successfully. Sadly, somehow it is not running via jupyter notebook.

Using cmd (Ran):
cmd

Using jupyter (Error):
anaconda

Has anyone managed to solve the problem? I'm facing same problem on Google Colab...

Running from terminal worked for me as well. Just does not run under
spyder after updating anaconda with the latest updates. Thank you for
the tip Sahil!
On Mon, 2018-05-14 at 14:02 -0700, Sahil Singla wrote:

Python : 3.6

Same error. But, I tried to run the code through command prompt, and
it ran successfully. Sadly, somehow it is not running via jupyter
notebook.

Using cmd (Ran):

Using jupyter (Error):

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

  
  

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c5
5493e4bb","name":"GitHub"},"entity":{"external_key":"github/plotly/da
sh","title":"plotly/dash","subtitle":"GitHub
repository","main_image_url":"https://cloud.githubusercontent.com/ass
ets/143418/17495839/a5054eac-5d88-11e6-95fc-
7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent
.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-
b52498112777.png","action":{"name":"Open in
GitHub","url":"https://github.com/plotly/dash"}},"updates":{"snippets
":[{"icon":"PERSON","message":"@sahil-singla-03 in #257: Python :
3.6\r\nSame error. But, I tried to run the code through command
prompt, and it ran successfully. Sadly, somehow it is not running via
jupyter notebook.\r\n\r\nUsing cmd (Ran):\r\ncmd\r\n\r\nUsing jupyter
(Error):\r\nanaconda"}],"action":{"name":"View
Issue","url":"https://github.com/plotly/dash/issues/257#issuecomment-
388961695"}}}
{"@type":"MessageCard","@context":"http://schema.org/extensions","hid
eOriginalBody":"false","originator":"37567f93-e2a7-4e2a-ad37-
a9160fc62647","title":"Re: [plotly/dash] error UnsupportedOperation:
not writable (#257)","sections":[{"text":"","activityTitle":"Sahil
Singla
","activityImage":"https://cloud.githubusercontent.com/assets
/143418/15842166/7c72db34-2c0b-11e6-9aed-
b52498112777.png","activitySubtitle":"@sahil-singla-
03","facts":[]}],"potentialAction":[{"name":"Add a
comment","@type":"ActionCard","inputs":[{"isMultiLine":true,"@type":"
TextInput","id":"IssueComment","isRequired":false}],"actions":[{"name
":"Comment","@type":"HttpPOST","target":"https://api.github.com","bod
y":"{\"commandName\":\"IssueComment\",\"repositoryFullName\":\"plotly
/dash\",\"issueId\":257,\"IssueComment\":\"{{IssueComment.value}}\"}"
}]},{"name":"Close
issue","@type":"HttpPOST","target":"https://api.github.com","body":"{
\"commandName\":\"IssueClose\",\"repositoryFullName\":\"plotly/dash\"
,\"issueId\":257}"},{"targets":[{"os":"default","uri":"https://github
.com/plotly/dash/issues/257#issuecomment-
388961695"}],"@type":"OpenUri","name":"View on
GitHub"},{"name":"Unsubscribe","@type":"HttpPOST","target":"https://a
pi.github.com","body":"{\"commandName\":\"MuteNotification\",\"thread
Id\":333731340}"}],"themeColor":"26292E"}

You need to edit the echo function definition at ../site-packages/click/utils.py the default value for the file parameter must be sys.stdout instead of None.
Do the same for the secho function definition at ../site-packages/click/termui.py

Apperantly flask update broke it. Downgrading flask is a workaround that works:

conda install flask=0.12.2

Is everyone that is seeing this issue seeing it from the Jupyter Notebook environment?

Here is the issues that I've found:

So, it seems like this issue has been fixed as part of ipykernel or ipython. Could you all try finding the appropriate version and upgrading?

I just reinstalled the latest anaconda on June 8 and installed Dash and plotly today. I'm getting this same error.

@josechval
Thanks, Jose works for me!

Seeing this same error from spyder but not the command line. Looks like the latest release of ipykernel is 4.8.2 at this time, but @josechval's fix worked.

@Domanic it works, it is the best solution

same issue, installed flask==0.12.2 like @Domanic suggested, solved it

@josechval it worked also! You rock!

@josechval, It worked !!! Legend!! many thanks

I tried reverting the flask version to 0.12.2, but I am still facing an issue with it not being writable. jupyter-plotly-dash seems to be working just fine as an alternative.

Requirement already satisfied: flask==0.12.2 in /anaconda3/lib/python3.6/site-packages (0.12.2)
Requirement already satisfied: itsdangerous>=0.21 in /anaconda3/lib/python3.6/site-packages (from flask==0.12.2) (0.24)
Requirement already satisfied: click>=2.0 in /anaconda3/lib/python3.6/site-packages (from flask==0.12.2) (6.7)
Requirement already satisfied: Werkzeug>=0.7 in /anaconda3/lib/python3.6/site-packages (from flask==0.12.2) (0.14.1)
Requirement already satisfied: Jinja2>=2.4 in /anaconda3/lib/python3.6/site-packages (from flask==0.12.2) (2.10)
Requirement already satisfied: MarkupSafe>=0.23 in /anaconda3/lib/python3.6/site-packages (from Jinja2>=2.4->flask==0.12.2) (1.0)
django-plotly-dash 0.8.0 has requirement Flask>=1.0.2, but you'll have flask 0.12.2 which is incompatible.
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

  • Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)
  • Restarting with stat
    An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2971: UserWarning:

To exit: use 'exit', 'quit', or Ctrl-D.

@josechval
I have changed echo and secho file parameter from none to sys.stdout as follow, but still have the same "not writable" error.

def echo(message=None, file=sys.stdout, nl=True, err=False, color=None):

def secho(text, file=sys.stdout, nl=True, err=False, color=None, **styles):

did I mis-understood your instructions?
I also installed the latest version of flask, but still didn't solve

Please help!!!

Thanks @josechval it worked for me perfectly...

Executing py file from cmd instead of from idle worked for me.

Hi.

You'll see the path to the file you must edit at the end of the error
message.

The path is different for each implementation.

Greetings.

El 10/12/18 a las 2:38, Sathvik escribió:
>

@josechval https://github.com/josechval unable to find termui.py

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/plotly/dash/issues/257#issuecomment-445733523, or
mute the thread
https://github.com/notifications/unsubscribe-auth/ACy_F4XTMbv7MVQn39OcIPIgODviYVgOks5u3h2agaJpZM4T5FYM.

@josechval That worked for me as well. Thanks!

when I ran app.run_server() I got the following error.
Dash app.
Could someone please help me...........fast .....So I would really appreciate some help.

Running on http://0.0.0.0:8050/
Debugger PIN: 013-646-504
Traceback (most recent call last):
File "C:\Python34\dtest.py", line 31, in
app.run_server(debug=True,host='0.0.0.0')
File "C:\Python34\lib\site-packages\dash\dash.py", line 1293, in run_server
**flask_run_options)
File "C:\Python34\lib\site-packages\flask\app.py", line 938, in run
cli.show_server_banner(self.env, self.debug, self.name, False)
File "C:\Python34\lib\site-packages\flask\cli.py", line 629, in show_server_banner
click.echo(message)
File "C:\Python34\lib\site-packages\click\utils.py", line 218, in echo
file = _default_text_stdout()
File "C:\Python34\lib\site-packages\click_compat.py", line 675, in func
rv = wrapper_func()
File "C:\Python34\lib\site-packages\click_compat.py", line 436, in get_text_stdout
rv = _get_windows_console_stream(sys.stdout, encoding, errors)
File "C:\Python34\lib\site-packages\click_winconsole.py", line 295, in _get_windows_console_stream
func = _stream_factories.get(f.fileno())
io.UnsupportedOperation: fileno

If you're not already, try running from the command line. I've seen this error come up when people to to run from some other environment like IDLE etc.

If you're not already, try running from the command line. I've seen this error come up when people to to run from some other environment like IDLE etc.

It worked .Thank you so much ...spent hours analyzing site packages .

Is it possible to create multiple web pages and navigate in dash???

@akhilrajarj, yes! See https://dash.plot.ly/urls

You need to edit the echo function definition at ../site-packages/click/utils.py the default value for the file parameter must be sys.stdout instead of None.
Do the same for the secho function definition at ../site-packages/click/termui.py
Hola, como hago esa modificacion?

@josechval Thank you so much, It's worked.

File "C:\ProgramData\Anaconda3\lib\site-packages\click\utils.py", line 259, in echo
file.write(message)

UnsupportedOperation: not writable

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ninjakx picture ninjakx  Â·  3Comments

ncdingari picture ncdingari  Â·  4Comments

hscspring picture hscspring  Â·  4Comments

germayneng picture germayneng  Â·  4Comments

Ricardo-C-Oliveira picture Ricardo-C-Oliveira  Â·  4Comments