Skip to content

New User Install Process #7

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

Closed
Gadgit83 opened this issue Feb 22, 2025 · 7 comments
Closed

New User Install Process #7

Gadgit83 opened this issue Feb 22, 2025 · 7 comments

Comments

@Gadgit83
Copy link

Gadgit83 commented Feb 22, 2025

As I'm completely new to many (all) of the processes described here, and my development environment was clean, I thought I would make some comments of items I've discovered which may be useful to others going through the same process. Perhaps the documentation could be updated to include this info.

Now as far as I've gotten is through running run.ps1, but get the following errors:

Creating library build\temp.win-amd64-cpython-313\Release\src\c\_cffi_backend.cp313-win_amd64.lib and object build\temp.win-amd64-cpython-313\Release\src\c\_cffi_backend.cp313-win_amd64.exp
      _cffi_backend.obj : error LNK2001: unresolved external symbol _PyErr_WriteUnraisableMsg
      build\lib.win-amd64-cpython-313\_cffi_backend.cp313-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.43.34808\\bin\\HostX86\\x64\\link.exe' failed with exit code 1120
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cffi
  error: subprocess-exited-with-error

Then a bunch more error output about regex.c errors then:

      running build_rust
      error: can't find Rust compiler
     
      If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
     
      To update pip, run:
     
          pip install --upgrade pip
     
      and then retry package installation.
     
      If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at 
https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tiktoken

I'll have to see whether I can work out what's going on here - but I'm a few hours in and out of time tonight. Wanted to post these notes in case they help anyone else. Edit - These issues went away when I installed Python 3.12 instead of 3.13!

@Gadgit83
Copy link
Author

Gadgit83 commented Feb 22, 2025

I think the issue I'm seeing with:
'error LNK2001: unresolved external symbol _PyErr_WriteUnraisableMsg' might be linked to this: python-cffi/cffi#48 but I'm not sure how to deal with that

Edit: Looks like following the recommendation here:
python-cffi/cffi#23 (comment)

to change the cffi line in requirements.txt once it has been built seemed to work around this issue:

cffi>1.15 ; python_version <= "3.12"

or perhaps a better way would be to add it to requirements.in

however, I'm still getting the issues with regex (syntax errors) and titiktoken (no rust compiler)

@Gadgit83
Copy link
Author

Just as an update - I installed Python 3.12 rather than 3.13 and that got me through successfully running venv.ps1.

Running .\venv\Scripts\activate seems to have worked OK - or at least no errors

Next issue is:
running: python main_vcore.py create_vcore_collections_and_indexes
2025-02-23 22:55:49,829 - Username and password must be escaped according to RFC 3986, use urllib.parse.quote_plus

Turns out my browser randomly generated password contained characters (such as @) which needed escaping (so I removed those characters from the password :o )

@Gadgit83
Copy link
Author

Next problem was getting timeouts on my connection to MongoDB which turned out to be that I needed to unblock my IP in the Database Networking Settings in Azure as described here:
https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/vcore/troubleshoot-common-issues

Next issue I noticed was that my database wasn't created with a 'cache' collection - not sure if that's going to be an issue yet. However, it did have a 'feedback' one, which wasn't expected

Image

@Gadgit83
Copy link
Author

I've just discovered the 'docs' folder! I should have noticed that before - it covered a bunch of my issues. particularly that I should have run set-caig-env-vars-sample.ps1 first, think I was out of sequence on this
https://github.com/AzureCosmosDB/CosmosAIGraph/tree/main/impl/docs

After a lot of messing around trying to understand how to deploy the Bicep (I'm not sure how I fixed this, it was failing, then I don't think I changed anything signifcantly - although may have fiddled with some of the env vars, then it worked) I've got the application deployed, however, I didn't get what look like sensible results from the SPARQL console. I think it may have been because I left the default CAIG_ENCRYPTION_SYMMETRIC_KEY value in, so the communication between the front end and the database wasn't authenticated correctly. Now I'm getting some nice results and graphs etc. !

Image

Going to close this 'issue' as it's all just my issues and ramblings, but they may be of use to someone else in the future/me if I try to set up again! Top tip: RTFM (five times)

@Gadgit83
Copy link
Author

