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

No model named googlegenerative.ai #120

Open
offmybach opened this issue Oct 28, 2024 · 12 comments
Open

No model named googlegenerative.ai #120

offmybach opened this issue Oct 28, 2024 · 12 comments

Comments

@offmybach
Copy link

offmybach commented Oct 28, 2024

I have attempted numerous times and several with the help of ChatGPT4o to correct the error of File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party\llm.py", line 16, in
import google.generativeai as genai
ModuleNotFoundError: No module named 'google.generativeai'

Cannot import K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party module for custom nodes: No module named 'google.generativeai'

This happens each time I load comfyui. I have entered api key for Gemini Google into the ini in each place required. I have also confirmed that I have the googlegenerativeai files in my LIB site packages folder.

I am using windows 11 and the latest version of Comfyui. All are up to date.

The log repeatedly shows the following:
Traceback (most recent call last):
File "K:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 2006, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party_init
.py", line 14, in
from .llm import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party\llm.py", line 16, in
import google.generativeai as genai
ModuleNotFoundError: No module named 'google.generativeai'

Cannot import K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party module for custom nodes: No module named 'google.generativeai'
[MaraScott] Loaded

this is my config.ini . Maybe there is error here?

[API_KEYS]
openai_api_key =
base_url = https://api.openai.com/v1/
google_api_key =
cse_id = bing_api_key = bing_api_key_put_here
github_api_key = github_api_key_put_here
google_api_url =
wechat_url=work_wechat_url_put_here
dingding_url=dingding_url_put_here
feishu_url=feishu_url_put_here
language=#zh_CN or en_US
fastapi_api_key=

[google_gemini]
base_url =
api_key =

[your_model_name]
base_url=
api_key=

[deepseek-chat]
base_url=https://api.deepseek.com/v1/
api_key=

[glm-4]
base_url=https://open.bigmodel.cn/api/paas/v4/
api_key=

[qwen-max]
base_url=https://dashscope.aliyuncs.com/compatible-mode/v1/
api_key=

[moonshot-v1-8k]
base_url=https://api.moonshot.cn/v1/
api_key=

[general]
base_url=https://spark-api-open.xf-yun.com/v1/
api_key=

[doubao_YOUR_ENDPOINT_ID]
base_url=https://ark.cn-beijing.volces.com/api/v3/
api_key=

[llama3]
base_url=http://127.0.0.1:11434/v1/
api_key=ollama

[your_azure_openai_model_name]
base_url=https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/chat/completions?api-version=2024-06-01
api_key=

@heshengtao
Copy link
Owner

First of all, your key is exposed on the public network, please delete your key immediately. Second, you can use pip install google-generativeai in the comfyui environment.

@heshengtao
Copy link
Owner

Also, if you want to use gemini, you need to use the gemini API loader node.

@offmybach
Copy link
Author

thanks I deleted key, that was really stupid of me.

@offmybach
Copy link
Author

now I get this... HTTP Request: GET https://api.openai.com/v1/models "HTTP/1.1 401 Unauthorized"
Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-proj-********************************************************************************************************************************************************DLIA. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Traceback (most recent call last):
File "K:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 2006, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party_init
.py", line 14, in
from .llm import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party\llm.py", line 16, in
import google.generativeai as genai
ModuleNotFoundError: No module named 'google.generativeai'

Cannot import K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party module for custom nodes: No module named 'google.generativeai'

@offmybach
Copy link
Author

google.generativeai is definitely installed 0..8.3

@heshengtao
Copy link
Owner

The first error can be ignored. He requested openai with the key in your config.ini file to automatically get the model of openai, but you are using gemini, you should not have filled in your gemini key in the openai_api_key.
The second error means that there is no such dependency in the environment. You must have not activated the comfyui environment and installed the dependency into your base environment.

You can find python.exe in your comfyui folder. Under the folder containing python.exe, right-click to open CMD and enter python.exe -m pip install google-generativeai.

