You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/06/09 14:11:43 UTC

[GitHub] [airflow] basjacobs93 commented on pull request #17349: #16037 Templated requirements.txt in Python operators

basjacobs93 commented on PR #17349:
URL: https://github.com/apache/airflow/pull/17349#issuecomment-1151172526

   This does not seem to be working properly when `requirements` is a string which contains a file path to a requirements file. If I provide `requirements` with a path to a `requirements.txt` file, I get (I obfuscated the pathname)
   ```
   ERROR: Invalid requirement: '<pathname>/requirements.txt' (from line 1 of /tmp/venvbcsbi3im/requirements.txt)
   Hint: It looks like a path. The path does exist. The argument you provided (<pathname>/requirements.txt) appears to be a requirements file. If that is the case, use the '-r' flag to install the packages specified within it.
   ```
   
   In this line, the file path is put into the `requirements_file_contents` variable
   https://github.com/apache/airflow/blob/b597ceaec9078b0ce28fe0081a196f065f600f43/airflow/operators/python.py#L423
   
   Next, this *file path* (rather than its contents) is written to the `f'{tmp_dir}/requirements.txt'` file 
   https://github.com/apache/airflow/blob/b597ceaec9078b0ce28fe0081a196f065f600f43/airflow/operators/python.py#L429
   
   Indeed, if I pass it `requirements="-r <pathname>/requirements.txt"`, it works correctly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org