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

[Bug] Pip install pulls in wrong version of openai #5680

Closed
alexanderchiu opened this issue Nov 7, 2023 · 3 comments
Closed

[Bug] Pip install pulls in wrong version of openai #5680

alexanderchiu opened this issue Nov 7, 2023 · 3 comments

Comments

@alexanderchiu
Copy link

Describe the bug
Wasn't able to pip install and run openbb.

Traceback (most recent call last):
  File "/tmp/openbb/bin/openbb", line 5, in <module>
    from terminal import main
  File "/tmp/openbb/lib/python3.10/site-packages/terminal.py", line 8, in <module>
    from openbb_terminal.terminal_helper import (
  File "/tmp/openbb/lib/python3.10/site-packages/openbb_terminal/terminal_helper.py", line 22, in <module>
    from openbb_terminal import thought_of_the_day as thought
  File "/tmp/openbb/lib/python3.10/site-packages/openbb_terminal/thought_of_the_day.py", line 10, in <module>
    from openbb_terminal.helper_funcs import request
  File "/tmp/openbb/lib/python3.10/site-packages/openbb_terminal/helper_funcs.py", line 43, in <module>
    from llama_index import (
  File "/tmp/openbb/lib/python3.10/site-packages/llama_index/__init__.py", line 15, in <module>
    from llama_index.embeddings.langchain import LangchainEmbedding
  File "/tmp/openbb/lib/python3.10/site-packages/llama_index/embeddings/__init__.py", line 5, in <module>
    from llama_index.embeddings.openai import OpenAIEmbedding
  File "/tmp/openbb/lib/python3.10/site-packages/llama_index/embeddings/openai.py", line 18, in <module>
    from llama_index.llms.openai_utils import validate_openai_api_key
  File "/tmp/openbb/lib/python3.10/site-packages/llama_index/llms/__init__.py", line 2, in <module>
    from llama_index.llms.azure_openai import AzureOpenAI
  File "/tmp/openbb/lib/python3.10/site-packages/llama_index/llms/azure_openai.py", line 6, in <module>
    from llama_index.llms.openai import OpenAI
  File "/tmp/openbb/lib/python3.10/site-packages/llama_index/llms/openai.py", line 29, in <module>
    from llama_index.llms.openai_utils import (
  File "/tmp/openbb/lib/python3.10/site-packages/llama_index/llms/openai_utils.py", line 6, in <module>
    from openai import ChatCompletion, Completion
ImportError: cannot import name 'ChatCompletion' from 'openai' (/tmp/openbb/lib/python3.10/site-packages/openai/__init__.py)

To Reproduce
python3.10.9 -m venv .
pip install openbb
openbb

Desktop (please complete the following information):

  • OS: Fedora 38
  • Python version 3.10.9

Additional context
Was able to get it working by pinning openai to 0.28.1

pip install openai==0.28.1

I'm assuming the latest open ai release broke something: https://pypi.org/project/openai/#history.

@mnicstruwig
Copy link
Contributor

mnicstruwig commented Nov 7, 2023

In offline discussion with @alexanderchiu, he managed to find what looks to be the suspected cause:

There is an unpinned version of openai in llama-index (offending commit).

Because our llama-index is pinned with a caret (^) in pyproject.toml, we're pulling through the version of llama-index with their unpinned version of openai, causing the breakage.

This fix should be pin the version of llama-index. I'll be able to get a small PR open soon.

Thanks for the report!

@jmaslek jmaslek mentioned this issue Nov 8, 2023
@jmaslek
Copy link
Collaborator

jmaslek commented Nov 8, 2023

#5685 should resolve this. We will patch in the next day or so. Anyone else expierencing this can resolve with the suggestion above:

pip install openai==0.28.1

@alexanderchiu
Copy link
Author

Thanks for the quick response!

@jmaslek jmaslek closed this as completed May 30, 2024
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