[Python] I'm having a problem with installing livekit plugins openai in visual code studio

Discussão em 'Python' iniciado por Stack, Fevereiro 22, 2025.

  1. Stack

    Stack Membro Participativo

    This is the main code that I use for my final project in college

    import asyncio

    from dotenv import load_dotenv
    from livekit.agents import AutoSubscribe, JobContext, WorkerOptions, cli, llm
    from livekit.agents.voice_assistant import VoiceAssistant
    from livekit.plugins import openai, silero
    from api import AssistantFnc

    load_dotenv()


    async def entrypoint(ctx: JobContext):
    initial_ctx = llm.ChatContext().append(
    role="system",
    text=(
    "You are a voice assistant created by LiveKit. Your interface with users will be voice. "
    "You should use short and concise responses, and avoiding usage of unpronouncable punctuation."
    ),
    )
    await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY)
    fnc_ctx = AssistantFnc()

    assitant = VoiceAssistant(
    vad=silero.VAD.load(),
    stt=openai.STT(),
    llm=openai.LLM(),
    tts=openai.TTS(),
    chat_ctx=initial_ctx,
    fnc_ctx=fnc_ctx,
    )
    assitant.start(ctx.room)

    await asyncio.sleep(1)
    await assitant.say("Hey, how can I help you today!", allow_interruptions=True)


    if __name__ == "__main__":
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))


    This is the error i get

    error: subprocess-exited-with-error

    × Getting requirements to build wheel did not run successfully.
    │ exit code: 1
    ╰─> [21 lines of output]
    Traceback (most recent call last):
    File "C:\Users\Haziq\Desktop\fyp\LiveKit-AI-Voice-Assitant\ai\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
    main()
    ~~~~^^
    File "C:\Users\Haziq\Desktop\fyp\LiveKit-AI-Voice-Assitant\ai\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Haziq\Desktop\fyp\LiveKit-AI-Voice-Assitant\ai\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
    return hook(config_settings)
    File "C:\Users\Haziq\AppData\Local\Temp\pip-build-env-tbubv9cq\overlay\Lib\site-packages\setuptools\build_meta.py", line 334, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=[])
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Haziq\AppData\Local\Temp\pip-build-env-tbubv9cq\overlay\Lib\site-packages\setuptools\build_meta.py", line 304, in _get_build_requires
    self.run_setup()
    ~~~~~~~~~~~~~~^^
    File "C:\Users\Haziq\AppData\Local\Temp\pip-build-env-tbubv9cq\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in run_setup
    exec(code, locals())
    ~~~~^^^^^^^^^^^^^^^^
    File "<string>", line 33, in <module>
    File "<string>", line 27, in get_version
    KeyError: '__version__'
    [end of output]


    I tried to use both pip and pip3 installation guide but i still doesn't fix it, I already installed openai and the livekit agent. I also tried to search the solution but didn't find anything related to this.

    Continue reading...

Compartilhe esta Página