Getting "ImportError: cannot import name 'ComposeResult' from 'textual.app'" #1452
Answered
by
MJohnson3150
MJohnson3150
asked this question in
Q&A
Replies: 4 comments 6 replies
-
Did you create a filled called “textual.py”? This will break things. The fix is to rename it to something else. |
Beta Was this translation helpful? Give feedback.
3 replies
-
Hi again and Happy New Year.
Any idea on this? Thanks.
Marc Johnson | Senior Manager of IT Systems
Las Vegas Convention and Visitors Authority | LVCVA.com
T: 702-892-0711 | Direct: 702-892-7601
From: Will McGugan ***@***.***>
Sent: Thursday, December 29, 2022 10:22 AM
To: Textualize/textual ***@***.***>
Cc: Marc Johnson ***@***.***>; Author ***@***.***>
Subject: Re: [Textualize/textual] Getting "ImportError: cannot import name 'ComposeResult' from 'textual.app'" (Discussion #1452)
What happens if you do this? python -c "import textual; print(textual)" — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread. Message ID: <Textualize/textual/repo-discussions/1452/comments/4551630@ github. com>
What happens if you do this?
python -c "import textual; print(textual)"
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https:/github.com/Textualize/textual/discussions/1452*discussioncomment-4551630__;Iw!!ATHtS6w!ev2L2VXguqCEKyY9CY9xl_xLni83a1Tpeb5M2GUQMOcIUmNlUSetksc3KzFsTfRDQ40nuuvC2QA8dEsGAvD9ZHVN$>, or unsubscribe<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ANPSGOWUBMUF2CDADN6X6YLWPXJF3ANCNFSM6AAAAAATLUKNDA__;!!ATHtS6w!ev2L2VXguqCEKyY9CY9xl_xLni83a1Tpeb5M2GUQMOcIUmNlUSetksc3KzFsTfRDQ40nuuvC2QA8dEsGAlUUKC_Z$>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Thanks for responding Dave.
Yes, I get back: ‘0.1.18’
So I thought I would try to update the textual library with:
pip install "textual[dev]"
and I get the following:
pip3 install "textual[dev]"
Requirement already satisfied: textual[dev] in /home/mjohnson/.local/lib/python3.8/site-packages (0.1.18)
WARNING: textual 0.1.18 does not provide the extra 'dev'
Requirement already satisfied: rich<13.0.0,>=12.3.0 in /home/mjohnson/.local/lib/python3.8/site-packages (from textual[dev]) (12.5.1)
Requirement already satisfied: typing-extensions<5.0,>=4.0.0; python_version < "3.9" in /home/mjohnson/.local/lib/python3.8/site-packages (from textual[dev]) (4.2.0)
Requirement already satisfied: pygments<3.0.0,>=2.6.0 in /home/mjohnson/.local/lib/python3.8/site-packages (from rich<13.0.0,>=12.3.0->textual[dev]) (2.11.2)
Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in /home/mjohnson/.local/lib/python3.8/site-packages (from rich<13.0.0,>=12.3.0->textual[dev]) (0.9.1)
And if I run your command again, it still says I’m on the 0.1.18 version. So how do I get it to the latest? Thanks again.
Marc Johnson | Senior Manager of IT Systems
Las Vegas Convention and Visitors Authority | LVCVA.com
T: 702-892-0711 | Direct: 702-892-7601
From: Dave Pearson ***@***.***>
Sent: Wednesday, January 4, 2023 12:27 PM
To: Textualize/textual ***@***.***>
Cc: Marc Johnson ***@***.***>; Author ***@***.***>
Subject: Re: [Textualize/textual] Getting "ImportError: cannot import name 'ComposeResult' from 'textual.app'" (Discussion #1452)
Could you run this in your Python REPL please? from importlib. metadata import version; version( "textual" ) and say what you get back? The reason I ask is that ComposeResult wasn't introduced until the merge of the "CSS branch", resulting in
Could you run this in your Python REPL please?
from importlib.metadata import version; version( "textual" )
and say what you get back?
The reason I ask is that ComposeResult wasn't introduced until the merge of the "CSS branch", resulting in v0.2.0 being released back in October last year<https://urldefense.com/v3/__https:/github.com/Textualize/textual/releases/tag/v0.2.0__;!!ATHtS6w!c6_2bSPdAYC4lPXCqjmpvXKvWlB_B9pvEOgMSB8Mvpri6xjzmis-3gxeWtBARQU1v3Re6E5SC6TR8mvxAaGlVUPR$>. If I do what you're doing, but with v0.1.18 or earlier<https://urldefense.com/v3/__https:/github.com/Textualize/textual/releases/tag/v0.1.18__;!!ATHtS6w!c6_2bSPdAYC4lPXCqjmpvXKvWlB_B9pvEOgMSB8Mvpri6xjzmis-3gxeWtBARQU1v3Re6E5SC6TR8mvxAZevyHJD$>, I get the same result as you. My suspicion is that you're looking at our current documentation, which is for the current versions of Textual, but you've got an older version installed.
The current stable version is v0.9.1<https://urldefense.com/v3/__https:/pypi.org/project/textual/__;!!ATHtS6w!c6_2bSPdAYC4lPXCqjmpvXKvWlB_B9pvEOgMSB8Mvpri6xjzmis-3gxeWtBARQU1v3Re6E5SC6TR8mvxAb8c_Msg$>.
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https:/github.com/Textualize/textual/discussions/1452*discussioncomment-4595440__;Iw!!ATHtS6w!c6_2bSPdAYC4lPXCqjmpvXKvWlB_B9pvEOgMSB8Mvpri6xjzmis-3gxeWtBARQU1v3Re6E5SC6TR8mvxAQaaA4kI$>, or unsubscribe<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ANPSGOXXZWHRWXQE6D4O7E3WQXMLBANCNFSM6AAAAAATLUKNDA__;!!ATHtS6w!c6_2bSPdAYC4lPXCqjmpvXKvWlB_B9pvEOgMSB8Mvpri6xjzmis-3gxeWtBARQU1v3Re6E5SC6TR8mvxAUtqiRtf$>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
That did it! Thanks again for all the help. I look forward to learning Textual.
Marc Johnson | Senior Manager of IT Systems
Las Vegas Convention and Visitors Authority | LVCVA.com
T: 702-892-0711 | Direct: 702-892-7601
From: Will McGugan ***@***.***>
Sent: Wednesday, January 4, 2023 5:25 PM
To: Textualize/textual ***@***.***>
Cc: Marc Johnson ***@***.***>; Author ***@***.***>
Subject: Re: [Textualize/textual] Getting "ImportError: cannot import name 'ComposeResult' from 'textual.app'" (Discussion #1452)
Add -U switch to upgrade to the latest version. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread. Message ID: <Textualize/textual/repo-discussions/1452/comments/4596964@ github. com>
Add -U switch to upgrade to the latest version.
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https:/github.com/Textualize/textual/discussions/1452*discussioncomment-4596964__;Iw!!ATHtS6w!aPFUO6KeHiidxPPJD88bXD-tgQ9dIAOWf0ZBbxhf1c4Bu3WM13uyl96N7_MLcvijQY5YgGqAdAkvzHYXzDF4z-Ne$>, or unsubscribe<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ANPSGOQGWWP3NCR6UWWXDHDWQYPFRANCNFSM6AAAAAATLUKNDA__;!!ATHtS6w!aPFUO6KeHiidxPPJD88bXD-tgQ9dIAOWf0ZBbxhf1c4Bu3WM13uyl96N7_MLcvijQY5YgGqAdAkvzHYXzJOLsTIG$>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
davep
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Very new to Textual and Python in general. I’m trying to run and play with some of the examples. Several have the following import line:
from textual.app import App, ComposeResult
When I try running this line, I get the following error:
ImportError: cannot import name ‘ComposeResult’ from ‘textual.app’
In looking at another post, it was recommended to run:
python3 -m textual
to see a list of its capabilities. I'm also not able to run this line. In this case, I get the following:
No module named textual.main; 'textual' is a package and cannot be directly executed
I have installed the Textual library successfully and noticed that I can import things from textual but not textual.app. Is that something else? Sorry for the cluelessness but I don’t know enough yet on how to find out for myself. (I've tried Googling several things but I must be missing something very fundamental that I can't find. Thank you.
Beta Was this translation helpful? Give feedback.
All reactions