Error during native installation on Ubuntu 22.04
stefanCCS opened this issue · 9 comments
Using Ubuntu 22.04.
I have tried a fresh new native installation of ocrd_all following standard setup (https://ocr-d.de/en/setup).
Unfortunately, I get the error below - please clarify:
...
Detected CUDA version: CPU
Looking in links: https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.10/index.html, https://download.pytorch.org/whl/cpu/torch_stable.html
Requirement already satisfied: ocrd>=2.30 in /home/ocrdadmin/ocrd_all/venv/sub-venv/headless-tf1/lib/python3.10/site-packages (from -r requirements.txt (line 1)) (2.35.0)
Requirement already satisfied: click>=7.0 in /home/ocrdadmin/ocrd_all/venv/sub-venv/headless-tf1/lib/python3.10/site-packages (from -r requirements.txt (line 2)) (8.1.3)
Collecting scipy
Downloading scipy-1.8.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (42.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.2/42.2 MB 10.3 MB/s eta 0:00:00
Requirement already satisfied: numpy>=1.17.0 in /home/ocrdadmin/ocrd_all/venv/sub-venv/headless-tf1/lib/python3.10/site-packages (from -r requirements.txt (line 4)) (1.22.4)
Requirement already satisfied: pillow>=7.1.2 in /home/ocrdadmin/ocrd_all/venv/sub-venv/headless-tf1/lib/python3.10/site-packages (from -r requirements.txt (line 5)) (9.1.1)
Requirement already satisfied: shapely in /home/ocrdadmin/ocrd_all/venv/sub-venv/headless-tf1/lib/python3.10/site-packages (from -r requirements.txt (line 6)) (1.8.2)
Collecting scikit-image>=0.17.2
Downloading scikit_image-0.19.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.0/14.0 MB 20.9 MB/s eta 0:00:00
ERROR: Ignored the following versions that require a different python version: 1.6.2 Requires-Python >=3.7,<3.10; 1.6.3 Requires-Python >=3.7,<3.10; 1.7.0 Requires-Python >=3.7,<3.10; 1.7.0rc1 Requires-Python >=3.7,<3.10; 1.7.0rc2 Requires-Python >=3.7,<3.10; 1.7.1 Requires-Python >=3.7,<3.10
ERROR: Could not find a version that satisfies the requirement torch<1.11,>=1.10.1 (from versions: 1.11.0, 1.11.0+cpu)
ERROR: No matching distribution found for torch<1.11,>=1.10.1
make[2]: *** [Makefile:26: deps] Error 1
make[2]: Leaving directory '/home/ocrdadmin/ocrd_all/ocrd_detectron2'
make[1]: *** [Makefile:283: /home/ocrdadmin/ocrd_all/venv/sub-venv/headless-tf1/bin/ocrd-detectron2-segment] Error 2
make[1]: Leaving directory '/home/ocrdadmin/ocrd_all'
make: *** [Makefile:278: /home/ocrdadmin/ocrd_all/venv/bin/ocrd-detectron2-segment] Error 2
make: *** Deleting file '/home/ocrdadmin/ocrd_all/venv/bin/ocrd-detectron2-segment'
Did you run the build with Python 3.6? That does not work with latest Ubuntu. I'd use Python 3.7 for Ubuntu 22.04.
It looks like that the standard Python version in Ubuntu 22.04 is 3.10:
python3 --version
Python 3.10.4
Just following https://ocr-d.de/en/setup, I simply have not taken care for Python version, as the make all
does not run in the "venv".
So, do you recommend to create the venv with Python 3.7 now, and do make all
and this venv?
The default Python 3.10 will also fail: Requires-Python >=3.7,<3.10
. Yes, I recommend using Python 3.7.
You can try sudo make -C ~/src/github/OCR-D/ocrd_all PYTHON=python3.7 deps-ubuntu
which should install that Python version from https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa.
I installed Python 3.7 manually (see https://github.com/OCR-D/ocrd-website/wiki/OCR-D-on-Debian-and-Ubuntu#installation-of-python-37) and typically use a build sequence like this one:
python3.7 -m venv venv3.7
source venv3.7/bin/activate
make all
Many thanks for your help!
I have got Python 3.7 using this:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.7
sudo apt install python3.7-dev
I have created a venv with Python 3.7 and started make all being in this venv.
Now I get this exception (missing module):
if git submodule status workflow-configuration | grep -qv '^ '; then \
sem -q --will-cite --fg --id ocrd_all_git git submodule update --init workflow-configuration && \
touch workflow-configuration; fi
. /home/ocrdadmin/ocrd_venv_3.7/bin/activate && sem -q --will-cite --fg --id ocrd_all_pipocrd_venv_3.7 pip install --upgrade pip setuptools
Traceback (most recent call last):
File "/home/ocrdadmin/ocrd_venv_3.7/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/home/ocrdadmin/ocrd_venv_3.7/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/ocrdadmin/ocrd_venv_3.7/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/ocrdadmin/ocrd_venv_3.7/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/home/ocrdadmin/ocrd_venv_3.7/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "/home/ocrdadmin/ocrd_venv_3.7/lib/python3.7/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "/home/ocrdadmin/ocrd_venv_3.7/lib/python3.7/site-packages/pip/_internal/configuration.py", line 26, in <module>
from pip._internal.utils.logging import getLogger
File "/home/ocrdadmin/ocrd_venv_3.7/lib/python3.7/site-packages/pip/_internal/utils/logging.py", line 27, in <module>
from pip._internal.utils.misc import ensure_dir
File "/home/ocrdadmin/ocrd_venv_3.7/lib/python3.7/site-packages/pip/_internal/utils/misc.py", line 39, in <module>
from pip._internal.locations import get_major_minor_version
File "/home/ocrdadmin/ocrd_venv_3.7/lib/python3.7/site-packages/pip/_internal/locations/__init__.py", line 14, in <module>
from . import _distutils, _sysconfig
File "/home/ocrdadmin/ocrd_venv_3.7/lib/python3.7/site-packages/pip/_internal/locations/_distutils.py", line 9, in <module>
from distutils.cmd import Command as DistutilsCommand
ModuleNotFoundError: No module named 'distutils.cmd'
make: *** [Makefile:177: /home/ocrdadmin/ocrd_venv_3.7/bin/pip] Error 1
So pip install --upgrade pip setuptools
fails. I cannot reproduce that. Do you also get that failure if you run that command in a fresh Python 3.7 virtual environment? That is caused because you did not install python3.7-venv
.
Searching for the error message suggests this solution: apt install python3.7-distutils
. In my case python3.7-distutils
was installed automatically as a dependency, but the error indicates that it might be missing in your installation.
Update: python3.7-venv
is missing in your installation. Run apt install python3.7-venv
(which will also install python3.7-distutils
).
Yes, that's it - many thanks.
Now, make all
has run to the end without any errors.
(and very basic tests also have run fine).
I try to summarize, what needs to be considered for native installations on Ubuntu 22.04:
- BEFORE you do a
make all
- get Python 3.7, e.g via
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.7
sudo apt install python3.7-dev
- install:
sudo apt install python3.7-venv
Then create a venv
with Python 3.7 and do make all
within this venv
==> Please consider to add this (or any other helpful hints) in documentation (https://ocr-d.de/en/setup)
From README.md: sudo apt install python3-dev python3-venv
. The instructions for Ubuntu 22.04 can be reduced to
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7-dev python3.7-venv
# Then create a venv with Python 3.7 and do make all within this venv.
or even more simple
sudo make deps-ubuntu PYTHON=python3.7
make all PYTHON=python3.7
All fine for me - please fell free to close this issue (or keep it open, in case you want to follow-up this ...).