Skip to content
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

ptpython fails to import within jupyter-console #579

Open
eo1989 opened this issue May 23, 2024 · 2 comments
Open

ptpython fails to import within jupyter-console #579

eo1989 opened this issue May 23, 2024 · 2 comments

Comments

@eo1989
Copy link

eo1989 commented May 23, 2024

I attempted to run ptpython from within jupyter-console (jc from now on; for the signature help, docs, vim keybindings & overall better ergonomics). First after installing into the jupyterlab venv (via pipx inject), running jc didnt import the package (my guess is it's running a separate python interp that isnt connected to the top level "jupyterlab" venv), anyway, "%pip install ptpython" allowed for the package to be installed into the local jc repl. The error I'm bringing up is that when I followed the instructions:

from ptpython.repl import embed

jc returned the following error:

In [5]: import ptpython.repl.embed
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[5], line 1
----> 1 import ptpython.repl.embed

File ~/.pyenv/versions/gen/lib/python3.12/site-packages/ptpython/__init__.py:3
      1 from __future__ import annotations
----> 3 from .repl import embed
      5 __all__ = ["embed"]

File ~/.pyenv/versions/gen/lib/python3.12/site-packages/ptpython/repl.py:23
     20 from dis import COMPILER_FLAG_NAMES
     21 from typing import Any, Callable, ContextManager, Iterable
---> 23 from prompt_toolkit.formatted_text import OneStyleAndTextTuple
     24 from prompt_toolkit.patch_stdout import patch_stdout as patch_stdout_context
     25 from prompt_toolkit.shortcuts import (
     26     clear_title,
     27     set_title,
     28 )

ImportError: cannot import name 'OneStyleAndTextTuple' from 'prompt_toolkit.formatted_text' (/home/rocket/.pyenv/versions/gen/lib/python3.12/site-packages/prompt_toolkit/formatted_text/__init__.py)

I noticed in some other threads you say something along the lines that "even python 3.12 and 3.13 should work fine," or words to that effect.

Running Ubuntu 22.04.4 LTS Jammy (WSL2g)
python 3.12.2
ptpython 3.0.26
prompt-toolkit 3.0.36

@Justaus3r
Copy link

Justaus3r commented May 24, 2024

Same error here. Instead i am running the ptpython repl
On Windows 11 .
ptpython version: ptpython-3.0.26.
errors out on both python 3.11 and 3.12 for me

@patrickrfisher
Copy link

Evelyn I will help

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

3 participants