Conflict between langchain-openai and openai==1.3.5 in Pipenv: How to resolve dependency issues?

I am migrating to langchain version 0.2 in my project, which now requires installing LLM models separately. I attempted to install langchain-openai using:

pipenv install langchain-openai

However, this conflicts with another package in my environment:

openai = "==1.3.5"

It seems I need to find a compatible version of langchain-openai that works with openai==1.3.5 or consider upgrading openai without breaking my current code.

My question is: How can I determine which version of the openai SDK is compatible with specific versions of langchain-openai? I’ve checked PyPI, but I couldn’t find detailed information about dependencies between these packages.

Terminal output:

pipenv install langchain_openai
Loading .env environment variables...
Installing langchain_openai...
Resolving langchain_openai...
Added langchain-openai to Pipfile's [packages] ...
Installation Succeeded
Pipfile.lock (244de0) out of date, updating to (fca94c)...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
Locking Failed!
[==  ] Locking...False
CRITICAL:pipenv.patched.pip._internal.resolution.resolvelib.factory:Cannot install -r C:\Users\MUBASH~1\AppData\Local\Temp\pipenv-uudymc5q-requirements\pipenv-ustatlmc-constraints.txt (line 48), -r C:\Users\MUBASH~1\AppData\Local\Temp\pipenv-uudymc5q-requirements\pipenv-ustatlmc-constraints.txt (line 68) and openai==1.3.5 because these package versions have conflicting dependencies.

Any guidance on how to proceed would be greatly appreciated.

I found a way to determine the compatible version of the openai SDK for a specific langchain-openai version:

  1. Visit the PyPI page for langchain-openai.
  2. Go to the Release history section and select a version of interest.
  3. Click on Source Code (or go to the repository directly).
  4. Navigate to the /libs/partners/openai directory if you accessed the main repo; the source code link will take you directly to this directory.
  5. Open the pyproject.toml file, where you can find the exact openai version that the langchain-openai version depends on.
  6. If needed, switch the branch/tags to another version to check compatibility with different versions.

This method allowed me to identify the compatible version for my project. But things don’t end there. I now need to figure out what version of langchain-openai works with the rest of the langchain modules.
Edit: Scratch this. The langchain-openai is inside a langchain version so no further search is necessary.

1 Like

Did you try uninstalling both and then just install openai and langchain with the version and let pip resolve it…

Bot paste is not appreciated. Especially when represented as your own writings.
We all have a chatbot.

Users of the forum must adhere to OpenAI policies. Like:

Failing to disclose that the output is generated by a chatbot

So be transparent that the (poor) answers you’re filling the forum with are a product of AI, and where the AI text starts, and that you actually understand and have verified what is written and that it is truthful and effective, instead of an automated irrelevant time waste that’s gonna have people press flag instead of like.


The requirement for a particular library version is not obvious: nothing in the newest OpenAI version should break compatibility, where as you’d be blocked from using scale compute or other new API features in a locked aging version. It perhaps is just safety that it could break something.

The langchain wheel module requirements should be something more like “openai<2.0”. Make a venv for just running langchain, I guess.

1 Like

Proofreading with AI seems like it would have merits here…

“What exactly are you implying? Are you attempting to confront me aggressively? That will not stand. I have repeatedly clarified my point to the forum; it seems you acted on my advice without proper consideration and are now trying to pin the outcome on me. I’ve dedicated the past ten years to studying computer science and, based on my knowledge, the requests were clearly addressed to what they needed, not what you assumed.”

Copying unverified AI responses to a user’s questions that you didn’t write yourself, though, telling people to vet everything you reply (as what you represent as your own writings is solely going to be an unreliable AI product), is without value.