3

I am trying to use the Tensonflow debugger in PyCharm. When I do I get this error: _curses.error: setupterm: could not find terminal

Here is the full traceback:

Traceback (most recent call last):
  File "/Users/mddrill/PycharmProjects/NumberReaderNN/number_reader.py", line 163, in <module>
    [optimizer, loss_func, train_prediction], feed_dict=feed_dict
  File "/anaconda/lib/python3.6/site-packages/tensorflow/python/debug/wrappers/framework.py", line 411, in run
    self._run_call_count))
  File "/anaconda/lib/python3.6/site-packages/tensorflow/python/debug/wrappers/local_cli_wrapper.py", line 210, in on_run_start
    self._prep_cli_for_run_start()
  File "/anaconda/lib/python3.6/site-packages/tensorflow/python/debug/wrappers/local_cli_wrapper.py", line 228, in _prep_cli_for_run_start
    self._run_cli = ui_factory.get_ui(self._ui_type)
  File "/anaconda/lib/python3.6/site-packages/tensorflow/python/debug/cli/ui_factory.py", line 56, in get_ui
    return curses_ui.CursesUI(on_ui_exit=on_ui_exit)
  File "/anaconda/lib/python3.6/site-packages/tensorflow/python/debug/cli/curses_ui.py", line 263, in __init__
    self._screen_init()
  File "/anaconda/lib/python3.6/site-packages/tensorflow/python/debug/cli/curses_ui.py", line 374, in _screen_init
    self._stdscr = curses.initscr()
  File "/anaconda/lib/python3.6/curses/__init__.py", line 30, in initscr
    fd=_sys.__stdout__.fileno())
_curses.error: setupterm: could not find terminal

The debugger works if I run the code from a terminal, so this is definitely a PyCharm issue.

I have tried what I saw in another answer which is to add TERMINFO=/etc/terminfo to the environment variables in Run>Edit Configurations>Defaults>Python and that didn't work. The answer pertained to linux, and I'm on Mac OS X.

How can I get the Tensonflow debugger to work in PyCharm on Mac OS X?

Juan Leni
  • 6,982
  • 5
  • 55
  • 87
Matt
  • 2,232
  • 8
  • 35
  • 64
  • Have you tried attaching to the process: http://stackoverflow.com/a/31400673/3657941 –  May 05 '17 at 17:44
  • @DavidCullen It seems to be hanging on "Attaching to a process with PID=". Either way it would defeat the purpose of using the IDE if I had to start a terminal to debug. – Matt May 08 '17 at 11:51

2 Answers2

1

UPDATE: You are right, it seems this is an open issue in PyCharm: https://youtrack.jetbrains.com/issue/PY-13062


OLD: Tipically, you need to set the proper environment variables:

export TERM=xterm-new
export TERMINFO=/etc/terminfo

An almost identical problem has been discussed here: Setupterm could not find terminal, in Python program using curses

Community
  • 1
  • 1
Juan Leni
  • 6,982
  • 5
  • 55
  • 87
0

You could go the 'Edit Configuration' page, and select 'Emulate in output console'.