webmaster-kazu.com

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

Python用の宣言型統計視覚化ライブラリ「Vega-Altair」のインストール

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

Python用の宣言型統計視覚化ライブラリ「Vega-Altair」のインストールについて解説します。

「Vega-Altair(https://github.com/altair-viz/altair)」は、統計視覚化し、データとその意味を理解するために重宝するライブラリです。

■Python

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

■altairをインストールする

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

pip install altair

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

なお、今回は、pythonランチャーを使用しており、Python Version 3.9.9にインストールを行うために、バージョンの切り替えを行います。

py -3.9 -m pip install altair

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

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

Collecting altair

Downloading altair-5.0.1-py3-none-any.whl (471 kB)

|████████████████████████████████| 471 kB 1.1 MB/s

Collecting numpy

Using cached numpy-1.25.1-cp39-cp39-win_amd64.whl (15.1 MB)

Collecting jinja2

Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)

Collecting jsonschema>=3.0

Using cached jsonschema-4.18.4-py3-none-any.whl (80 kB)

Requirement already satisfied: typing-extensions>=4.0.1 in c:\users\user_\appdata\roaming\python\python39\site-packages (from altair) (4.7.1)

Collecting toolz

Downloading toolz-0.12.0-py3-none-any.whl (55 kB)

|████████████████████████████████| 55 kB 1.7 MB/s

Collecting pandas>=0.18

Downloading pandas-2.0.3-cp39-cp39-win_amd64.whl (10.8 MB)

|████████████████████████████████| 10.8 MB 3.2 MB/s

Collecting rpds-py>=0.7.1

Downloading rpds_py-0.9.2-cp39-none-win_amd64.whl (180 kB)

|████████████████████████████████| 180 kB 6.8 MB/s

Collecting jsonschema-specifications>=2023.03.6

Using cached jsonschema_specifications-2023.7.1-py3-none-any.whl (17 kB)

Collecting referencing>=0.28.4

Using cached referencing-0.30.0-py3-none-any.whl (25 kB)

Collecting attrs>=22.2.0

Using cached attrs-23.1.0-py3-none-any.whl (61 kB)

Collecting tzdata>=2022.1

Using cached tzdata-2023.3-py2.py3-none-any.whl (341 kB)

Collecting pytz>=2020.1

Using cached pytz-2023.3-py2.py3-none-any.whl (502 kB)

Collecting python-dateutil>=2.8.2

Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)

Collecting six>=1.5

Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)

Collecting MarkupSafe>=2.0

Using cached MarkupSafe-2.1.3-cp39-cp39-win_amd64.whl (17 kB)

Installing collected packages: rpds-py, attrs, six, referencing, tzdata, pytz, python-dateutil, numpy, MarkupSafe, jsonschema-specifications, toolz, pandas, jsonschema, jinja2, altair

WARNING: The script f2py.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python39\Scripts' which is not on PATH.

Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

WARNING: The script jsonschema.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python39\Scripts' which is not on PATH.

Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Successfully installed MarkupSafe-2.1.3 altair-5.0.1 attrs-23.1.0 jinja2-3.1.2 jsonschema-4.18.4 jsonschema-specifications-2023.7.1 numpy-1.25.1 pandas-2.0.3 python-dateutil-2.8.2 pytz-2023.3 referencing-0.30.0 rpds-py-0.9.2 six-1.16.0 toolz-0.12.0 tzdata-2023.3

WARNING: You are using pip version 21.2.4; however, version 23.2 is available.

You should consider upgrading via the 'C:\Program Files\Python39\python.exe -m pip install --upgrade pip' command.

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、altairが正常にインストールされたことになりますが、「WARNING」と表示されました。「WARNING」はエラーではなく警告で、インストールは行われているので、今回は一旦無視しています。

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