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

ModuleNotFoundError: No module named 'megaparse.parser' #158

Open
rohanbalkondekar opened this issue Dec 3, 2024 · 7 comments
Open

ModuleNotFoundError: No module named 'megaparse.parser' #158

rohanbalkondekar opened this issue Dec 3, 2024 · 7 comments

Comments

@rohanbalkondekar
Copy link

image

Both code snippets Copied from README.md

from megaparse import MegaParse
from langchain_openai import ChatOpenAI
from megaparse.parser.unstructured_parser import UnstructuredParser

parser = UnstructuredParser()
megaparse = MegaParse(parser)
response = megaparse.load("./test.pdf")
print(response)
megaparse.save("./resume.md")

Error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[2], [line 3](vscode-notebook-cell:?execution_count=2&line=3)
      [1](vscode-notebook-cell:?execution_count=2&line=1) from megaparse import MegaParse
      [2](vscode-notebook-cell:?execution_count=2&line=2) from langchain_openai import ChatOpenAI
----> [3](vscode-notebook-cell:?execution_count=2&line=3) from megaparse.parser.unstructured_parser import UnstructuredParser
      [5](vscode-notebook-cell:?execution_count=2&line=5) parser = UnstructuredParser()
      [6](vscode-notebook-cell:?execution_count=2&line=6) megaparse = MegaParse(parser)

ModuleNotFoundError: No module named 'megaparse.parser'
import os
from megaparse import MegaParse
from langchain_openai import ChatOpenAI
from megaparse.parser.megaparse_vision import MegaParseVision

model = ChatOpenAI(model="gpt-4o", api_key=os.getenv("OPENAI_API_KEY"))  # type: ignore
parser = MegaParseVision(model=model)
megaparse = MegaParse(parser)
response = megaparse.load("./test.pdf")
print(response)
megaparse.save("./test.md")

Error:

import os
from megaparse import MegaParse
from langchain_openai import ChatOpenAI
from megaparse.parser.megaparse_vision import MegaParseVision

model = ChatOpenAI(model="gpt-4o", api_key=os.getenv("OPENAI_API_KEY"))  # type: ignore
parser = MegaParseVision(model=model)
megaparse = MegaParse(parser)
response = megaparse.load("./test.pdf")
print(response)
megaparse.save("./test.md")

Name: megaparse
Version: 0.0.31
Location: /home/rohan/Desktop/call_ai/llm_test/.venv/lib/python3.10/site-packages
Requires: langchain, langchain-community, langchain-core, langchain-openai, llama-index, llama-parse, mammoth, pdf2docx, pdfplumber, pycryptodome, python-docx, python-dotenv, python-pptx, unstructured

@StanGirard
Copy link
Contributor

Ok you have to install version 0.0.48 at least. We have an issue with the pypi where you might have an old version of Python and uv shadow installs the lowest python version compatible. Try forcing installing 0.0.48

@tomasrollo
Copy link

@StanGirard I tried forcing installing 0.0.48 on mac but got into dependencies collision 🤔:

 ~/Documents/projects/megaparse  uv pip install megaparse==0.0.48                                                                                                   ✔  ▼  megaparse 
  × No solution found when resolving dependencies:
  ╰─▶ Because effdet<=0.3.0 depends on torch>=1.4 and only the following versions of effdet are available:
          effdet==0.1.0
          effdet==0.1.2
          effdet==0.1.6
          effdet==0.2.1
          effdet==0.2.4
          effdet==0.3.0
          effdet==0.4.1
      we can conclude that effdet<0.4.1 depends on torch>=1.4. (1)

      Because only the following versions of torch are available:
          torch<=1.4.0
          torch==1.5.0
          torch==1.5.1
          torch==1.6.0
          torch==1.7.0
          torch==1.7.1
          torch==1.8.0
          torch==1.8.1
          torch==1.9.0
          torch==1.9.1
          torch==1.10.0
          torch==1.10.1
          torch==1.10.2
          torch==1.11.0
          torch==1.12.0
          torch>=1.12.1
      and torch>=1.4.0,<=1.5.0 has no wheels with a matching Python implementation tag, we can conclude that torch>=1.4.0,<1.5.0 cannot be used.
      And because torch>=1.5.1,<=1.12.0 has no wheels with a matching Python ABI tag, we can conclude that torch>=1.4.0,<1.6.0 cannot be used.
      And because we know from (1) that effdet<0.4.1 depends on torch>=1.4, we can conclude that effdet<0.4.1 depends on torch>=1.12.1.
      And because effdet==0.4.1 depends on torch>=1.12.1, we can conclude that all versions of effdet depend on torch>=1.12.1. (2)

      Because only the following versions of torch are available:
          torch<=1.12.1
          torch==1.13.0
          torch==1.13.1
          torch==2.0.0
          torch==2.0.1
          torch==2.1.0
          torch==2.1.1
          torch==2.1.2
          torch==2.2.0
          torch==2.2.1
          torch==2.2.2
          torch==2.3.0
          torch==2.3.1
          torch==2.4.0
          torch==2.4.1
          torch==2.5.0
          torch==2.5.1
      and torch>=1.12.1 has no wheels with a matching Python ABI tag, we can conclude that torch>=1.12.1,<1.13.0 cannot be used.
      And because we know from (2) that all versions of effdet depend on torch>=1.12.1, we can conclude that all versions of effdet cannot be used.
      And because unstructured[all-docs]==0.15.0 depends on effdet, we can conclude that unstructured[all-docs]==0.15.0 cannot be used.
      And because megaparse==0.0.48 depends on unstructured[all-docs]==0.15.0 and you require megaparse==0.0.48, we can conclude that your requirements are unsatisfiable.

@StanGirard
Copy link
Contributor

StanGirard commented Dec 4, 2024

Can you try to use python 3.11 ?

@mralioo
Copy link

mralioo commented Dec 4, 2024

with python 3.11 works for me too. Thanks !

@kubni
Copy link

kubni commented Dec 4, 2024

I can confirm that using Python 3.11.9 allows me to install latest versions of megaparse-sdk and megaparse

@geoHeil
Copy link

geoHeil commented Dec 5, 2024

the docker image also fails. It is using 3.11 already #147 https://github.com/QuivrHQ/MegaParse/blob/main/Dockerfile#L1

@russellballestrini
Copy link

Oh no this seems bad... Can we fix this without a workaround? I will help with a PR to fix it if you lead me to the problem.

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

7 participants