Notion.so用の非公式PythonAPIクライアント「notion-py」のインストール

スポンサーリンク

Notion.so用の非公式PythonAPIクライアント「notion-py」のインストールについて解説しています。

「notion-py(https://github.com/jamalex/notion-py)」は、Notion.so API v3用の非公式Python3クライアントで、最新バージョンをインストールするためには、Python3.5以降が必要です。

■Python

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

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

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

pip install notion-py

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

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

py -3.8 -m pip install notion-py

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

Defaulting to user installation because normal site-packages is not writeable
Collecting notion-py
Downloading notion_py-0.0.10-py3-none-any.whl (59 kB)
|████████████████████████████████| 59 kB 923 kB/s
Collecting python-slugify==4.0.1
Downloading python-slugify-4.0.1.tar.gz (11 kB)
Preparing metadata (setup.py) ... done
Collecting requests==2.24.0
Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB)
|████████████████████████████████| 61 kB 2.3 MB/s
Collecting dictdiffer==0.8.1
Downloading dictdiffer-0.8.1-py2.py3-none-any.whl (16 kB)
Requirement already satisfied: tzlocal==2.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from notion-py) (2.1)
Collecting commonmark==0.9.1
Downloading commonmark-0.9.1-py2.py3-none-any.whl (51 kB)
|████████████████████████████████| 51 kB 1.6 MB/s
Collecting dominate==2.5.2
Downloading dominate-2.5.2-py2.py3-none-any.whl (29 kB)
Collecting mistletoe==0.7.2
Downloading mistletoe-0.7.2-py3-none-any.whl (28 kB)
Collecting text-unidecode>=1.3
Downloading text_unidecode-1.3-py2.py3-none-any.whl (78 kB)
|████████████████████████████████| 78 kB 1.5 MB/s
Requirement already satisfied: idna<3,>=2.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests==2.24.0->notion-py) (2.10)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
Downloading urllib3-1.25.11-py2.py3-none-any.whl (127 kB)
|████████████████████████████████| 127 kB 1.7 MB/s
Requirement already satisfied: certifi>=2017.4.17 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests==2.24.0->notion-py) (2021.5.30)
Collecting chardet<4,>=3.0.2
Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Requirement already satisfied: pytz in c:\users\user_\appdata\roaming\python\python38\site-packages (from tzlocal==2.1->notion-py) (2021.3)
Building wheels for collected packages: python-slugify
Building wheel for python-slugify (setup.py) ... done
Created wheel for python-slugify: filename=python_slugify-4.0.1-py2.py3-none-any.whl size=6781 sha256=cfb6442062807afbb2ba7e95ae0f07e5c099bd24da0012c539fe8b8effcd8ba5
Stored in directory: c:\users\user_\appdata\local\pip\cache\wheelsdf\e740a68c215791688c46c4d6251770a570e8dfea91af1acb5c
Successfully built python-slugify
Installing collected packages: urllib3, text-unidecode, chardet, requests, python-slugify, mistletoe, dominate, dictdiffer, commonmark, notion-py
Attempting uninstall: urllib3
Found existing installation: urllib3 1.26.5
Uninstalling urllib3-1.26.5:
Successfully uninstalled urllib3-1.26.5
Attempting uninstall: chardet
Found existing installation: chardet 4.0.0
Uninstalling chardet-4.0.0:
Successfully uninstalled chardet-4.0.0
Attempting uninstall: requests
Found existing installation: requests 2.27.1
Uninstalling requests-2.27.1:
Successfully uninstalled requests-2.27.1
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.
web3 5.24.0 requires websockets<10,>=9.1, but you have websockets 10.2 which is incompatible.
streamlit 0.82.0 requires click<8.0,>=7.0, but you have click 8.0.4 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.
pyfcm 1.5.3 requires urllib3>=1.26.0, but you have urllib3 1.25.11 which is incompatible.
notifiers 1.3.3 requires requests<3.0.0,>=2.27.1, but you have requests 2.24.0 which is incompatible.
mega-py 1.0.8 requires tenacity<6.0.0,>=5.1.5, but you have tenacity 8.0.1 which is incompatible.
Successfully installed chardet-3.0.4 commonmark-0.9.1 dictdiffer-0.8.1 dominate-2.5.2 mistletoe-0.7.2 notion-py-0.0.10 python-slugify-4.0.1 requests-2.24.0 text-unidecode-1.3 urllib3-1.25.11

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、notion-pyが正常にインストールされたことになります。

インストールされましたが、「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.」というエラーが発生し、これは依存関係の競合が原因のため、仮想環境でインストールした方が良いと考える。

なお、今回はnotion-pyのバージョン0.0.10をインストールしました。

コメント

タイトルとURLをコピーしました