Skip to content

FIX for Latexocr GUI: c10.dll and typing.io module error #442

Description

@opanoel

This is supposed to be a guide to help fix the "c10.dll loading error" and the "typing.io is not a package" error for people using newer Python and PyTorch versions, without having to downgrade either. I use Python 3.14.2, PyTorch 2.10.0+cpu and Windows 11 25H2.

I encountered some issues after installing the package using pip install "pix2tex[gui]" and calling latexocr in Windows Command Prompt.
After some digging I found some solutions spread throughout GitHub and decided to make this thread in hopes of simplifying the troubleshooting for other people having the same issues.


  1. To fix the c10.dll error I followed solution 3 from pytroch/issues/166628, which I found through latexocr error #436.
    The solution states to import torch before PyQt. I did so by going into \pix2tex\gui.py and adding import torch below import tempfile.

  2. After fixing the c10.dll error, I got a new error: ModuleNotFoundError: No module named 'typing.io'; 'typing' is not a package. I found this solution:

I have tracked down the problem. The issue is that pix2tex[gui] requires latex2sympy2 which requires antlr4-python3-runtime==4.7.2.

As can be seen in issue #2611, antlr4 was the reason for this bug, but it was fixed in #3067 and in antlr4 4.9.2.

A workaround could be to manually update antlr4 to a version >=4.9.2:

pip install antlr4-python3-runtime==4.9.2

Originally posted by @Giuseppe499 in #415


It should be noted that the Sympy format seems to not function properly after this fix.
I am not knowledgeable enough regarding these things to know exactly what I am doing, but this is what allowed me to use the GUI.
I hope someone can make use of this, as I have looked for something similar to this during my troubleshooting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions