Skip to content

ImportError with tab completion #2389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
emmanuelle opened this issue Apr 16, 2020 · 2 comments
Closed

ImportError with tab completion #2389

emmanuelle opened this issue Apr 16, 2020 · 2 comments

Comments

@emmanuelle
Copy link
Contributor

How to reproduce:

  • fresh pip env with python 3.7
  • pip install ipython and jupyter
  • install development version of plotly (master)
    Inside ipython, do import plotly. and hit tab

@jonmmease probably related to the import optimization PR?

In [2]: import plotly.                                                           
Traceback (most recent call last):
  File "/home/emma/sandbox/venv_new/bin/ipython3", line 10, in <module>
    sys.exit(start_ipython())
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/__init__.py", line 126, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/terminal/ipapp.py", line 356, in start
    self.shell.mainloop()
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py", line 558, in mainloop
    self.interact()
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py", line 541, in interact
    code = self.prompt_for_code()
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py", line 469, in prompt_for_code
    **self._extra_prompt_options())
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/prompt_toolkit/shortcuts/prompt.py", line 994, in prompt
    return self.app.run(set_exception_handler=set_exception_handler)
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 812, in run
    self.run_async(pre_run=pre_run, set_exception_handler=set_exception_handler)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 778, in run_async
    return await _run_async2()
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 766, in _run_async2
    await self.cancel_and_wait_for_background_tasks()
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 867, in cancel_and_wait_for_background_tasks
    await task
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/prompt_toolkit/buffer.py", line 1854, in new_coroutine
    await coroutine(*a, **kw)
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/prompt_toolkit/buffer.py", line 1684, in async_completer
    document, complete_event
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/prompt_toolkit/completion/base.py", line 270, in get_completions_async
    document, complete_event
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/prompt_toolkit/completion/base.py", line 196, in get_completions_async
    for item in self.get_completions(document, complete_event):
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/terminal/ptutils.py", line 92, in get_completions
    yield from self._get_completions(body, offset, cursor_position, self.ipy_completer)
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/terminal/ptutils.py", line 102, in _get_completions
    for c in completions:
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/core/completer.py", line 438, in _deduplicate_completions
    completions = list(completions)
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/core/completer.py", line 1819, in completions
    for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/core/completer.py", line 1863, in _completions
    full_text=full_text, cursor_line=cursor_line, cursor_pos=cursor_column)
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/core/completer.py", line 2060, in _complete
    custom_res = [(m, 'custom') for m in self.dispatch_custom_completer(text) or []]
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/core/completer.py", line 1747, in dispatch_custom_completer
    res = c(event)
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/core/completerlib.py", line 256, in module_completer
    return module_completion(event.line)
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/core/completerlib.py", line 233, in module_completion
    completion_list = try_import('.'.join(mod[:-1]), True)
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/core/completerlib.py", line 172, in try_import
    completions.extend( [attr for attr in dir(m) if
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/core/completerlib.py", line 173, in <listcomp>
    is_importable(m, attr, only_modules)])
  File "/home/emma/sandbox/venv_new/lib/python3.7/site-packages/IPython/core/completerlib.py", line 153, in is_importable
    return inspect.ismodule(getattr(module, attr))
  File "/home/emma/code/plotly.py/packages/python/plotly/_plotly_utils/importers.py", line 29, in __getattr__
    return importlib.import_module(rel_import, parent_name)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/emma/code/plotly.py/packages/python/plotly/plotly/express/__init__.py", line 12, in <module>
    Plotly express requires pandas to be installed."""
ImportError: Plotly express requires pandas to be installed.

If you suspect this is an IPython 7.13.0 bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at [email protected]

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

@jonmmease
Copy link
Contributor

Thanks for reporting this @emmanuelle. I'm assuming this happened in an environment without pandas installed. Is that right?

Can you see if #2390 takes care of the issue? Thanks!

@emmanuelle
Copy link
Contributor Author

closed by #2390.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants