question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pipenv detects itself running in a virtual env even though there isn't one

See original GitHub issue

Whenever I create a new directory and run pipenv install there it says:

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. You can set PIPENV_VERBOSITY=-1 to suppress this warning.

This, despite the fact that it’s a freshly opened terminal window in a newly created directory and I’m quite sure pipenv is not running inside a virtual environment.

To top it off, it apparently then does create a new virtual environment even though it says it wouldn’t…?

toni@Tonis-MacBook-Pro ~ % mkdir test3
toni@Tonis-MacBook-Pro ~ % cd test3
toni@Tonis-MacBook-Pro test3 % pipenv install --verbose --verbose
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. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Using python: None
Path to python: /usr/local/bin/python3
Creating a virtualenv for this project…
Pipfile: /Users/toni/test3/Pipfile
Using /usr/local/bin/python3 (3.7.7) to create virtualenv…
⠸ Creating virtual environment...created virtual environment CPython3.7.7.final.0-64 in 837ms
  creator CPython3Posix(dest=/Users/toni/.local/share/virtualenvs/test3-_bIlMMXE, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/Users/toni/Library/Application Support/virtualenv/seed-app-data/v1.0.1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

✔ Successfully created virtual environment! 
Virtualenv location: /Users/toni/.local/share/virtualenvs/test3-_bIlMMXE
Creating a Pipfile for this project…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (a65489)!
Installing dependencies from Pipfile.lock (a65489)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
toni@Tonis-MacBook-Pro test3 % 

$ pipenv --support

Pipenv version: '2020.6.2'

Pipenv location: '/usr/local/Cellar/pipenv/2020.6.2/libexec/lib/python3.8/site-packages/pipenv'

Python location: '/usr/local/Cellar/pipenv/2020.6.2/libexec/bin/python3.8'

Python installations found:

  • 3.7.7: /usr/local/bin/python3
  • 3.7.7: /usr/local/bin/python3.7m
  • 3.7.7: /usr/local/bin/python3.7
  • 3.7.3: /usr/bin/python3
  • 2.7.16: /usr/bin/python2
  • 2.7.16: /usr/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.8.3',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '19.5.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT '
                     '2020; root:xnu-6153.121.2~2/RELEASE_X86_64',
 'python_full_version': '3.8.3',
 'python_version': '3.8',
 'sys_platform': 'darwin'}

System environment variables:

  • PATH
  • TERM_PROGRAM
  • SHELL
  • TERM
  • CLICOLOR
  • TMPDIR
  • TERM_PROGRAM_VERSION
  • TERM_SESSION_ID
  • USER
  • SSH_AUTH_SOCK
  • _
  • PWD
  • XPC_FLAGS
  • XPC_SERVICE_NAME
  • SHLVL
  • HOME
  • LOGNAME
  • LC_CTYPE
  • __CF_USER_TEXT_ENCODING
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /usr/local/Cellar/pipenv/2020.6.2/libexec/tools:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
  • SHELL: /bin/zsh
  • PWD: /Users/toni/test3

Contents of Pipfile (‘/Users/toni/test3/Pipfile’):

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]

[requires]
python_version = "3.7"

Contents of Pipfile.lock (‘/Users/toni/test3/Pipfile.lock’):

{
    "_meta": {
        "hash": {
            "sha256": "7e7ef69da7248742e869378f8421880cf8f0017f96d94d086813baa518a65489"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.7"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {},
    "develop": {}
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:39
  • Comments:37 (5 by maintainers)

github_iconTop GitHub Comments

16reactions
robhafemeistercommented, Jul 13, 2020

I removed pipenv from brew then reinstalled pipenv via pip3 and all is good now.

9reactions
willbowditchcommented, Jun 17, 2020

Rolling back to the previous version fixes it for me:

$(brew --cellar)/pipenv/2020.6.2/libexec/bin/pip install pipenv==2020.5.28

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipenv detects itself running in a virtual env ... - Bountysource
Whenever I create a new directory and run pipenv install there it says: Courtesy Notice: Pipenv found itself running within a virtual ......
Read more >
Solved pipenv detects itself running in a virtual env even
Question: pipenv detects itself running in a virtual env even though there isn't one. Could have something to do with incompatible python and...
Read more >
Frequently Encountered Pipenv Problems - Read the Docs
Run the following command: pipenv lock --clear. and try again. If this does not work, try manually deleting the whole cache directory. It...
Read more >
Determine if Python is running inside virtualenv - Stack Overflow
The most reliable way to check for this is to check whether sys.prefix == sys.base_prefix . If they are equal, you are not...
Read more >
Pipenv and S2I: A better way to manage Python ...
When you run pipenv install , Pipenv automatically detects whether a virtual environment was already created for this project, and either ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found