I used GPT4all to create a RAG Pipeline with the help of langchain. When I use API for other purposes, it works fine but when I Hit the RAG pipeline, It gives access denied error.
Error getting: Permission Error
Root Cause: Unable to create model download directory in system profile. Access denied to 'C:\Windows\system32\config\systemprofile.cache'
Environment:
Python Version: 3.12
Operating System: Windows
Key Packages:
Full Error:
{
"error":"Error in Database Chain: Failed to create model download directory",
"traceback":"Traceback (most recent call last):
File "C:\Python312\Lib\site-packages\gpt4all\gpt4all.py", line 323, in retrieve_model
os.makedirs(DEFAULT_MODEL_DIRECTORY, exist_ok=True)
File "", line 215, in makedirs
File "", line 225, in makedirs
PermissionError: [WinError 5] Access is denied:
'C:\\Windows\\system32\\config\\systemprofile\\.cache'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\inetpub\wwwroot\hashmove-ai\HMAI\Controllers\ConversationalAIv2_Controller.py", line 143, in post
hmgpt_response = query_response(input_query, query_intent)
File "C:\inetpub\wwwroot\hashmove-ai\HMAI_Business\ConversationalAIv2_Business.py", line 281, in query_response
return response_functions.get(intent_response, irrelevant)(query)
File "C:\inetpub\wwwroot\hashmove-ai\HMAI_Business\ConversationalAIv2_Business.py", line 251, in logistics
chain = log_chain(load_llm(), vector_db(), memory(), log_prompt())
File "C:\inetpub\wwwroot\hashmove-ai\HMAI_Business\ConversationalAIv2_Business.py", line 90, in load_llm
loaded_llm = GPT4All(
File "C:\Python312\Lib\site-packages\langchain_core\load\serializable.py", line 125, in init
super().init(*args, **kwargs)
File "C:\Python312\Lib\site-packages\pydantic\main.py", line 212, in init
validated_self = self.pydantic_validator.validate_python(data, self_instance=self)
File "C:\Python312\Lib\site-packages\pydantic\_internal\_decorators_v1.py", line 148, in _wrapper1
return validator(values)
File "C:\Python312\Lib\site-packages\langchain_core\utils\pydantic.py", line 208, in wrapper
return func(cls, values)
File "C:\Python312\Lib\site-packages\langchain_community\llms\gpt4all.py", line 145, in validate_environment
values["client"] = GPT4AllModel(
File "C:\Python312\Lib\site-packages\gpt4all\gpt4all.py", line 235, in init
self.config: ConfigType = self.retrieve_model(model_name, model_path=model_path, allow_download=allow_download, verbose=verbose)
File "C:\Python312\Lib\site-packages\gpt4all\gpt4all.py", line 325, in retrieve_model
raise RuntimeError("Failed to create model download directory") from e
RuntimeError: Failed to create model download directory
"}
Tried giving manuall path to the cache:
os.environ["TIKTOKEN_CACHE_DIR"] = "embeddings-cache"
But didn't worked.
Note: I've deployed this on a server using IIS server.
I've deployed this on a server using IIS server
The error message is clear, it is an identity permission problem. What identity does your application access as? Anonymous identity or something else?
But based on the error message, it seems that your code related to some system driver folder permission. You can try to set admin permission in Application pool identity.
Advanced Settings
.Custom account
and Set...
.