在Mac上安装pgvector扩展。

huangapple go评论121阅读模式
英文:

Install pgvector extension on mac

问题

抱歉,以下是翻译好的内容,已去掉代码部分:

我正在尝试在我的Mac上安装PostgreSQL Vector扩展,但出现了以下错误:

ERROR: 扩展 "vector" 没有版本 "0.4.0" 的安装脚本或更新路径。

这是我做的步骤:

  1. 按照 GitHub 上显示的安装指南进行操作:
    在Mac上安装pgvector扩展。

但当我运行 CREATE EXTENSION vector; 时出现了错误:

ERROR: 无法打开扩展控制文件 "/Applications/Postgres.app/Contents/Versions/13/share/postgresql/extension/vector.control":文件或目录不存在

  1. 我将pgvector的内容复制到postgresql/extension 中,使用以下命令:

    sudo cp -r ~/Downloads/pgvector/* /Applications/Postgres.app/Contents/Versions/13/share/postgresql/extension/

尝试运行 CREATE EXTENSION vector;,现在出现以下错误:

ERROR: 扩展 "vector" 没有版本 "0.4.0" 的安装脚本或更新路径。

有人遇到过这个问题吗?

顺便说一句,我正在使用 PostgreSQL 13.10

英文:

I'm trying to install postgres vector extension on my mac but am getting

ERROR:  extension "vector" has no installation script nor update path for version "0.4.0".

Here's what I did:

  1. Follow the installation guide as shown on github:
    在Mac上安装pgvector扩展。

But when I ran CREATE EXTENSION vector; got an error:

ERROR:  could not open extension control file "/Applications/Postgres.app/Contents/Versions/13/share/postgresql/extension/vector.control": No such file or directory
  1. I copied the content of pgvector into posgresql/extension using:

    sudo cp -r ~/Downloads/pgvector/* /Applications/Postgres.app/Contents/Versions/13/share/postgresql/extension/

Tried running CREATE EXTENSION vector; now the error is:

ERROR:  extension "vector" has no installation script nor update path for version "0.4.0".

Anyone here seen this problem?

By the way am using PostgreSQL 13.10

答案1

得分: 1

以下是翻译好的部分:

I had this same issue and was able to fix it.
我遇到了相同的问题并成功解决了。

My Setup

我的设置

  • postgres v 14
  • installed via Postgres.app
  • 通过Postgres.app安装

First Mistake (mixed PG config)

第一个错误(混合的PG配置)

Even though I installed PG via the PG app, I tried to install this
extension using Homebrew.
This messed up some of the PG config settings.
尽管我是通过PG应用安装的,但我尝试使用Homebrew安装此扩展。
这导致了一些PG配置设置混乱。

Running this on the command line,
在命令行上运行以下命令,

pg_config --libdir

Gave this output: /opt/homebrew/share/postgresql@14
输出结果为:/opt/homebrew/share/postgresql@14

This is not good for a Postgres.app install.
这对于Postgres.app的安装不好。

The Fix (reset pg configs)
解决方法(重置pg配置)

Assuming Postgres.app install!
假设已安装Postgres.app!

brew uninstall pgvector

brew uninstall postgresql

Now run:
现在运行:

pg_config --libdir

I get: /Applications/Postgres.app/Contents/Versions/14/lib
得到:/Applications/Postgres.app/Contents/Versions/14/lib

Now, install pgvector using the Makefile approach.
现在,使用Makefile方法安装pgvector。

2nd Mistake (Extension files in the wrong place)

第二个错误(扩展文件放错位置)

Don't (as OP did), just copy the pgvector files to the Postgress extensions directory. This will create an invalid directory structure.
不要像OP那样,只是将pgvector文件复制到Postgress扩展目录。这将创建无效的目录结构。

I believe make install will place the files in the proper place.
我相信使用make install会将文件放在正确的位置。

If CREATE EXTENSION vector; still fails, you can check the following to ensure the files are in the right place.
如果CREATE EXTENSION vector; 仍然失败,您可以检查以下内容以确保文件放在正确的位置。

The Fix
解决方法

You should have the following files installed in the following directories.
您应该在以下目录中安装以下文件。

All .SQL and .control files.
所有.SQL和.control文件。
Ensure these files are in the following directory
确保这些文件位于以下目录

/Applications/Postgres.app/Contents/Versions/14/share/postgresql/extension
/Applications/Postgres.app/Contents/Versions/14/share/postgresql/extension

vector.so is in the following directory
vector.so位于以下目录

/Applications/Postgres.app/Contents/Versions/14/lib/postgresql
/Applications/Postgres.app/Contents/Versions/14/lib/postgresql

Install the extension
安装扩展

psql <your db>
CREATE EXTENSION vector;
英文:

I had this same issue and was able to fix it.

My Setup

  • postgres v 14
  • installed via Postgres.app

First Mistake (mixed PG config)

Even though I installed PG via the PG app, I tried to install this
extension using Homebrew.
This messed up some of the PG config settings.

Running this on the command line,

pg_config --libdir

> Gave this output: /opt/homebrew/share/postgresql@14

This is not good for a Postgres.app install.

The Fix (reset pg configs)

Assuming Postgres.app install!

brew uninstall pgvector

brew uninstall postgresql

Now run:

pg_config --libdir

> I get: /Applications/Postgres.app/Contents/Versions/14/lib

Now, install pgvector using the Makefile approach.

2nd Mistake (Extension files in the wrong place)

Don't (as OP did), just copy the pgvector files to the Postgress extensions directory. This will create an invalid directory structure.

I believe make install will place the files in the proper place.
If
CREATE EXTENSION vector; still fails, you can check the following to ensure the files are in the right place.

The Fix

You should have the following files installed in the following directories.

All .SQL and .control files.
Ensure these files are in the following directory

> /Applications/Postgres.app/Contents/Versions/14/share/postgresql/extension

vector.so is in the following directory

> /Applications/Postgres.app/Contents/Versions/14/lib/postgresql

Install the extension

psql &lt;your db&gt;
CREATE EXTENSION vector;

答案2

得分: 0

Had the same issue.
After installation, you have to login to your Postgres DB, for example via

psql postgres

and run

CREATE EXTENSION vector;

英文:

Had the same issue.
After installation, you have to login to your Postgres DB, for example via

psql postgres

and run

CREATE EXTENSION vector;

huangapple
  • 本文由 发表于 2023年3月7日 23:32:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/75664004.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定