posit-dev / posit-dev/rsconnect-python

`rsconnect deploy` fails with hierarchical `requirements.txt`

オープン
#348 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
37
フォーク
28
平均マージ
1日 3時間
マージ済み PR(30日)
7

説明

Issue

In our environment rsconnect deploy fails when requirements.txt refers to other requirement files as described in Referring to other requirements files.

Steps to reproduce

Sorry, I currently can't think of a better way to give you an easily reproducable example than describing the case.

The following command is run by an AWS CodeBuild step:

rsconnect deploy streamlit -n server -a $APP_ID -e 0_Übersicht.py app

The streamlit app has some sub-packages with their own requirement files:

app/
   data_pipelines/
      requirements.txt
      ...
   pages/
      ...
   0_Übersicht.py
   requirements.txt
   ...

with app/requirements.txt looking like

-r data_pipelines/requirements.txt

streamlit
...

Outcome

The deployment fails with the following output:

Command Line Output ``` [Container] 2023/02/07 13:29:21 Running command rsconnect deploy streamlit -n server -a $APP_ID -e 0_Übersicht.py app -- 240 | Validating server... [OK] 241 | Validating app mode... [OK] 242 | Making bundle ... [OK] 243 | Deploying bundle ... [OK] 244 | Saving deployed information... [OK] 245 | Building Streamlit application... 246 | Bundle created with Python version 3.8.13 is compatible with environment Local with Python version 3.8.15 from /opt/Python/3.8.15/bin/python3.8 247 | Bundle requested Python version 3.8.13; using /opt/Python/3.8.15/bin/python3.8 which has version 3.8.15 248 | 2023/02/07 13:29:24.159151565 Running on host: XXXXXXXXXXXXXXXXXXXXX.net 249 | 2023/02/07 13:29:24.159170675 Working directory: /opt/rstudio-connect/mnt/app 250 | 2023/02/07 13:29:24.159310919 Environment will be built with Python "3.8.15 \| packaged by conda-forge \| (default, Nov 22 2022, 08:49:35) [GCC 10.4.0]" at /opt/Python/3.8.15/bin/python3.8 251 | 2023/02/07 13:29:24.159509893 Running as user: rstudio-connect 252 | 2023/02/07 13:29:24.168868650 Creating environment: XXXXXXXXXXXXXXXXXXXXX 253 | 2023/02/07 13:29:35.189960015 Requirement already satisfied: pip in /opt/rstudio-connect/mnt/python-environments/pip/3.8.15/XXXXXXXXXXXXXXXXXXXXX/lib/python3.8/site-packages (22.0.4) 254 | 2023/02/07 13:29:35.379102213 Collecting pip 255 | 2023/02/07 13:29:35.385750069 Using cached pip-23.0-py3-none-any.whl (2.1 MB) 256 | 2023/02/07 13:29:35.398696114 Requirement already satisfied: setuptools in /opt/rstudio-connect/mnt/python-environments/pip/3.8.15/XXXXXXXXXXXXXXXXXXXXX/lib/python3.8/site-packages (56.0.0) 257 | 2023/02/07 13:29:35.809980556 Collecting setuptools 258 | 2023/02/07 13:29:35.813819766 Using cached setuptools-67.2.0-py3-none-any.whl (1.1 MB) 259 | 2023/02/07 13:29:35.821113679 Requirement already satisfied: wheel in /opt/Python/3.8.15/lib/python3.8/site-packages (0.38.4) 260 | 2023/02/07 13:29:36.108930301 Installing collected packages: setuptools, pip 261 | 2023/02/07 13:29:36.109176616 Attempting uninstall: setuptools 262 | 2023/02/07 13:29:36.110090958 Found existing installation: setuptools 56.0.0 263 | 2023/02/07 13:29:36.322191486 Uninstalling setuptools-56.0.0: 264 | 2023/02/07 13:29:36.455759023 Successfully uninstalled setuptools-56.0.0 265 | 2023/02/07 13:29:39.576955975 Attempting uninstall: pip 266 | 2023/02/07 13:29:39.578055351 Found existing installation: pip 22.0.4 267 | 2023/02/07 13:29:40.463374479 Uninstalling pip-22.0.4: 268 | 2023/02/07 13:29:40.539092543 Successfully uninstalled pip-22.0.4 269 | 2023/02/07 13:29:48.092566342 Successfully installed pip-23.0 setuptools-67.2.0 270 | 2023/02/07 13:29:48.945320724 ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'python/data_pipelines/requirements.txt' 271 | 2023/02/07 13:29:50.834363210 pip install failed with exit code 1 ```

Most notably is

270 | 2023/02/07 13:29:48.945320724 ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'python/data_pipelines/requirements.txt'

Expected outcome

All referred requirements files are traversed and the listed requirements installed.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、app/requirements.txtdata_pipelines/requirements.txt の図示されたレイアウトで rsconnect deploy streamlit コマンドを再現し、次にデプロイバンドルが参照された requirements ファイルをどのように処理するかを追跡します。-r data_pipelines/requirements.txt がバンドルされたアプリ内で解決され、参照されたすべての requirements が正常にインストールされれば、修正は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
cli
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。