GithubHelp home page GithubHelp logo

Comments (5)

kharvd avatar kharvd commented on May 14, 2024

Hmm, I can't reproduce on a clean installation. What is your python version? GPT-4 thinks you're using an outdated version. Could you try the suggested fix below as well?

The error is caused by using dict[str, Path] with an older Python version that doesn't support it. Upgrade
to Python 3.9 or later, or use typing.Dict:

 from typing import Dict, Optional
 LLAMA_MODELS: Optional[Dict[str, Path]] = None

from gpt-cli.

sthiffea avatar sthiffea commented on May 14, 2024

I'm having same issue. Python 3.8.10 on Ubuntu 20.04 under WSL2.
Tried clean install. Same issue.

Traceback (most recent call last):
  File "./gpt.py", line 8, in <module>
    import google.generativeai as genai
  File "/home/sthiffea/gpt-cli/venv/lib/python3.8/site-packages/google/generativeai/__init__.py", line 59, in <module>
    from google.generativeai import types
  File "/home/sthiffea/gpt-cli/venv/lib/python3.8/site-packages/google/generativeai/types/__init__.py", line 19, in <module>
    from google.generativeai.types.text_types import *
  File "/home/sthiffea/gpt-cli/venv/lib/python3.8/site-packages/google/generativeai/types/text_types.py", line 34, in <module>
    class Completion(abc.ABC):
  File "/home/sthiffea/gpt-cli/venv/lib/python3.8/site-packages/google/generativeai/types/text_types.py", line 49, in Completion
    filters: Optional[list[safety_types.ContentFilterDict]]
TypeError: 'type' object is not subscriptable```

```(venv) sthiffea@win11desktop:~/gpt-cli$ pip freeze
aiohttp==3.8.4
aiosignal==1.3.1
anthropic==0.2.8
anyio==3.6.2
async-timeout==4.0.2
attrs==23.1.0
black==23.1.0
cachetools==5.3.0
certifi==2023.5.7
charset-normalizer==3.1.0
click==8.1.3
exceptiongroup==1.1.1
frozenlist==1.3.3
google-ai-generativelanguage==0.2.0
google-api-core==2.11.0
google-auth==2.18.0
google-generativeai==0.1.0rc2
googleapis-common-protos==1.59.0
grpcio==1.54.2
grpcio-status==1.54.2
h11==0.14.0
httpcore==0.17.0
httpx==0.24.0
idna==3.4
iniconfig==2.0.0
markdown-it-py==2.2.0
mdurl==0.1.2
multidict==6.0.4
mypy-extensions==1.0.0
openai==0.27.2
packaging==23.1
pathspec==0.11.1
pkg_resources==0.0.0
platformdirs==3.5.1
pluggy==1.0.0
prompt-toolkit==3.0.38
proto-plus==1.22.2
protobuf==4.23.0
pyasn1==0.5.0
pyasn1-modules==0.3.0
Pygments==2.15.1
pytest==7.3.1
PyYAML==6.0
regex==2023.5.5
requests==2.30.0
rich==13.3.2
rsa==4.9
six==1.16.0
sniffio==1.3.0
tiktoken==0.3.3
tokenizers==0.13.3
tomli==2.0.1
tqdm==4.65.0
typing_extensions==4.5.0
urllib3==1.26.15
wcwidth==0.2.6
yarl==1.9.2```

from gpt-cli.

dltn avatar dltn commented on May 14, 2024

I've also hit this on a clean install on Mac. The issue occurs for any Python <3.9 due to the typing error in upstream google-generativeai 0.1.0rc2, discussed in google/generative-ai-python#13 and fixed in google/generative-ai-python#16.

In addition to fixing the type issue, google-generativeai has also dropped support for any Python <3.9 in 0.1.0rc3/0.1.0, which means it isn't as simple as bumping the package:

% diff --git a/requirements.txt b/requirements.txt
-google-generativeai==0.1.0rc2
+google-generativeai==0.1.0

% python3 -m pip install -r requirements.txt
ERROR: Ignored the following versions that require a different python version: 0.1.0 Requires-Python >=3.9; 0.1.0rc3 Requires-Python >=3.9

@kharvd: do you want to make gpt-cli Python 3.9+ only?

from gpt-cli.

dltn avatar dltn commented on May 14, 2024

@kharvd: do you want to make gpt-cli Python 3.9+ only?

If yes: #39

from gpt-cli.

kharvd avatar kharvd commented on May 14, 2024

Merged #39, Python >= 3.9 is now required, thanks @dltn

from gpt-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.