Find answers from the community

Updated 11 months ago

Llama index

At a glance

A community member is trying to migrate their project to LlamaIndex v0.10 but is encountering an error when running llamaindex-cli upgrade <target folder>. The error message indicates an issue with importing ChatMessage from llama_index.core.llms. The community member has tried creating new environments using different tools (conda, pyenv, python venv) but the issue persists.

In the comments, another community member suggests trying a fresh install by uninstalling the existing LlamaIndex, creating a new virtual environment, and reinstalling the latest version. However, this did not resolve the issue. Another community member mentions that the problem was resolved when they ran the upgrade in a Docker container, though they had to uninstall the old version and install the new one.

The final suggestion from a community member is to completely uninstall everything in the current environment, then reinstall the latest version of LlamaIndex with the --upgrade --no-cache-dir --force-reinstall options.

Hey! I've finally decided to migrate my project to v0.10, however I can't find the cause of the following error message. when I try to run: llamaindex-cli upgrade <target folder>
I get this error: "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/llama_index/core/utilities/token_counting.py", line 6, in <module>
from llama_index.core.llms import ChatMessage, MessageRole
ImportError: cannot import name 'ChatMessage' from 'llama_index.core.llms' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/llama_index/core/llms/init.py)

I tried creating a new env from scratch (with conda, pyenv and also python venv), however I repeatedly get this error. Is the llamaindex-cli broken, or is there another way to resolve this problem? I couldn't find anything here or in the github repo.
L
D
5 comments
Hmmm, just as a sanity check, in a brand new fresh terminal

Plain Text
pip uninstall llama-index  # remove any global install
python -m venv venv
source venv/bin/activate
pip install llama-index --upgrade --no-cache-dir --force-reinstall
Unfortunately this didn't resolve it. Do you have any other idea?
I tried running it in a docker container, there it actually works, even though I needed to uninstall the old llama-index and install the new version.
My other idea would be to just completely uninstall everything in a current env

Plain Text
pip freeze | xargs pip uninstall -y
pip install llama-index --upgrade --no-cache-dir --force-reinstall
thanks, i will give it a try!
Add a reply
Sign up and join the conversation on Discord