Skip to content

Require requirements.txt file #538

Open
@gshotwell

Description

@gshotwell

Currently the package generates a requirements.txt file automatically as part of the deployment process which causes a lot of problems for neophite users. A few observations from supporting lots of python users through this process:

  1. Virtual environments are essential to python deployments
    When people try to deploy to either Connect or Shinyapps without a virtual environment they have a horrible time, and get really bewildering failures after long deploy jobs. I have never seen a real user have a good time with our products without using a virtual environment.

  2. People who use virtual environments likely also use requirements.txt files
    As a result it's not a burden for these users to be required to either do their own pip freeze or maintain their own requirments file, and generating it automatically doesn't help them

  3. People who don't know about requirements.txt files are likely not using a virtual environment. These people seem to benefit from the automatic file generation, but it's actually just making their error worse and more obscure. In particular:

  • Their system python is likely a mess so pip freeze will generate an unsolvable environment and a deployment failure. The error they get back doesn't help them, and it only occurs after Connect or Shinyapps have spent a long time trying to install things
  • Locking things down to particular package versions is too restrictive and also creates errors
  • OS-specific packaages like pywin are not installable on Linux servers, but are generated by pip freeze

As a result I think we should cancel the autogeneration and require the requirements.txt file. This is what Streamlit and HuggingFace require.

Activity

jimhester

jimhester commented on May 8, 2025

@jimhester

I agree with this, I think it would be more clear for users if an explicit requirements.txt was always required.

We often have users trying to deploy content to Connect either forget to include the requirements.txt, or have it in a different directory than needed for Posit Connect to pick up. Then their deploy ends up failing with an obscure error they don't understand, and we have to help them debug the issue.

If deploys failed with a helpful error message more users would be able to self-serve these deploy issue.

linked a pull request that will close this issue on Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @jimhester@gshotwell

      Issue actions

        Require requirements.txt file · Issue #538 · posit-dev/rsconnect-python