Hi,

If you've recently installed Jupyter-AI and tried interacting with popular providers like OpenAI, Ollama, or others, you may have noticed that a minimal installation(pip install jupyter-ai) is missing some necessary packages.

At this point, you have two options:

  • Install the full version with pip install jupyter-ai[all].
  • Install the additional package for your chosen provider. E.g. pip install langchain-openai

Unfortunately, running pip install jupyter-ai[all] can result in an infinite installation loop due to pip's dependency resolution, often without success. 😞

`INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.

Additionally, installing the individual package for your chosen provider may lead to dependency conflicts, such as the one shown below: 😞

$ pip install langchain-openai
....
Installing collected packages: tqdm, regex, jiter, distro, tiktoken, openai, langchain-core, langchain-openai
  Attempting uninstall: langchain-core
    Found existing installation: langchain-core 0.2.43
    Uninstalling langchain-core-0.2.43:
      Successfully uninstalled langchain-core-0.2.43
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
langchain 0.2.16 requires langchain-core<0.3.0,>=0.2.38, but you have langchain-core 0.3.15 which is incompatible.
langchain-community 0.2.17 requires langchain-core<0.3.0,>=0.2.39, but you have langchain-core 0.3.15 which is incompatible.
langchain-text-splitters 0.2.4 requires langchain-core<0.3.0,>=0.2.38, but you have langchain-core 0.3.15 which is incompatible.
Successfully installed distro-1.9.0 jiter-0.7.0 langchain-core-0.3.15 langchain-openai-0.2.5 openai-1.53.0 regex-2024.9.11 tiktoken-0.8.0 tqdm-4.66.6

If you'd prefer to avoid this issue, you can install the packages using Conda: 💡

conda install conda-forge::jupyter-ai conda-forge::langchain-openai

Unfortunately, Conda doesn't include all the available provider packages. E.g. https://anaconda.org/search?q=langchain-ollama

In such cases, you can install older versions of these packages manually, like so:

pip install langchain-openai==0.1.23
pip install langchain-ollama==0.1.0

🤓🤓


References:

  1. https://github.com/jupyterlab/jupyter-ai/issues/1017
  2. https://github.com/jupyterlab/jupyter-ai/issues/1082

Previous Post Next Post