Python3 elevenlabs ImportError: cannot import name 'Literal' from 'typing'

577 Views Asked by At

enter image description here

See image. What am i doing wrong? I'm a newbie with python, i don't have a clue what i am doing wrong ps: i previously installed the package elevenlabs with 'pip3 install elevenlabs')

Searched for answers to fix it, previously also added some code and a package for the command 'typing', but it did not do the trick

1

There are 1 best solutions below

1
Brian61354270 On

typing.Literal was added in Python 3.8. You're (indirectly) trying to use it in Python 3.7.

It appears that typing.Literal is being used internally in elevenslab, so you won't be able to mitigate this by using typing-extensions to backport to Literal to Python 3.7.

You'll need to upgrade to a more recent version of Python, or downgrade to a version of elevenslab that supports Python 3.7. The current latest release of elevenslab (v0.2.27) only supports Python 3.8-3.11.

Also note that Python 3.7 reached it end of life in June of 2023, so it would be a good idea to upgrade to a maintained version regardless of how you resolve this issue.