@offmybach
Copy link
Author

I just spent 2 hours with Chatgpt cleaning up my requirements and comfyui files to get google gen and other dependencies working properly. now this is the error I am receiving. it changed from missing googlegenai to google ai now.
I may sound stupid but I just don't understand how this works. I thought that it was a "party" and all of the models could be accessed at once. How do I fix this so that there aren't any conflicts and just using llama and gpt or whatever else is necessary? Thanks!

HTTP Request: GET https://api.openai.com/v1/models "HTTP/1.1 401 Unauthorized"
Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-proj-********************************************************************************************************************************************************DLIA. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Traceback (most recent call last):
File "K:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 2006, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party_init
.py", line 14, in
from .llm import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party\llm.py", line 16, in
import google.generativeai as genai
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\generativeai_init_.py", line 45, in
from google.generativeai import caching
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\generativeai\caching.py", line 21, in
from google.generativeai import protos
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\generativeai\protos.py", line 74, in
from google.ai.generativelanguage_v1beta.types import *
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\ai\generativelanguage_v1beta_init_.py", line 21, in
from .services.cache_service import CacheServiceAsyncClient, CacheServiceClient
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\ai\generativelanguage_v1beta\services\cache_service_init_.py", line 16, in
from .async_client import CacheServiceAsyncClient
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\ai\generativelanguage_v1beta\services\cache_service\async_client.py", line 31, in
from google.api_core import exceptions as core_exceptions
ModuleNotFoundError: No module named 'google.api_core'

Cannot import K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party module for custom nodes: No module named 'google.api_core'

@offmybach
Copy link
Author

wait! now I only get this error File "K:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 2006, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party_init
.py", line 13, in
from .config_update import update_config
File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party\config_update.py", line 18, in
llm_base_url=llm_api_keys.get("base_url").strip()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'strip'

Cannot import K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party module for custom nodes: 'NoneType' object has no attribute 'strip'

@offmybach
Copy link
Author

I have spent nearly an entire day attempting to fix this nightmare and now am back to the beginning - can't find googlegenai. If i install this again, all of the dependencies that I've cured will be ruined again.

@heshengtao
Copy link
Owner

I have reinstalled party many times on different devices and have not reproduced your problem. I think you have another plugin blocking the installation of googlegenai.

@offmybach
Copy link
Author

I have reinstalled party many times on different devices and have not reproduced your problem. I think you have another plugin blocking the installation of googlegenai.

It seems like each time that I attempt to fix the install, I get another missing google file. now it's google.rpc.

aceback (most recent call last):
File "K:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 2024, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party_init
.py", line 14, in
from .llm import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
File "K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party\llm.py", line 16, in
import google.generativeai as genai
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\generativeai_init_.py", line 45, in
from google.generativeai import caching
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\generativeai\caching.py", line 21, in
from google.generativeai import protos
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\generativeai\protos.py", line 74, in
from google.ai.generativelanguage_v1beta.types import *
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\ai\generativelanguage_v1beta_init_.py", line 21, in
from .services.cache_service import CacheServiceAsyncClient, CacheServiceClient
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\ai\generativelanguage_v1beta\services\cache_service_init_.py", line 16, in
from .async_client import CacheServiceAsyncClient
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\ai\generativelanguage_v1beta\services\cache_service\async_client.py", line 31, in
from google.api_core import exceptions as core_exceptions
File "K:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\google\api_core\exceptions.py", line 29, in
from google.rpc import error_details_pb2
ModuleNotFoundError: No module named 'google.rpc'

Cannot import K:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_LLM_party module for custom nodes: No module named 'google.rpc'

@heshengtao
Copy link
Owner

[Deprecation Notice] In the latest version of party, the original Gemini API LLM loader node has been deprecated in the new version. Please use the LLM API loader node, base_url select: https://generativelanguage.googleapis.com/v1beta/

Now the party doesn't depend on this uncomfortable googlegenerative.ai library

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

2 participants