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 'bidi.algorithm' #627

Open
jeffhaskin opened this issue Jul 22, 2024 · 7 comments
Open

ModuleNotFoundError: No module named 'bidi.algorithm' #627

jeffhaskin opened this issue Jul 22, 2024 · 7 comments

Comments

@jeffhaskin
Copy link

I have been banging my head against the wall and just figured out that this is probably a issue with changes to the packages you're using.

ModuleNotFoundError: No module named 'bidi.algorithm'

I have tried 30-ish different times to install in different ways after going through the install instructions as-is multiple times. I get this error every time. Here's the full message:

24.07.21 21:40:51: root: INFO   : Initializing Devika...
24.07.21 21:40:51: root: INFO   : checking configurations...
24.07.21 21:40:51: root: INFO   : Initializing Prerequisites Jobs...
24.07.21 21:41:17: root: INFO   : Loading sentence-transformer BERT models...
24.07.21 21:41:20: root: INFO   : BERT model loaded successfully.
24.07.21 21:41:24: root: WARNING: Ollama not available
24.07.21 21:41:24: root: WARNING: run ollama server to use ollama models otherwise use API models
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
	- Avoid using `tokenizers` before the fork if possible
	- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
	- Avoid using `tokenizers` before the fork if possible
	- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
Traceback (most recent call last):
  File "/Users/jeffhaskin/Documents/Programs/devika/devika.py", line 28, in <module>
    from src.agents import Agent
  File "/Users/jeffhaskin/Documents/Programs/devika/src/agents/__init__.py", line 1, in <module>
    from .agent import Agent
  File "/Users/jeffhaskin/Documents/Programs/devika/src/agents/agent.py", line 25, in <module>
    from src.documenter.pdf import PDF
  File "/Users/jeffhaskin/Documents/Programs/devika/src/documenter/pdf.py", line 4, in <module>
    from xhtml2pdf import pisa
  File "/Users/jeffhaskin/Documents/Programs/devika/.venv/lib/python3.11/site-packages/xhtml2pdf/pisa.py", line 26, in <module>
    from xhtml2pdf.document import pisaDocument
  File "/Users/jeffhaskin/Documents/Programs/devika/.venv/lib/python3.11/site-packages/xhtml2pdf/document.py", line 25, in <module>
    from xhtml2pdf.context import pisaContext
  File "/Users/jeffhaskin/Documents/Programs/devika/.venv/lib/python3.11/site-packages/xhtml2pdf/context.py", line 39, in <module>
    from xhtml2pdf import default, parser
  File "/Users/jeffhaskin/Documents/Programs/devika/.venv/lib/python3.11/site-packages/xhtml2pdf/parser.py", line 44, in <module>
    from xhtml2pdf.tables import (  # noqa: F401
  File "/Users/jeffhaskin/Documents/Programs/devika/.venv/lib/python3.11/site-packages/xhtml2pdf/tables.py", line 21, in <module>
    from xhtml2pdf.tags import pisaTag
  File "/Users/jeffhaskin/Documents/Programs/devika/.venv/lib/python3.11/site-packages/xhtml2pdf/tags.py", line 35, in <module>
    from xhtml2pdf.charts import (
  File "/Users/jeffhaskin/Documents/Programs/devika/.venv/lib/python3.11/site-packages/xhtml2pdf/charts.py", line 7, in <module>
    from xhtml2pdf.util import getColor
  File "/Users/jeffhaskin/Documents/Programs/devika/.venv/lib/python3.11/site-packages/xhtml2pdf/util.py", line 25, in <module>
    from bidi.algorithm import get_display
ModuleNotFoundError: No module named 'bidi.algorithm'
@murdercode
Copy link

Temp solution: comment the 25th line in .venv/lib/python3.[YOURVERS]/site-packages/xhtml2pdf/util.py

#from bidi.algorithm import get_display

Seems works for me 🤔

@roylansaf
Copy link

Hi.. change to version 0.4.2 of python-bidi

@jeffhaskin
Copy link
Author

jeffhaskin commented Jul 22, 2024

I should have said; I tried that already. I did pip install python-bidi==0.4.2 and then installed requirements. After installing all requirements, I then confirmed python-bidi was still version 0.4.2. Still produced that same error when running the program.

@jeffhaskin
Copy link
Author

jeffhaskin commented Jul 22, 2024

Temp solution: comment the 25th line in .venv/lib/python3.[YOURVERS]/site-packages/xhtml2pdf/util.py

#from bidi.algorithm import get_display

Seems works for me 🤔

You beautiful human. This worked for me. I'll comment again if this causes any errors, but it launches now!

@chunghan-lee
Copy link

"algorithm.py" was removed from python-bidi in 0.5.0. The same issue just happened on my side and the problem was fixed after downgrading to 0.4.2.

This issue was also reported on python-bidi:
MeirKriheli/python-bidi#23

and it is suggested to change:
from bidi.algorithm import get_display
into
from bidi import get_display
in "site-packages/xhtml2pdf/util.py"

@mmn007
Copy link

mmn007 commented Jul 23, 2024

Only a temp solution. I cannot do this to release production code.
For us fixing python-bidi at 4.2 in our build fixed it. However many projects can have xhtml2pdf coming as a transitive dependency. Somebody pulling xhtml2pdf will break anyway right? xhtml2pdf needs to make this change and release perhaps?

@jeffhaskin
Copy link
Author

Only a temp solution. I cannot do this to release production code. For us fixing python-bidi at 4.2 in our build fixed it. However many projects can have xhtml2pdf coming as a transitive dependency. Somebody pulling xhtml2pdf will break anyway right? xhtml2pdf needs to make this change and release perhaps?

what version of xhtml2pdf do you have in your build? Should I just uninstall xhtml2pdf after installing requirements? I already downgraded python-bidi, and it still gives me the same error. So one of the packages must have the updated version as a dependancies somewhere.

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

5 participants