Skip to content

Is there a way to disable / suppress pipenv's "Courtesy Notice" about virtual environments? #2527

Closed

Description

@trianta2

Each time I invoke pipenv I see:

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead.

Can this be globally suppressed?

Activity

  1. uranusjr commented on Jul 5, 2018

    @uranusjr
    Member

    No, there is not.

  2. uranusjr commented on Jul 5, 2018

    @uranusjr
    Member

    That said, maybe we can treat an empty PIPENV_IGNORE_VIRTUALENVS as the suppressor.

    • PIPENV_IGNORE_VIRTUALENVS absent—show the message.
    • PIPENV_IGNORE_VIRTUALENVS set to empty string—suppress the message, but use the environment.
    • PIPENV_IGNORE_VIRTUALENVS is not empty—create a nested virtualenv.
  3. trianta2 commented on Jul 5, 2018

    @trianta2
    Author

    Does PIPENV_IGNORE_VIRTUALENVS=0 have any significance? If pipenv was told to not ignore virtual envs, then that should mean I want to use my existing virtual env, and the courtesy notice should be suppressed.

  4. techalchemy commented on Jul 5, 2018

    @techalchemy
    Member

    We have an environment variable to suppress output but we don't use it much. We can add this to the refactor

  5. max-arnold commented on Jul 10, 2018

    @max-arnold

    My current workaround:

    pipenv lock --requirements 2> >(grep -v "Courtesy Notice" >&2) > requirements.txt

  6. uranusjr commented on Jul 10, 2018

    @uranusjr
    Member

    @max-arnold You found a bug! lock -r should output to stdout (it does when you’re not in a virtualenv), but for some reason outputs to stderr when you are inside. You shouldn’t need more than pipenv lock --requirements > requirements.txt. We will fix that. Sorry for the annoyance.


    Edit: After some testing, you should be able to run pipenv lock --requirements 2>/dev/null on Linux or Mac. No need for fancy grep-ing.

  7. max-arnold commented on Jul 13, 2018

    @max-arnold

    @uranusjr Fancy grep and redirections are used to filterCourtesy Notice while preserving stderr/stdout separation and exit codes.

  8. added a commit that references this issue on Jul 13, 2018
    a4ede26
  9. added a commit that references this issue on Jul 25, 2018
    7c681cc
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

    Category: FutureIssue is planned for the future.Type: Enhancement 💡This is a feature or enhancement request.good first issueIssues suitable as a newcomer to get familiar with Pipenv!help wanted

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions