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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to