Skip to content

Commit 3d2605a

Browse files
committed
Fix build for Python 3.10
Signed-off-by: Stefan Weil <[email protected]>
1 parent 9a9e817 commit 3d2605a

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Makefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,13 @@ CUSTOM_DEPS = unzip wget python3-venv parallel git less # add more packages for
104104

105105
DEFAULT_DISABLED_MODULES = cor-asv-fst opencv-python ocrd_ocropy
106106
ifeq ($(PYTHON_VERSION),3.10)
107-
# Python 3.10.x does not work with current kraken.
107+
# Python 3.10 fails to build numpy==1.19.3 which is required in headless-tf1.
108+
# This restriction can be removed as soon as ocrd_cis no longer depends on calamari_ocr==0.3.5.
109+
DEFAULT_DISABLED_MODULES += ocrd_cis
110+
# Python 3.10 does not work with current kraken.
108111
DEFAULT_DISABLED_MODULES += ocrd_kraken
112+
# Python 3.10 does not provide tensorflow<=2.5.0,>=2.0.0 (from ocr4all-pixel-classifier==0.6.6->-r requirements.in (line 2)).
113+
DEFAULT_DISABLED_MODULES += ocrd_pc_segmentation
109114
endif
110115
DISABLED_MODULES ?= $(DEFAULT_DISABLED_MODULES)
111116

@@ -247,10 +252,6 @@ $(SHARE)/opencv-python: opencv-python/setup.py | $(ACTIVATE_VENV) $(SHARE) $(SHA
247252
$(BIN)/ocrd: $(SHARE)/opencv-python
248253
endif
249254

250-
ifeq ($(PYTHON_VERSION),3.10)
251-
# Python 3.10.x does not work with current kraken.
252-
override OCRD_MODULES := $(filter-out ocrd_kraken, $(OCRD_MODULES))
253-
endif
254255
ifneq ($(findstring ocrd_kraken, $(OCRD_MODULES)),)
255256
OCRD_EXECUTABLES += $(OCRD_KRAKEN)
256257
install-models: install-models-kraken
@@ -535,6 +536,8 @@ OCRD_ANYBASEOCR += $(BIN)/ocrd-anybaseocr-textline
535536
OCRD_ANYBASEOCR += $(BIN)/ocrd-anybaseocr-layout-analysis
536537
$(call multirule,$(OCRD_ANYBASEOCR)): ocrd_anybaseocr
537538
cd $< ; $(MAKE) patch-pix2pixhd
539+
# Hack for Python 3.10 which fails to install ocrd-fork-pylsd 0.0.4 from PyPI.
540+
. $(ACTIVATE_VENV) && pip install git+https://github.com/kba/pylsd.git
538541
$(pip_install)
539542
endif
540543

@@ -677,9 +680,10 @@ define pip_install_tf1nvidia =
677680
pushd $$name && for path in $$name*; do mv $$path $${path/$$name/$$newname}; done && popd && \
678681
$(PYTHON) -m wheel pack $$name && \
679682
$(SEMPIP) pip install $$newname*.whl && popd && rm -fr $$OLDPWD; fi
683+
# TODO: Remove the following hack. It was replaced by pip constraints.
680684
# - preempt conflict over numpy between scikit-image and tensorflow
681685
# - preempt conflict over numpy between tifffile and tensorflow (and allow py36)
682-
. $(ACTIVATE_VENV) && $(SEMPIP) pip install imageio==2.14.1 "tifffile<2022"
686+
# . $(ACTIVATE_VENV) && $(SEMPIP) pip install imageio==2.14.1 "tifffile<2022"
683687
endef
684688

685689
# pattern for recursive make:

local.mk

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)