I need to install a specific version of python and opencv-python on Docker.
When I try to install the required version(4.5.1.48) of opencv-python with pip,
I get the following error and fail.
my dockerfile
FROM ubuntu:18.04
ENV TZ=europe/kiev
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
RUN echo $TZ > /etc/timezone
RUN apt-get update
RUN apt-get upgrade -y --no-install-recommends
RUN apt-get install -y --no-install-recommends build-essential libbz2-dev libdb-dev libreadline-dev libffi-dev libgdbm-dev liblzma-dev libncursesw5-dev libsqlite3-dev libssl-dev zlib1g-dev uuid-dev wget ca-certificates
RUN wget -P /tmp https://www.python.org/ftp/pyhon/3.7.7/Python-3.7.7.tgz
RUN tar xzvf /tmp/Python-3.7.7.tgz -C /tmp
WORKDIR /tmp/Python-3.7.7
RUN ./configure --with-pydebug
RUN make -s -j
RUN make install
RUN python3 -m pip install --no-cache-dir -U pip setuptools
RUN python3 -m pip install --no-cache-dir scikit-build cmake
RUN python3 -m pip install --no-cache-dir opencv-python==4.5.1.48
command
docker build -t foo:1.0
error
(After a very long build time)
...
copying LICENSE-3RD-PARTY.txt -> _skbuild/linux-x86_64-3.7/cmake-install/cv2/LICENSE-3RD-PARTY.txt
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 262, in build_wheel
metadata_directory)
File "/tmp/pip-build-env-z4t74rdh/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 413, in build_wheel
wheel_directory, config_settings)
File "/tmp/pip-build-env-z4t74rdh/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-z4t74rdh/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 483, in run_setup
self).run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-z4t74rdh/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 335, in run_setup
exec(code, locals())
File "<string>", line 457, in <module>
File "<string>", line 257, in main
File "/tmp/pip-build-env-z4t74rdh/overlay/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 686, in setup
skbuild_kw["cmake_install_dir"],
File "<string>", line 408, in _classify_installed_files_override
TypeError: _classify_installed_files() got an unexpected keyword argument 'cmake_install_dir'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for opencv-python
If I execute
python3 -m pip install opencv-python
instead of
python3 -m pip install opencv-python==4.5.1.48
, I can install opencv-python ver.4.6.0.66, which is not what I want.
Can anyone give me some advice?