Gadgit83 commented Feb 28, 2025

Just further notes. I found I was getting 'HTTP/1.1 404 DeploymentNotFound' when calling the OpenAI Endpoint from the 'conversations'. Upon investigation, I believe the api version was wrong (as defined default value in config_service.py doesn't match the api version deployed), so created a new ENV variable of CAIG_AZURE_OPENAI_VERSION with the correct api version from the deployed model.

That doesn't seem to have solved the problem though, and I'm still struggling to work out why I'm getting DeploymentNotFound - there's a network connection between the two, because if I disable the network I get a 403 error. I've checked again and again the endpoint and API key, and the 'name' of the model.

What I can't understand is how the models are supposed to be deployed - it seems some documentation talks about deploying the models within the Azure portal, but then it now seems you have to do this in the AI foundary - but you can't allocate a model to the Azure OpenAI resource, it always creates a new one when I try to create a model, which has a different endpoint. If I try to use that enpoint it also doesn't work, get the 404 DeploymentNotFound. I get the same error if I try to navigate directly to the endpoint. Wiil have to try creating a test script.

Edit The test script worked (eventually, after using 2 different examples from the AI Foundary/playground - one of which didn't even work! So the problem isn't the model deployment.

@Gadgit83
Copy link
Author

Gadgit83 commented Mar 1, 2025

After a lot of searching, I found this - which has helped:

https://learn.microsoft.com/en-us/answers/questions/1339528/cant-deploy-azure-open-ai-models-due-no-quota-is-a

Although I still can't 'deploy' models under my OpenAI resource within Azure portal (under the AI Foundary). So instead, I'm using one of the 'resources' generated automatically by AI Foundary, and taking it's endpoint and API key

but now I'm getting token rate limit warning messages instead!

Exception in StrategyBuilder#determine: what are flasks dependancies Error code: 429 - {'error': {'code': '429', 'message': 'Requests to the ChatCompletions_Create Operation under Azure OpenAI API version 2023-05-15 have exceeded token rate limit of your current AIServices S0 pricing tier. Please retry after 86400 seconds. Please contact Azure support service if you would like to further increase the default rate limit.'}}

I think this could be the reason:
https://learn.microsoft.com/en-us/answers/questions/2111423/exceeded-token-rate-limit-on-azure-openai-model-wi

I feel like I'm somehow making progress, but this has been an absolute nightmare to set up - mainly due to the complexity and poor UI/UX of Azure portal, mismatching/outdated documentation of the Azure portal functions, and overall complexity of the interfaces between all the different services required

@Gadgit83
Copy link
Author

Gadgit83 commented Mar 7, 2025

Successfully ran the Activate.ps1 and load_vcore_with_library_documents commands but running

python main_vcore.py persist_entities

as suggested in https://github.com/AzureCosmosDB/CosmosAIGraph/blob/main/impl/docs/load_cosmos_vcore.md

gave the following error:

(venv) PS C:\VSCode\CosmosAIGraph\CosmosAIGraph\impl\app> python main_vcore.py persist_entities
C:\VSCode\CosmosAIGraph\CosmosAIGraph\impl\app\main_vcore.py:235: RuntimeWarning: coroutine 'persist_entities' was never awaited
  persist_entities()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Changing line 245 in main_vcore.py to

asyncio.run(persist_entities())

didn't help much but error has more detail:

2025-02-24 08:27:13,367 - CosmosVCoreService - client initialized
2025-02-24 08:27:15,187 - EntitiesService#load - entities docs found: 0, size: 0
2025-02-24 08:27:15,189 - 'EntitiesService' object has no attribute 'vcore'

.... other traceback stuff ...

AttributeError: 'EntitiesService' object has no attribute 'vcore'

I'm going to try carrying on and deploying the Azure container app

It then wasn't immediately obvious how I do this, but from looking at the readme.md in impl/deployment, and then installing the Azure and BICEP VSCode extensions along with NodeJS (to run the Azure CLI), then running set-caig-env-vars-sample.ps1 (after updating all the values to my best guesses), restarting VSCode (so env variables take affect), then 'deploying the BICEP' on caig.bicep in impl/deployment worked

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

1 participant