webmaster-kazu.com

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

信頼性の高いスレッドまたはマシン間で作業を分散できる「Celery」のインストール

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

信頼性の高いスレッドまたはマシン間で作業を分散できる「Celery」のインストールについて解説しています。

「Celery(https://github.com/celery/celery)」は、オープンソースの分散タスクキュー(スレッドまたはマシン間で作業を分散できるもの)です。

■Python

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

■scrapyをインストールする

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

pip install celery

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

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

py -3.8 -m pip install celery

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

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

Collecting celery

Downloading celery-5.2.3-py3-none-any.whl (405 kB)

|████████████████████████████████| 405 kB 930 kB/s

Collecting kombu<6.0,>=5.2.3

Downloading kombu-5.2.4-py3-none-any.whl (189 kB)

|████████████████████████████████| 189 kB 939 kB/s

Collecting click-repl>=0.2.0

Downloading click_repl-0.2.0-py3-none-any.whl (5.2 kB)

Collecting setuptools<59.7.0,>=59.1.1

Downloading setuptools-59.6.0-py3-none-any.whl (952 kB)

|████████████████████████████████| 952 kB 3.2 MB/s

Collecting vine<6.0,>=5.0.0

Downloading vine-5.0.0-py2.py3-none-any.whl (9.4 kB)

Collecting pytz>=2021.3

Using cached pytz-2021.3-py2.py3-none-any.whl (503 kB)

Collecting billiard<4.0,>=3.6.4.0

Downloading billiard-3.6.4.0-py3-none-any.whl (89 kB)

|████████████████████████████████| 89 kB 2.4 MB/s

Collecting click-didyoumean>=0.0.3

Downloading click_didyoumean-0.3.0-py3-none-any.whl (2.7 kB)

Collecting click-plugins>=1.1.1

Downloading click_plugins-1.1.1-py2.py3-none-any.whl (7.5 kB)

Requirement already satisfied: click<9.0,>=8.0.3 in c:\users\user_\appdata\roaming\python\python38\site-packages (from celery) (8.0.4)

Requirement already satisfied: colorama in c:\users\user_\appdata\roaming\python\python38\site-packages (from click<9.0,>=8.0.3->celery) (0.4.4)

Requirement already satisfied: six in c:\users\user_\appdata\roaming\python\python38\site-packages (from click-repl>=0.2.0->celery) (1.15.0)

Requirement already satisfied: prompt-toolkit in c:\users\user_\appdata\roaming\python\python38\site-packages (from click-repl>=0.2.0->celery) (3.0.18)

Collecting amqp<6.0.0,>=5.0.9

Downloading amqp-5.1.0-py3-none-any.whl (51 kB)

|████████████████████████████████| 51 kB 83 kB/s

Requirement already satisfied: wcwidth in c:\users\user_\appdata\roaming\python\python38\site-packages (from prompt-toolkit->click-repl>=0.2.0->celery) (0.2.5)

Installing collected packages: vine, amqp, setuptools, pytz, kombu, click-repl, click-plugins, click-didyoumean, billiard, celery

Attempting uninstall: setuptools

Found existing installation: setuptools 58.3.0

Uninstalling setuptools-58.3.0:

Successfully uninstalled setuptools-58.3.0

Attempting uninstall: pytz

Found existing installation: pytz 2021.1

Uninstalling pytz-2021.1:

Successfully uninstalled pytz-2021.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.

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.

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.

Successfully installed amqp-5.1.0 billiard-3.6.4.0 celery-5.2.3 click-didyoumean-0.3.0 click-plugins-1.1.1 click-repl-0.2.0 kombu-5.2.4 pytz-2021.3 setuptools-59.6.0 vine-5.0.0

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

今回は、実際にインストールを行ってみましたが、celeryのインストールは完了しているが、「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.」というエラーが出力されていますので、依存関係の衝突が原因で発生しているため、仮想環境でインストールした方が良いと考える。