caltechlibrary / handprint

Apply different text recognition services to images of handwritten documents.
https://caltechlibrary.github.io/handprint
BSD 3-Clause "New" or "Revised" License
172 stars 18 forks source link

Use in google colab? #31

Open Nestak2 opened 3 years ago

Nestak2 commented 3 years ago

Thanks for making this code public! I am trying to use it in google colab, but after the pip installation in colab I receive dependency warnings. When I then try to run

!handprint -l

I get the error message:

Traceback (most recent call last):
  File "/usr/local/bin/handprint", line 5, in <module>
    from handprint.__main__ import console_scripts_main
  File "/usr/local/lib/python3.7/dist-packages/handprint/__main__.py", line 46, in <module>
    from sidetrack import set_debug, log, logr
ImportError: cannot import name 'logr' from 'sidetrack' (/usr/local/lib/python3.7/dist-packages/sidetrack/__init__.py)

A similar error message appears when I try !python3 -m handprint -h.

So is there a way to run handprint on google colab? Is there some explanatory colab notebook available? Am I missing maybe some installation/initialization steps? Do you plan to make handprint also workable for colab? Thanks

mhucka commented 3 years ago

I'm sorry this issue sat unanswered for so long. This problem occurred before Handprint 1.5.3, if the copy of Sidetrack was newer than what Handprint was written to use (which was 1.4.0). To compound the problem, prior to Handprint release 1.5.3, Handprint's requirements.txt file did not pin the versions of dependencies, so if you got a newer version of Sidetrack during installation, this is the error that would occur.

To fix, you can either install Sidetrack version 1.4.0 specifically, or (better) update Handprint to the latest release, which is version 1.5.4.

As far as running on Collab, I've never tried it. I'd like to try Collab at some point soon, however. Hopefully it should work with the newer version of Handprint.