1

Some version info:

OS: Mac OS X 10.8.4
Python: 2.7.2 (that came with the Mac OS X)
PyPy: 2.0.2
iPython: 0.13.2
PyCharm: 2.5.1

PyCharm's Python console fails when PyPy and iPython co-exist in a virtualenv created project.

image

I created three virtual environment projects. I did not activate any of the virtual environments. So, the system python still exists as it is.

Env - 1:

$ virtualenv -p /path/to/system/installed/python /path/to/sample_1/virtualenv/project
$ /path/to/sample_1/virtualenv/project/bin/pip install ipython

Now, when I run the python console in PyCharm it works fine. (Interpreter in PyCharm is set to /path/to/sample_1/virtualenv/project/bin/python)

Env - 2:

$ virtualenv -p /path/to/pypy /path/to/sample_2/virtualenv/project

Now, when I run the python console in PyCharm it works fine. (Interpreter in PyCharm is set to /path/to/sample_2/virtualenv/project/bin/python)

Env - 3:

$ virtualenv -p /path/to/pypy /path/to/sample_3/virtualenv/project
$ /path/to/sample_3/virtualenv/project/bin/pip install ipython

Now, when I run the python console in PyCharm it fails with the following error. (Interpreter in PyCharm is set to /path/to/sample_3/virtualenv/project/bin/python)

/path/to/sample_3/virtualenv/project/bin/pypy -u /Applications/PyCharm.app/helpers/pydev/pydevconsole.py 60355 60356
PyDev console: using IPython 0.13.2
Traceback (most recent call last):
  File "app_main.py", line 72, in run_toplevel
  File "/Applications/PyCharm.app/helpers/pydev/pydevconsole.py", line 361, in <module>
    StartServer(pydev_localhost.get_localhost(), int(port), int(client_port))
  File "/Applications/PyCharm.app/helpers/pydev/pydevconsole.py", line 288, in StartServer
    interpreter = InterpreterInterface(host, client_port, threading.currentThread())
  File "/Applications/PyCharm.app/helpers/pydev/pydev_ipython_console.py", line 37, in __init__
    self.interpreter = PyDevFrontEnd()
  File "/Applications/PyCharm.app/helpers/pydev/pydev_ipython_console_011.py", line 35, in __init__
    shell = TerminalInteractiveShell.instance()
  File "/path/to/sample_3/virtualenv/project/site-packages/IPython/config/configurable.py", line 318, in instance
    inst = cls(*args, **kwargs)
  File "/path/to/sample_3/virtualenv/project/site-packages/IPython/frontend/terminal/interactiveshell.py", line 360, in __init__
    user_module=user_module, custom_exceptions=custom_exceptions
  File "/path/to/sample_3/virtualenv/project/site-packages/IPython/core/interactiveshell.py", line 454, in __init__
    self.init_readline()
  File "/path/to/sample_3/virtualenv/project/site-packages/IPython/core/interactiveshell.py", line 1843, in init_readline
    self.refill_readline_hist()
  File "/path/to/sample_3/virtualenv/project/site-packages/IPython/core/interactiveshell.py", line 1851, in refill_readline_hist
    self.readline.clear_history()
  File "/tmp/pypy-2.0.2/lib_pypy/pyrepl/readline.py", line 284, in clear_history
    del self.get_reader().history[:]
  File "/tmp/pypy-2.0.2/lib_pypy/pyrepl/readline.py", line 188, in get_reader
    console = UnixConsole(self.f_in, self.f_out, encoding=ENCODING)
  File "/tmp/pypy-2.0.2/lib_pypy/pyrepl/unix_console.py", line 98, in __init__
    curses.setupterm(term, self.output_fd)
error: setupterm: could not find terminfo database

Process finished with exit code 1

Please be mindful that bin/python in any of the virtual environments points to the installed interpreter. For example, /path/to/sample_3/virtualenv/project/bin/python points to pypy and /path/to/sample_1/virtualenv/project/bin/python points to system installed python.

Seems like this is related to this. But, I am not sure.

Please help.

user699540
  • 819
  • 2
  • 12
  • 18

1 Answers1

0

Looking at the actual Exception message, this may be a potential solution:

https://support.enthought.com/entries/22438744-Linux-IPython-in-terminal-error-setupterm-could-not-find-terminfo-database-

Meanwhile, you should be able to work around the problem by setting
 export TERM="xterm-256color" in the shell from which you execute ipython,
or in your~/.bashrc file, which you then source.
Autumn
  • 398
  • 2
  • 7