posit-dev / posit-dev/rsconnect-python

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

Aperta
#348 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Python
Stelle
37
Fork
28
Merge medio
1g 3h
PR unite (30g)
7

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il comando rsconnect deploy streamlit con la struttura mostrata di app/requirements.txt e data_pipelines/requirements.txt, quindi traccia il modo in cui il bundle di deployment gestisce i file requirements referenziati. La correzione è completata quando -r data_pipelines/requirements.txt viene risolto all’interno dell’app inclusa nel bundle e tutti i requirements referenziati vengono installati correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
cli
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.