I noticed that YugabyteDB supports AI functions.
I was going to try it right away,
There seems to be no next repository.
git clone https://github.com/YugabyteDB-Samples/hello_rag.git
...
remote: Repository not found.
fatal: repository 'https://github.com/YugabyteDB-Samples/hello_rag.git/' not found
Also, the next one didn’t work well in my environment, so I put the psycopg2-binary in the error message with pip.
When I tried it, there was no Git repository on this page. Isn’t it a private repository?
$ git clone https://github.com/YugabyteDB-Samples/yugabytedb-localai-programming-language-search.git
Cloning into 'yugabytedb-localai-programming-language-search'...
remote: Repository not found.
fatal: repository 'https://github.com/YugabyteDB-Samples/yugabytedb-localai-programming-language-search.git/' not found
I tried several times and it didn’t work, but I found that I could install it properly if I set it up as follows. The problem that psycopg2 could not be installed has been resolved.
sudo dnf module switch-to postgresql:15
sudo dnf install -y postgresql-devel gcc make python3.11-devel
python3.11 -m venv ./env
source ./env/bin/activate
(env) [almalinux@ml110gen9 hoge]$ pip install psycopg2
Collecting psycopg2
Using cached psycopg2-2.9.10.tar.gz (385 kB)
Preparing metadata (setup.py) ... done
Installing collected packages: psycopg2
DEPRECATION: psycopg2 is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for psycopg2 ... done
Successfully installed psycopg2-2.9.10
[notice] A new release of pip available: 22.3.1 -> 25.1.1
[notice] To update, run: pip install --upgrade pip
By the way, when it didn’t work, the following error occurred. The python3.11-devel package should have been installed.
Or maybe it’s because I was using an older generation server.
(env) [almalinux@ml110gen9 hoge]$ pip install psycopg2
Collecting psycopg2
Using cached psycopg2-2.9.10.tar.gz (385 kB)
Preparing metadata (setup.py) ... done
Installing collected packages: psycopg2
DEPRECATION: psycopg2 is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for psycopg2 ... error
error: subprocess-exited-with-error
× Running setup.py install for psycopg2 did not run successfully.
│ exit code: 1
╰─> [40 lines of output]
running install
/home/almalinux/working/hoge/env/lib64/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-311
creating build/lib.linux-x86_64-cpython-311/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-cpython-311/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-cpython-311/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-cpython-311/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-cpython-311/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-cpython-311/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-cpython-311/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-cpython-311/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-cpython-311/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-cpython-311/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-cpython-311/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-cpython-311/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-cpython-311
creating build/temp.linux-x86_64-cpython-311/psycopg
gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC "-DPSYCOPG_VERSION=2.9.10 (dt dec pq3 ext lo64)" -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=130020 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/home/almalinux/working/hoge/env/include -I/usr/include/python3.11 -I. -I/usr/include -I/usr/include/pgsql/server -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-cpython-311/psycopg/adapter_asis.o -Wdeclaration-after-statement
In file included from psycopg/adapter_asis.c:28:
./psycopg/psycopg.h:35:10: fatal error: Python.h: No such file or directory
35 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> psycopg2
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
[notice] A new release of pip available: 22.3.1 -> 25.1.1
[notice] To update, run: pip install --upgrade pip
No, it’s that psycopg2 is compiling from source so it needs the “-devel” packages. Using psycopg2-binary should work though without needing to install those Installation — Psycopg 2.9.10 documentation