I am running a freshly installed Debian 12 VM with Python version 3.11.2, and pip3 version 23.0.1. When I try to install opencve I get the following:
# pip3 install opencve
error: externally-managed-environment
This environment is externally managed
To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
So I tried with --break-system-packages - after all, this is just a VM:
# pip3 install opencve --break-system-packages
Collecting opencve
Using cached opencve-1.4.1-py3-none-any.whl (1.4 MB)
Collecting Flask==1.0.2
Using cached Flask-1.0.2-py2.py3-none-any.whl (91 kB)
Collecting Flask-Admin==1.5.5
Using cached Flask_Admin-1.5.5-py3-none-any.whl (1.9 MB)
Collecting Flask-Assets==0.12
Using cached Flask-Assets-0.12.tar.gz (22 kB)
Preparing metadata (setup.py) ... done
Collecting Flask-DebugToolbar==0.10.1
Using cached Flask_DebugToolbar-0.10.1-py2.py3-none-any.whl (326 kB)
Collecting Flask-SQLAlchemy==2.3.2
Using cached Flask_SQLAlchemy-2.3.2-py2.py3-none-any.whl (16 kB)
Collecting Flask-Migrate==3.0.1
Using cached Flask_Migrate-3.0.1-py2.py3-none-any.whl (12 kB)
Collecting Flask-Login==0.4.1
Using cached Flask-Login-0.4.1.tar.gz (14 kB)
Preparing metadata (setup.py) ... done
Collecting Flask-WTF==0.14.3
Using cached Flask_WTF-0.14.3-py2.py3-none-any.whl (13 kB)
Collecting Flask-User==1.0.2.2
Using cached Flask-User-1.0.2.2.tar.gz (74 kB)
Preparing metadata (setup.py) ... done
Collecting Flask-Gravatar==0.5.0
Using cached Flask_Gravatar-0.5.0-py2.py3-none-any.whl (7.5 kB)
Collecting Flask-Paginate==0.5.2
Using cached flask-paginate-0.5.2.tar.gz (5.5 kB)
Preparing metadata (setup.py) ... done
Collecting Flask-RESTful==0.3.8
Using cached Flask_RESTful-0.3.8-py2.py3-none-any.whl (25 kB)
Collecting Flask-Limiter==1.4
Using cached Flask_Limiter-1.4-py3-none-any.whl (15 kB)
Collecting SQLAlchemy==1.3.1
Using cached SQLAlchemy-1.3.1.tar.gz (5.9 MB)
Preparing metadata (setup.py) ... done
Collecting SQLAlchemy-Utils==0.33.11
Using cached SQLAlchemy-Utils-0.33.11.tar.gz (128 kB)
Preparing metadata (setup.py) ... done
Collecting psycopg2-binary==2.8.4
Using cached psycopg2-binary-2.8.4.tar.gz (378 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
python setup.py egg_info did not run successfully.
exit code: 1
[25 lines of output]
/usr/lib/python3/dist-packages/setuptools/config/setupcfg.py:515: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
running egg_info
creating /tmp/pip-pip-egg-info-r7rjid_r/psycopg2_binary.egg-info
writing /tmp/pip-pip-egg-info-r7rjid_r/psycopg2_binary.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-r7rjid_r/psycopg2_binary.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-r7rjid_r/psycopg2_binary.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-r7rjid_r/psycopg2_binary.egg-info/SOURCES.txt'
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Encountered error while generating package metadata.
See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
So I made sure that the Debian 12 python3-psycopg2 package got installed, tried again, and ended up with the same error as above. Plus pg_config is nowhere to be found in the system. Somebody online suggested that I should install it with pip3 install psycopg2-binary. I tried that, and had to add the --break-system-packages to proceed. That seem to work fine (with a warning against doing things as root, however) and then tried the opencve installation command again.
Same problem. And pg_config still nowhere to be seen. At this point I clearly do not know what the heck I am doing, and my VM probably is utterly messed up by now, when it comes to the Python framework.
Anybody out there with Python savvy can provide idiot-proof steps to install opencve under Debian 12?