eynollah icon indicating copy to clipboard operation
eynollah copied to clipboard

Eynollah on Python 3.8

Open nacho-pancho opened this issue 4 years ago • 17 comments

Hi, Eynollah's requirements include Tensorflow < 2. This option is not suppored on Python 3.8+. It will work on 3.7, but I'd prefer not install a dedicated environment for this. Will it break with a newer version? Do you have plans for upgrading it to TF 2.0+? Thank you.

nacho-pancho avatar Mar 05 '21 16:03 nacho-pancho

Hi Ignacio!

Yes this is quite painful. See also https://github.com/OCR-D/ocrd_all/issues/219, https://github.com/OCR-D/ocrd_all/issues/235 - these are getting more.

A problem with migrating to TF2 is that besides API changes, it appears models will need to be re-trained (takes weeks for some models in our case), then tested for regressions etc.

So it is on our agenda, but don't expect a very quick solution. Sorry :/

cneud avatar Mar 05 '21 17:03 cneud

If you want to try out more OCR-D tools, then you're really best of with a dedicated Python 3.7 environment for that because there are other processors that will not work with 3.8. And since tensorflow decided not to build tensorflow 1.15 packages for python 3.8, we're pretty much stuck at 3.7 until we find the time and resources to retrain&upgrade all the tools, which as @cneud noted, might be a long while.

kba avatar Mar 05 '21 17:03 kba

https://github.com/OCR-D/ocrd-website/wiki/OCR-D-on-Debian-and-Ubuntu#installation-of-python-37 has instructions for installing Python 3.7.

stweil avatar Mar 24 '21 18:03 stweil

I'm trying to install it with Ubuntu 18.04 (fresh schroot, native) with python 3.6, python 3.7 - no combination works:

# python3.7 -m pip install .
Could not find a version that satisfies the requirement tensorflow-gpu<2,>=1.15 (from eynollah==0.0.1) (from versions: 1.13.1, 1.13.2, 1.14.0, 2.0.0a0, 2.0.0b0, 2.0.0b1)
No matching distribution found for tensorflow-gpu<2,>=1.15 (from eynollah==0.0.1)

# python3.6 -m pip install .
Could not find a version that satisfies the requirement tensorflow-gpu<2,>=1.15 (from eynollah==0.0.1) (from versions: 0.12.1, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.7.1, 1.8.0, 1.9.0, 1.10.0, 1.10.1, 1.11.0, 1.12.0, 1.12.2, 1.12.3, 1.13.1, 1.13.2, 1.14.0, 2.0.0a0, 2.0.0b0, 2.0.0b1)
No matching distribution found for tensorflow-gpu<2,>=1.15 (from eynollah==0.0.1)

jbarth-ubhd avatar Apr 07 '21 11:04 jbarth-ubhd

@jbarth-ubhd Which version of pip are you using - or can you update pip and try again? tensorflow-gpu 1.15.5 is available on pypi: https://pypi.org/project/tensorflow-gpu/1.15.5/

cneud avatar Apr 07 '21 11:04 cneud

python3.7 -m pip list | grep pip: pip (9.0.1)

jbarth-ubhd avatar Apr 07 '21 11:04 jbarth-ubhd

That's a bit too old ;-) Can you try to update pip? I think a version of pip >19 is needed to find/fetch tensorflow-gpu 1.15.5.

cneud avatar Apr 07 '21 11:04 cneud

That's Ubuntu 18.04 :-)

jbarth-ubhd avatar Apr 07 '21 11:04 jbarth-ubhd

python3.7 -m pip install --upgrade pip helped.

jbarth-ubhd avatar Apr 07 '21 11:04 jbarth-ubhd

Thanks!

jbarth-ubhd avatar Apr 07 '21 11:04 jbarth-ubhd

could something like pip > 19 be added to requirements.txt?

jbarth-ubhd avatar Apr 07 '21 12:04 jbarth-ubhd

could something like pip > 19 be added to requirements.txt?

It could but then you still have to run it twice because the first time round you're still using the old pip. It's a good idea in general to do pip install -U pip after a fresh install or a in a fresh venv. In ocrd_all it's part of the Makefile, so as soon as eynollah is part of ocrd_all, that would be the recommended way to install it.

kba avatar Apr 07 '21 13:04 kba

I'd like to note that when creating a Python virtualenv, you can specify the Python interpreter to use, i.e.:

virtualenv -p /usr/bin/python3.7 /tmp/venv-example

or, using mkvirtualenv (if you happen to prefer virtualenvwrapper, like me):

mkvirtualenv -p /usr/bin/python3.7 venv-example

My Linux system (Fedora Linux 32) offers to install older Python interpreters like Python 3.7 in addition to the default version (3.8), so this method is easily available to me.

mikegerber avatar Apr 23 '21 16:04 mikegerber

could something like pip > 19 be added to requirements.txt?

It could but then you still have to run it twice because the first time round you're still using the old pip. It's a good idea in general to do pip install -U pip after a fresh install or a in a fresh venv. In ocrd_all it's part of the Makefile, so as soon as eynollah is part of ocrd_all, that would be the recommended way to install it.

I agree with @kba. I would consider upgrading pip a best practice to do before anything else and the addition to requirements.txt doesn't help in most cases (I would even say it doesn't help in any case).

mikegerber avatar Apr 23 '21 16:04 mikegerber

Could you maybe add a note to the README about supported Python version(s)? And perhaps update the setup.py file too? I spent some time trying to install and run eynollah, only to now find out that the errors may have come from using Python 3.8 and newer through this issue.

Or is this no longer an issue?

bencomp avatar Aug 02 '22 08:08 bencomp

Hi @bencomp! I'll make a note to update the README and setup.py - but actually the current master branch should in principle also work with Python 3.8, since we upgraded the tensorflow 1.x dependency that was mainly causing this. Can you share more details on the issues you encountered and perhaps make a new issue for that?

cneud avatar Aug 02 '22 09:08 cneud

Thanks, @cneud! Indeed installing went fine on Python 3.10 and 3.8, so my issue has nothing to do with the Python version. I'll look into opening a new issue.

bencomp avatar Aug 02 '22 09:08 bencomp

Since the original problem was solved by the upgrade to tf2, this has not been an issue anymore.

The supported Python version has also been added to the readme. We will deal with Python >3.8 asap, but I will close here.

cneud avatar Sep 13 '22 20:09 cneud