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.

Error completing command when running ipython. Only happens in new custom environments.

See original GitHub issue

I have just installed Anaconda 3 on a fresh installed Ubuntu 20.04. The conda version is 4.9.2.

The issue I am experiencing is related to completion inside ipython (version 7.19.0). When I am in the default base environment installed with Anaconda3, everything is working. However, on any new environment, the completion is not working, it doesn’t show anything and when I try to trigger (using tab), it only creates an empty space. Additionally, when I leave IPython, I get this error:

Traceback (most recent call last):
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/terminal/ptutils.py", line 113, in get_completions
    yield from self._get_completions(body, offset, cursor_position, self.ipy_completer)
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/terminal/ptutils.py", line 129, in _get_completions
    for c in completions:
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/core/completer.py", line 438, in _deduplicate_completions
    completions = list(completions)
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/core/completer.py", line 1818, in completions
    for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/core/completer.py", line 1861, in _completions
    matched_text, matches, matches_origin, jedi_matches = self._complete(
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/core/completer.py", line 2029, in _complete
    completions = self._jedi_matches(
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/core/completer.py", line 1373, in _jedi_matches
    interpreter = jedi.Interpreter(
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/jedi/api/__init__.py", line 725, in __init__
    super().__init__(code, environment=environment,
TypeError: __init__() got an unexpected keyword argument 'column'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/bin/ipython", line 11, in <module>
    sys.exit(start_ipython())
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/__init__.py", line 126, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
    app.start()
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/terminal/ipapp.py", line 356, in start
    self.shell.mainloop()
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/terminal/interactiveshell.py", line 564, in mainloop
    self.interact()
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/terminal/interactiveshell.py", line 547, in interact
    code = self.prompt_for_code()
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/terminal/interactiveshell.py", line 473, in prompt_for_code
    text = self.pt_app.prompt(
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1013, in prompt
    return self.app.run(set_exception_handler=set_exception_handler)
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 816, in run
    return loop.run_until_complete(
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 783, in run_async
    return await _run_async2()
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 771, in _run_async2
    await self.cancel_and_wait_for_background_tasks()
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 872, in cancel_and_wait_for_background_tasks
    await task
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/prompt_toolkit/buffer.py", line 1854, in new_coroutine
    await coroutine(*a, **kw)
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/prompt_toolkit/buffer.py", line 1683, in async_completer
    async for completion in self.completer.get_completions_async(
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/prompt_toolkit/completion/base.py", line 269, in get_completions_async
    async for completion in completer.get_completions_async(
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/prompt_toolkit/completion/base.py", line 196, in get_completions_async
    for item in self.get_completions(document, complete_event):
  File "/mnt/data/applications/ziko-apps/anaconda3/envs/pytorch/lib/python3.9/site-packages/IPython/terminal/ptutils.py", line 116, in get_completions
    exc_type, exc_value, exc_tb = sys.exc_info()
NameError: name 'sys' is not defined

If you suspect this is an IPython 7.19.0 bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@python.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

Again, it only occurs inside a custom environment; I tested this issue on two separate environments.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:6

github_iconTop GitHub Comments

1reaction
esseticommented, Jan 15, 2021

If you just import sys in your shell the problem is solved (at lest in my tests).

0reactions
FranekWcommented, Jan 15, 2021

@cipri-tom It’s working now. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

`ipython` tab autocomplete does not work on imported ...
I just installed ipython ( conda install ipython ) and had no tab completion issues. You can use it concurrently with pip. –...
Read more >
IPython reference — IPython 3.2.1 documentation
# Try running this code both at the command line and from inside IPython (with # %run example-embed.py) from IPython. config. loader import...
Read more >
Built-in magic commands — IPython 8.7.0 documentation
This magic command support two ways of activating debugger. One is to activate debugger before executing code. This way, you can set a...
Read more >
Customizing SageMaker Studio
For IAM-authenticated domains only, the SageMaker CreatePresignedDomainUrl API can allow a script to log in to Jupyter, assuming the client ...
Read more >
Advanced Visual Studio Code for Python Developers
If you already have a virtual environment, run Python: Select Interpreter from the Command Palette to select the Python interpreter virtual environment. If...
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