lukas-blecher / LaTeX-OCR

pix2tex: Using a ViT to convert images of equations into LaTeX code.
https://lukas-blecher.github.io/LaTeX-OCR/
MIT License
12.14k stars 999 forks source link

latexocr error #257

Open rhaynes74 opened 1 year ago

rhaynes74 commented 1 year ago

Hi folks, I have python 3.11 installed via homebrew as well as pip/pip3. I have installed any missing modules that appear when I try to run latexocr, but now I am stuck: latexocr objc[56459]: Class QMacAutoReleasePoolTracker is implemented in both /usr/local/Cellar/qt/6.4.3_1/lib/QtCore.framework/Versions/A/QtCore (0x103e5d5d8) and /usr/local/lib/python3.11/site-packages/PySide6/Qt/lib/QtCore.framework/Versions/A/QtCore (0x14d0073c8). One of the two will be used. Which one is undefined. objc[56459]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /usr/local/Cellar/qt/6.4.3_1/lib/QtCore.framework/Versions/A/QtCore (0x103e5d650) and /usr/local/lib/python3.11/site-packages/PySide6/Qt/lib/QtCore.framework/Versions/A/QtCore (0x14d007440). One of the two will be used. Which one is undefined. objc[56459]: Class KeyValueObserver is implemented in both /usr/local/Cellar/qt/6.4.3_1/lib/QtCore.framework/Versions/A/QtCore (0x103e5d678) and /usr/local/lib/python3.11/site-packages/PySide6/Qt/lib/QtCore.framework/Versions/A/QtCore (0x14d007468). One of the two will be used. Which one is undefined. objc[56459]: Class RunLoopModeTracker is implemented in both /usr/local/Cellar/qt/6.4.3_1/lib/QtCore.framework/Versions/A/QtCore (0x103e5d6c8) and /usr/local/lib/python3.11/site-packages/PySide6/Qt/lib/QtCore.framework/Versions/A/QtCore (0x14d0074b8). One of the two will be used. Which one is undefined. qt.core.qobject.connect: QObject::connect(QGuiApplication, QCocoaClipboard): invalid nullptr parameter QEventLoop: Cannot be used without QApplication QObject: Cannot create children for a parent that is in a different thread. (Parent is QCocoaIntegration(0x6000008f8b40), parent's thread is QThread(0x600003bbd610), current thread is QThread(0x600003bc0230) qt.core.qobject.connect: QObject::connect(QGuiApplication, QCocoaIntegration): invalid nullptr parameter Cannot mix incompatible Qt library (6.4.3) with this library (6.5.0)

lukas-blecher commented 1 year ago

Can you try to install pip install PyQt6==6.5.0? I can't even find a 6.4.3 online. How did you install pyqt?

rhaynes74 commented 1 year ago

Hi, I think pyqt was installed by home-brew.  Your command worked.

As an (related) aside, there were a bunch of other packages that I needed to do a pip install for during the install process. Like pyqt web engine etc.

Sincerely,

Dr. Ronald D. Haynes Professor, Department of Mathematics and Statistics Chair, MSc and Phd Scientific Computing Programs Memorial University of Newfoundland

We acknowledge that the lands on which Memorial University’s campuses are situated are in the traditional territories of diverse Indigenous groups, and we acknowledge with respect the diverse histories and cultures of the Beothuk, Mi’kmaq, Innu, and Inuit of this province. On Apr 17, 2023 at 5:50 AM -0230, Lukas Blecher @.***>, wrote:

Can you try to install pip install PyQt6==6.5.0? I can't even find a 6.4.3 online. How did you install pyqt? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

philippbollmann commented 1 year ago

i get this: Cannot mix incompatible Qt library (6.5.1) with this library (6.5.2)

i uninstalled PyQt again and installed again several times but i can't get it to work.

zhizhongpu commented 1 year ago

"Cannot mix incompatible Qt library (6.5.1) with this library (6.5.2)" error message also occurred to me as I tried to ran command latexocr in Windows terminal. Prior to this, I have uninstalled and installed Qt library 6.5.1 as well as 6.5.2 using pip install PyQt6==6.5.1

Update: I manually deleted all PyQt6 folders and uninstalled every PyQt6 program, and reinstalled everything. Does not work. I have 6.5.2 installed but the original error message persists.

philippbollmann commented 1 year ago

I fixed it. I also use Windows Terminal and i first checked the packages I have installed with pip list -v. Then i uninstalled everey version of pyQt in that list, e.g. pip uninstall pyQt6-sip plus all the other versions. Turns out I had installed pyQt5, too. After that i installed it again with pip install pixt2tex[gui].

Then it still didn't work but I checked pip list -v again and decided to change the version.

pip install PyQt6==6.5.1 and pip install PyQt6-Qt6==6.5.1 fixed it for me.

zhizhongpu commented 1 year ago

I fixed it. I also use Windows Terminal and i first checked the packages I have installed with pip list -v. Then i uninstalled everey version of pyQt in that list, e.g. pip uninstall pyQt6-sip plus all the other versions. Turns out I had installed pyQt5, too. After that i installed it again with pip install pixt2tex[gui].

Then it still didn't work but I checked pip list -v again and decided to change the version.

pip install PyQt6==6.5.1 and pip install PyQt6-Qt6==6.5.1 fixed it for me.

This fix worked for me too.

So it seems that, contrary to what @lukas-blecher has thought and implied in their earlier comment, LaTex-OCR uses the "incompatible Qt library" while the user uses "this library". So for future reference, the general fix is to uninstall the user's version and install on that's aligned with "incompatible Qt library".

For the team, I hope they could consider making their package compatible with higher versions of Qt library.

Pedsurgeon1 commented 11 months ago

I removed all packages that have different versions and installed only versions 6.5.1 for them all

you can do so by implementing these codes

pip uninstall -y PyQt6 PyQt6-Qt6 PyQt6-sip PyQt6-WebEngine PyQt6-WebEngine-Qt6

pip uninstall -y PySide6 PySide6-Addons PySide6-Essential shiboken6

pip install PyQt6==6.5.1 PyQt6-Qt6==6.5.1 PyQt6-WebEngine-Qt6==6.5.1 PyQt6-WebEngine

pip install PySide6-Essentials==6.5.1 PySide6==6.5.1 PySide6-Addons==6.5.1 shiboken6==6.5.1

It worked for me now

VigneshRamanathan101 commented 6 months ago

I too faced the same after pip install "pix2tex[gui]" in my conda environment.

error message : "Cannot mix incompatible Qt library (6.6.3) with this library (6.6.2)"

I used python version - 3.8.13 (referred from the docker image config)

I was able to solve this by installing pyside version as in the error message ("pip install PySide6==6.6.2").