rsconnect icon indicating copy to clipboard operation
rsconnect copied to clipboard

PyPI repository not recorded in manifest

Open jmcphers opened this issue 4 years ago • 5 comments

If Python content uses a specific PyPI repository in order to get access to packages not available in default repositories, it is unlikely to work when published since that repository is not recorded in the manifest generated by rsconnect. You must instead manually ensure that the PyPI repository used by RStudio Connect has the packages your Python content requires.

This is about to become a much more prevalent issue now that RStudio Package Manager allows you to create snapshots, which get their own repository URLs.

https://solo.rstudiopm.com/client/#/repos/32/overview

https://docs.rstudio.com/rspm/admin/python/

Recording these PyPI repository URLs when publishing content is essential to making it possible to use them to install Python package dependencies when the content runs on RStudio Connect.

jmcphers avatar Feb 11 '21 00:02 jmcphers

@mmarchetti do you have any thoughts on what we need to do here?

hadley avatar Mar 20 '23 20:03 hadley

In environment.py, we could capture the index_url and extra_index_url configuration into the requirements.txt file with Python code analogous to:

URL=$(python -m pip config get global.index_url) && echo "--index-url $URL" >> requirements.txt
URL=$(python -m pip config get global.extra_index_url) && echo "--extra-index-url $URL" >> requirements.txt

mmarchetti avatar Mar 21 '23 16:03 mmarchetti

@mmarchetti would you mind doing a PR to that end?

hadley avatar Mar 21 '23 22:03 hadley

Notes from our Python team meeting:

  • If a user provides a requirements file, we should not modify it
  • Environment inspection should include the repository in the generated requirements file

mmarchetti avatar Mar 29 '23 17:03 mmarchetti

@mmarchetti BTW deployApp() currently has forceGeneratePythonEnvironment = FALSE; if you set it to TRUE it will overwrite an existing requirements.txt.

hadley avatar Mar 29 '23 18:03 hadley