langchain icon indicating copy to clipboard operation
langchain copied to clipboard

ModuleNotFoundError: No module named 'langchain.schemas'

Open Aspyryan opened this issue 1 year ago • 8 comments

When installing Langchain==0.0.155 I am getting the error that langchain.schemas does not exists. This is because the file is named langchain.schema so there is a typo. I will create a pull request and reference this issue.

Aspyryan avatar May 02 '23 09:05 Aspyryan

encountered same error, already fix it by your instructions, thanks!

Candy75 avatar May 02 '23 13:05 Candy75

encountered same error, already fix it by your instructions, thanks!

how do you fix it?

YHOYO avatar May 02 '23 14:05 YHOYO

Click “Fix issue”, you will see the answer. IMG_4630

Candy75 avatar May 02 '23 15:05 Candy75

same issue here how do you fix it? I do not see any solution here yet! please publish your instructions if any.

phdykd avatar May 02 '23 15:05 phdykd

Yea I implemented Pull Request #3961, sorry for not referencing it

Aspyryan avatar May 02 '23 15:05 Aspyryan

so what should I write instead of this code that I have "from langchain.document_loaders import UnstructuredPDFLoader from langchain.indexes import VectorstoreIndexCreator"?

phdykd avatar May 02 '23 15:05 phdykd

so what should I write instead of this code that I have "from langchain.document_loaders import UnstructuredPDFLoader from langchain.indexes import VectorstoreIndexCreator"?

You have to go into the source code, so where python is installed on your system, go to site_package and edit the file langchain/indexes/vectorstore.py with the changes

Aspyryan avatar May 02 '23 16:05 Aspyryan

thanks many

phdykd avatar May 02 '23 17:05 phdykd

Thanks for the help, what would you do if you're deploying the code via github? Theres no source code in the repo or there is?

brunooyague avatar May 02 '23 20:05 brunooyague

Thanks for the help, what would you do if you're deploying the code via github? Theres no source code in the repo or there is?

You got two options. You can wait for the maintainers to approve the pull request or you could create a fork of the project and fix it yourself, publish the package etc. (not shure how easy this part is)

Aspyryan avatar May 02 '23 20:05 Aspyryan

Thanks for the help, what would you do if you're deploying the code via github? Theres no source code in the repo or there is?

You got two options. You can wait for the maintainers to approve the pull request or you could create a fork of the project and fix it yourself, publish the package etc. (not shure how easy this part is)

Just changed the requirements.txt to a previous version of langchain and worked :)

brunooyague avatar May 02 '23 20:05 brunooyague

Seems to have been fixed by #4003

manoloth avatar May 03 '23 09:05 manoloth

This is indeed fixed now, closing the issue

Aspyryan avatar May 03 '23 09:05 Aspyryan