posit-dev / publisher

MIT License
3 stars 0 forks source link

Publishing from a venv directory fails #600

Open kgartland-rstudio opened 7 months ago

kgartland-rstudio commented 7 months ago

When deploying where a venv is in a subdirectory, deploys work as expected (and also ignore the venv folder!). However, if you accidentally put the venv in the actual directory you're deploying (like I did) it fails.

It looks like we ignore everything in the directory as the only file in the bundle is the manifest.json that Connect creates. So it fails because it can't find the expected requirements.txt or any other files.

time=2023-12-15T09:20:44.263-05:00 level=INFO msg="2023/12/15 14:20:43.854558272 Traceback (most recent call last):" source=server.log event_op=publish/restorePythonEnv
time=2023-12-15T09:20:44.263-05:00 level=INFO msg="2023/12/15 14:20:43.854730462   File \"/opt/rstudio-connect/python/build_environment.py\", line 397, in main" source=server.log event_op=publish/restorePythonEnv
time=2023-12-15T09:20:44.263-05:00 level=INFO msg="2023/12/15 14:20:43.854732956     specs = pip_read_requirements_file(requirements_file)" source=server.log event_op=publish/restorePythonEnv
time=2023-12-15T09:20:44.263-05:00 level=INFO msg="2023/12/15 14:20:43.854745342             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" source=server.log event_op=publish/restorePythonEnv
time=2023-12-15T09:20:44.263-05:00 level=INFO msg="2023/12/15 14:20:43.854064727 Unexpected error while building Python environment: [Errno 2] No such file or directory: 'requirements.txt'" source=server.log event_op=publish/restorePythonEnv
time=2023-12-15T09:20:44.263-05:00 level=INFO msg="2023/12/15 14:20:43.854746412   File \"/opt/rstudio-connect/python/report_helpers.py\", line 294, in pip_read_requirements_file" source=server.log event_op=publish/restorePythonEnv
time=2023-12-15T09:20:44.263-05:00 level=INFO msg="2023/12/15 14:20:43.854755163     with open(environment_file, \"r\") as f:" source=server.log event_op=publish/restorePythonEnv
time=2023-12-15T09:20:44.263-05:00 level=INFO msg="2023/12/15 14:20:43.854755933          ^^^^^^^^^^^^^^^^^^^^^^^^^^^" source=server.log event_op=publish/restorePythonEnv
time=2023-12-15T09:20:44.264-05:00 level=INFO msg="2023/12/15 14:20:43.854774439 FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'" source=server.log event_op=publish/restorePythonEnv
time=2023-12-15T09:20:44.264-05:00 level=INFO msg="Build error: exit status 255" source=server.log event_op=publish/restorePythonEnv
time=2023-12-15T09:20:44.266-05:00 level=ERROR msg="exit status 255" event_op=publish/restorePythonEnv event_phase=failure error_code=deployFailed
[ERROR]
time=2023-12-15T09:20:44.266-05:00 level=ERROR msg="exit status 255" event_op=publish event_phase=failure error_code=deployFailed

I tried this in rsconnect-python and it deploys correctly while ignoring the venv-specific files.

mmarchetti commented 7 months ago

Do we expect people to create their project inside a Python venv, and if so, what's the expected behavior?

kgartland-rstudio commented 7 months ago

Do we expect people to create their project inside a Python venv, and if so, what's the expected behavior?

We probably don't expect them to but in rsconnect-python we do ignore those folders/files successfully. I'm not sure how we do it there, mostly I wonder if we should have parody with rsconnect-python