Skip to content
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

No module named 'langchain.pydantic_v1' #113

Open
sanjeevkumar761 opened this issue Sep 7, 2023 · 3 comments
Open

No module named 'langchain.pydantic_v1' #113

sanjeevkumar761 opened this issue Sep 7, 2023 · 3 comments

Comments

@sanjeevkumar761
Copy link

I am getting this error "No module named 'langchain.pydantic_v1' while executing the below code:

with CodeInterpreterSession() as session:
  # generate a response based on user input
  response = session.generate_response(
      "Plot the bitcoin chart of year 2023"
  )

  # output the response
  response.show()

I installed the packages using
pip install "codeinterpreterapi[all]"

Any ideas how to solve it?

@sanjeevkumar761
Copy link
Author

Also getting the error "cannot import name 'settings' from 'codeinterpreterapi'"

@ventz
Copy link

ventz commented Sep 12, 2023

Same. And when you install it, it ends up conflicting with a couple of things (mainly the issue being FastAPI -- althought Chainlit too if you are using that):

If you are using pydantic v2+

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.
chainlit 0.6.402 requires pydantic<2.0.0,>=1.10.8, but you have pydantic 2.3.0 which is incompatible.
fastapi 0.99.1 requires pydantic!=1.8,!=1.8.1,<2.0.0,>=1.7.4, but you have pydantic 2.3.0 which is incompatible.

vs

If you are using pydantic v<2

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.
codeboxapi 0.0.19 requires pydantic<3,>=2, but you have pydantic 1.10.12 which is incompatible.
codeinterpreterapi 0.0.12 requires pydantic<3,>=2, but you have pydantic 1.10.12 which is incompatible.
pydantic-settings 2.0.3 requires pydantic>=2.0.1, but you have pydantic 1.10.12 which is incompatible.

@Ebinjose10
Copy link

for me fast api and its working i am using a down graded version (codeinterpreterapi==0.0.7),downgrading may help ,
also while using fast api my openai imports also failed to work then try installing using (conda install -c conda-forge openai)

but when i am using JWT authenticationin fast api ,i am getting error

Process SpawnProcess-1:
Traceback (most recent call last):
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/uvicorn/subprocess.py", line 61, in subprocess_started
target(sockets=sockets)
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/uvicorn/server.py", line 48, in run
loop.run_until_complete(self.serve(sockets=sockets))
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/uvicorn/server.py", line 55, in serve
config.load()
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/uvicorn/config.py", line 308, in load
self.loaded_app = import_from_string(self.app)
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/uvicorn/importer.py", line 20, in import_from_string
module = importlib.import_module(module_str)
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/datascience.apis/ecom_automation/./JWT_GUI_MAIN.py", line 13, in
from code_interpreter_GUI_test import main_2
File "/home/datascience.apis/ecom_automation/./code_interpreter_GUI_test.py", line 1, in
from codeinterpreterapi.session import CodeInterpreterSession
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/codeinterpreterapi/init.py", line 1, in
from codeinterpreterapi.session import CodeInterpreterSession
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/codeinterpreterapi/session.py", line 6, in
from langchain.tools import StructuredTool, BaseTool
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/langchain/init.py", line 6, in
from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/langchain/agents/init.py", line 2, in
from langchain.agents.agent import (
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/langchain/agents/agent.py", line 16, in
from langchain.agents.tools import InvalidTool
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/langchain/agents/tools.py", line 8, in
from langchain.tools.base import BaseTool, Tool, tool
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/langchain/tools/init.py", line 3, in
from langchain.tools.arxiv.tool import ArxivQueryRun
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/langchain/tools/arxiv/tool.py", line 12, in
from langchain.utilities.arxiv import ArxivAPIWrapper
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/langchain/utilities/init.py", line 3, in
from langchain.utilities.apify import ApifyWrapper
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/langchain/utilities/apify.py", line 5, in
from langchain.document_loaders import ApifyDatasetLoader
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/langchain/document_loaders/init.py", line 44, in
from langchain.document_loaders.embaas import EmbaasBlobLoader, EmbaasLoader
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/langchain/document_loaders/embaas.py", line 54, in
class BaseEmbaasLoader(BaseModel):
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/pydantic/main.py", line 262, in new
fields[ann_name] = inferred = ModelField.infer(
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/pydantic/fields.py", line 315, in infer
return cls(
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/pydantic/fields.py", line 284, in init
self.prepare()
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/pydantic/fields.py", line 356, in prepare
self.type_analysis()
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/pydantic/fields.py", line 424, in type_analysis
if isinstance(self.type
, type) and isinstance(None, self.type
):
File "/data/data/minicoda2/envs/ecom_auto/lib/python3.10/site-packages/typing_extensions.py", line 1073, in subclasscheck
raise TypeError('TypedDict does not support instance and class checks')
TypeError: TypedDict does not support instance and class checks

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

3 participants