webmaster-kazu.com

テクノロジー・データ分析・実践ログ・その他

Python用のSupabaseクライアント「supabase-py」のインストール

カテゴリ: Python【初歩から現場実務的なもの】

Python用のSupabaseクライアント「supabase-py」のインストールについて解説しています。

「supabase-py(https://github.com/supabase-community/supabase-py)」は、supabaseは、Firebaseのオープンソースの代替手段で、supabase-pyはPython用のSupabaseクライアントになります。

■Python

今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows10)(pythonランチャーでの確認)

■supabase-pyをインストールする

supabase-pyをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。

pip install supabase

起動後、上記のコマンドを入力し、Enterキーを押します。

なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、pipを使う場合にはコマンドでの切り替えを行います。

py -3.8 -m pip install supabase

切り替えるために、上記のコマンドを入力し、Enterキーを押します。

Defaulting to user installation because normal site-packages is not writeable

Collecting supabase

Downloading supabase-0.5.3-py3-none-any.whl (13 kB)

Collecting httpx<0.22.0,>=0.21.3

Downloading httpx-0.21.3-py3-none-any.whl (83 kB)

|████████████████████████████████| 83 kB 612 kB/s

Collecting gotrue<0.6.0,>=0.5.0

Downloading gotrue-0.5.0-py3-none-any.whl (23 kB)

Collecting realtime<0.0.5,>=0.0.4

Downloading realtime-0.0.4-py3-none-any.whl (7.9 kB)

Collecting postgrest-py<0.10.0,>=0.9.1

Downloading postgrest_py-0.9.1-py3-none-any.whl (13 kB)

Collecting pydantic<2.0.0,>=1.9.0

Downloading pydantic-1.9.0-cp38-cp38-win_amd64.whl (2.1 MB)

|████████████████████████████████| 2.1 MB 3.3 MB/s

Requirement already satisfied: httpcore<0.15.0,>=0.14.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from httpx<0.22.0,>=0.21.3->supabase) (0.14.7)

Requirement already satisfied: sniffio in c:\users\user_\appdata\roaming\python\python38\site-packages (from httpx<0.22.0,>=0.21.3->supabase) (1.2.0)

Requirement already satisfied: charset-normalizer in c:\users\user_\appdata\roaming\python\python38\site-packages (from httpx<0.22.0,>=0.21.3->supabase) (2.0.12)

Requirement already satisfied: rfc3986[idna2008]<2,>=1.3 in c:\users\user_\appdata\roaming\python\python38\site-packages (from httpx<0.22.0,>=0.21.3->supabase) (1.5.0)

Requirement already satisfied: certifi in c:\users\user_\appdata\roaming\python\python38\site-packages (from httpx<0.22.0,>=0.21.3->supabase) (2021.5.30)

Collecting deprecation<3.0.0,>=2.1.0

Downloading deprecation-2.1.0-py2.py3-none-any.whl (11 kB)

Requirement already satisfied: python-dateutil<3.0.0,>=2.8.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from realtime<0.0.5,>=0.0.4->supabase) (2.8.1)

Collecting websockets<10.0,>=9.1

Using cached websockets-9.1-cp38-cp38-win_amd64.whl (90 kB)

Requirement already satisfied: packaging in c:\users\user_\appdata\roaming\python\python38\site-packages (from deprecation<3.0.0,>=2.1.0->postgrest-py<0.10.0,>=0.9.1->supabase) (20.9)

Requirement already satisfied: h11<0.13,>=0.11 in c:\users\user_\appdata\roaming\python\python38\site-packages (from httpcore<0.15.0,>=0.14.0->httpx<0.22.0,>=0.21.3->supabase) (0.12.0)

Requirement already satisfied: anyio==3.* in c:\users\user_\appdata\roaming\python\python38\site-packages (from httpcore<0.15.0,>=0.14.0->httpx<0.22.0,>=0.21.3->supabase) (3.5.0)

Requirement already satisfied: idna>=2.8 in c:\users\user_\appdata\roaming\python\python38\site-packages (from anyio==3.*->httpcore<0.15.0,>=0.14.0->httpx<0.22.0,>=0.21.3->supabase) (2.10)

Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\users\user_\appdata\roaming\python\python38\site-packages (from pydantic<2.0.0,>=1.9.0->gotrue<0.6.0,>=0.5.0->supabase) (3.7.4.3)

Requirement already satisfied: six>=1.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from python-dateutil<3.0.0,>=2.8.1->realtime<0.0.5,>=0.0.4->supabase) (1.15.0)

Requirement already satisfied: pyparsing>=2.0.2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from packaging->deprecation<3.0.0,>=2.1.0->postgrest-py<0.10.0,>=0.9.1->supabase) (2.4.7)

Installing collected packages: websockets, pydantic, httpx, deprecation, realtime, postgrest-py, gotrue, supabase

Attempting uninstall: websockets

Found existing installation: websockets 10.1

Uninstalling websockets-10.1:

Successfully uninstalled websockets-10.1

Attempting uninstall: pydantic

Found existing installation: pydantic 1.8.2

Uninstalling pydantic-1.8.2:

Successfully uninstalled pydantic-1.8.2

Attempting uninstall: httpx

Found existing installation: httpx 0.22.0

Uninstalling httpx-0.22.0:

Successfully uninstalled httpx-0.22.0

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

web3 5.24.0 requires jsonschema<4.0.0,>=3.2.0, but you have jsonschema 4.4.0 which is incompatible.

thinc 8.0.13 requires pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4, but you have pydantic 1.9.0 which is incompatible.

spacy 3.2.0 requires pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4, but you have pydantic 1.9.0 which is incompatible.

sanic 21.12.1 requires websockets>=10.0, but you have websockets 9.1 which is incompatible.

Successfully installed deprecation-2.1.0 gotrue-0.5.0 httpx-0.21.3 postgrest-py-0.9.1 pydantic-1.9.0 realtime-0.0.4 supabase-0.5.3 websockets-9.1

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、supabaseが正常にインストールされたことになりますが、今回は「ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.」という依存関係の競合の原因でエラーが発生した。このような場合は、Pythonで仮想環境を作成し、そこにインストールすることを推奨する。

なお、今回はsupabaseのバージョン0.5.3をインストールしました。