pgai
pgai copied to clipboard
[Bug]: user-packages take precedence over pgai dependencies
What happened?
In the pgai function initialization code, we remove site packages from sys.path to prevent system-packages from taking precedence over our packages.
user packages are also affected, and take precedence over our packages.
Concretely in a user's installation, we saw the following configuration:
Ollama install locations:
/home/<user>/.local/lib/python3.13/site-packages/ollama-0.2.1.dist-info
/home/<user>/.local/lib/python3.12/site-packages/ollama-0.2.1.dist-info
/usr/local/lib/pgai/0.7.0/ollama-0.4.5.dist-info
/usr/local/lib/pgai/0.6.0/ollama-0.2.1.dist-info
/usr/local/lib/pgai/0.5.0/ollama-0.2.1.dist-info
/usr/local/lib/pgai/0.4.1/ollama-0.2.1.dist-info
/usr/local/lib/pgai/0.4.0/ollama-0.2.1.dist-info
/usr/local/lib/pgai/0.8.0/ollama-0.4.5.dist-info
sys.path: [
'/usr/local/lib/python312.zip',
'/usr/local/lib/python3.12',
'/usr/local/lib/python3.12/lib-dynload',
'/home/<user>/.local/lib/python3.12/site-packages',
'/usr/local/lib/python3.12/site-packages'
]
sysconfig.get_paths: {
'stdlib': '/usr/local/lib/python3.12',
'platstdlib': '/usr/local/lib/python3.12',
'purelib': '/usr/local/lib/python3.12/site-packages',
'platlib': '/usr/local/lib/python3.12/site-packages',
'include': '/usr/local/include/python3.12',
'platinclude': '/usr/local/include/python3.12',
'scripts': '/usr/local/bin',
'data': '/usr/local'
}
pgai extension affected
0.8.0
pgai library affected
PostgreSQL version used
17
What operating system did you use?
Ubuntu
What installation method did you use?
Source
What platform did you run on?
Not applicable
Relevant log output and stack trace
How can we reproduce the bug?
See above
Are you going to work on the bugfix?
None