Closed stefanCCS closed 1 year ago
sbb_binarization requires tensorflow < 1.16. There are no pre-built packages on PyPI for Python 3.8 for tensorflow < 2.2.
I suspect you had tensorflow (2.3.1) installed before.\
I recommend downgrading to python 3.7 for which there are pip-installable tensorflow 1.15.x packages available.
Thanks! Python 3.7 works much better. pip install sbb_binarize has finished successfully, see this pip list extract:
PyYAML 5.3.1
requests 2.25.0
sbb-binarization 0.0.5
scipy 1.5.4
setuptools 50.3.2
Shapely 1.7.1
six 1.15.0
tensorboard 1.15.0
tensorflow 1.15.4
tensorflow-estimator 1.15.1
termcolor 1.1.0
Trying to run sbb_binarize.py leads to a missing module "cv2".
sbb_binarize.py", line 13, in <module>
import cv2
ModuleNotFoundError: No module named 'cv2'
What do I need here?
cv2
should be installable by pip install opencv-python
.
Ok, opencv now installed (see pip list here):
ocrd-validators 2.20.1
opencv-python 4.4.0.46
opencv-python-headless 4.4.0.46
opt-einsum 3.3.0
pdfcrowd 4.4.2
But, still same error (Module cv2 not found). Next idea, please ;-)
You mustn't install opencv-python{,-headless} side-by-side. But more importantly, you should not have to install opencv-python manually at all, they should come with ocrd{,_*}.
Can you uninstall both opencv-python and -headless and retry the installation?
pip uninstall opencv-python-{,headless}
pip install sbb_binarization
Thanks again, for helping ...
Maybe I have not made in clear enough before: I could successfully install sbb_binarize in my Linux environment with just updating ocrd_all! Now, I try just to install sbb_binarize in Windows environment (not full ocrd_all). I hope it is more clear now, what I try to do ...
Concerning your proposal: I did the unistallation of opencv-python plus ... -headless --> has run ok. I did pip install sbb_binarization again --> has run ok. Results in this pip list (extract):
numpy 1.18.5
ocrd 2.20.1
ocrd-modelfactory 2.20.1
ocrd-models 2.20.1
ocrd-utils 2.20.1
ocrd-validators 2.20.1
opencv-python-headless 4.4.0.46
opt-einsum 3.3.0
pdfcrowd 4.4.2
pika 1.0.0b2
Pillow 8.0.1
pip 20.0.2
protobuf 3.14.0
pyrsistent 0.17.3
PyYAML 5.3.1
requests 2.25.0
sbb-binarization 0.0.5
scipy 1.5.4
BUT, the error not finding cv2 is still there :-( If you still have some ideas, what to do, of course I would appreciate it. If not, it is neither urgent nor very important - we simply could ignore this problem (and I will stay in Linux only).
SO suggests that some have been able to resolve this by using the unofficial Windows wheels distributed by Gohlke.
Ok, one step further. Using opencv_python-4.4.0-cp37-cp37m-win_amd64.whl (I have Python 3.7, 64bit) from Gohlke site, I now get the following error (shortend):
Processing c:\users\heide.ccs-hh-ewi\documents\python\opencv_python-4.4.0-cp37-cp37m-win_amd64.whl
ERROR: Exception:
Traceback (most recent call last):
File "c:\users\heide.ccs-hh-ewi\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\cli\base_command.py", line 186, in _main
status = self.run(options, args)
File "c:\users\heide.ccs-hh-ewi\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\commands\install.py", ...
...
zip = zipfile.ZipFile(zipfp, allowZip64=True)
File "c:\users\heide.ccs-hh-ewi\appdata\local\programs\python\python37\lib\zipfile.py", line 1222, in __init__
self._RealGetContents()
File "c:\users\heide.ccs-hh-ewi\appdata\local\programs\python\python37\lib\zipfile.py", line 1289, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
Again, if you still have ideas - very nice; if not, also ok.
Update: I did pip uninstall opencv-python. Then, I made a pip install with the Gohlke-Wheel - has run fine BUT, still when starting sbb_binarize: "module cv2 not found" :-(
I've tested this project with Python 3.6 and Python 3.9, Tensorflow 2.5.0 - 2.9.1, which are available on Windows and managed to get it up and running (except the model deserialization was a bit tricky), so I think this issue can be closed.
As I am the original creator of this issue, I will close it now. Please feel free to re-open it, in case you want to keep it open for some purpose.
Hi, I am trying out to setup your nice tool in Windows environment. I am using Python 3.8. After doing "pip install sbb_binarization" I get the following error:
If i call "pip list", I can see, that TensorFlow is installed: