Repository: pypa/pipenv

Issue:
v11.10.1: initial `pipenv install` in existing virtualenv fails
<details><summary>$ python -m pipenv.help output</summary>

Pipenv version: `'11.10.1'`

Pipenv location: `'/usr/local/lib/python3.6/site-packages/pipenv'`

Python location: `'/usr/local/bin/python'`

Other Python installations in `PATH`:

  - `3.6`: `/usr/local/bin/python3.6m`
  - `3.6`: `/usr/local/bin/python3.6`
  - `3.6`: `/usr/local/bin/python3.6`

  - `3.6.5`: `/usr/local/bin/python`
  - `3.6.5`: `/usr/local/bin/python`
  - `3.6.5`: `/usr/local/bin/python3`
  - `3.6.5`: `/usr/local/bin/python3`

PEP 508 Information:

```
{'implementation_name': 'cpython',
 'implementation_version': '3.6.5',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.16.3-1-ARCH',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP PREEMPT Thu Apr 19 09:17:56 UTC 2018',
 'python_full_version': '3.6.5',
 'python_version': '3.6',
 'sys_platform': 'linux'}
```

System environment variables:

  - `HOSTNAME`
  - `GPG_KEY`
  - `TERM`
  - `PYTHON_VERSION`
  - `PATH`
  - `PWD`
  - `LANG`
  - `PYTHON_PIP_VERSION`
  - `SHLVL`
  - `HOME`
  - `_`
  - `OLDPWD`
  - `PYTHONDONTWRITEBYTECODE`
  - `PIP_PYTHON_PATH`

Pipenv–specific environment variables:


Debug–specific environment variables:

  - `PATH`: `/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`
  - `LANG`: `C.UTF-8`
  - `PWD`: `/app`


---------------------------

</details>

------------

##### Expected result

    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.
    Creating a Pipfile for this project…
    Pipfile.lock not found, creating…
    Locking [dev-packages] dependencies…
    Using pip: -i https://pypi.python.org/simple

                              ROUND 1                           
    Current constraints:

    Finding the best candidates:

    Finding secondary dependencies:
    ------------------------------------------------------------
    Result of round 1: stable, done

    Locking [packages] dependencies…
    Using pip: -i https://pypi.python.org/simple

                              ROUND 1                           
    Current constraints:

    Finding the best candidates:

    Finding secondary dependencies:
    ------------------------------------------------------------
    Result of round 1: stable, done

    Updated Pipfile.lock (625834)!
    Installing dependencies from Pipfile.lock (625834)…

##### Actual result

    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.
    Creating a Pipfile for this project…
    Warning: --system is intended to be used for Pipfile installation, not installation of specific packages. Aborting.
    See also: --deploy flag.


##### Steps to replicate

Requires pipenv v11.10.1. Not reproducible in v11.10.0. In an empty directory, run:

    $ virtualenv env
    $ source env/bin/activate
    $ pipenv install



Discussion:
Can you please provide the command you used...
Based on reading your PR you passed `—system` which, as the warning states, can’t be used to install individual packages or to do anything besides take a lockfile and put it into a docker container basically. 

You’re running inside a virtualenv I can see, so passing `—system` is almost certainly not what you want to do unless your goal is actually to install packages in your systems site packages directory. These warnings are there in this version for a reason
Let me know if that clears things up, I see you already opted to move away from pipenv but I’m fairly confident that all you actually needed to do in this case was not pass `—system`. This argument really is basically never what you want unless you’re an isolated container for deployment. 
The command used is only `pipenv install`, see also *Steps to replicate* in the original post. This occurs when running inside an existing virtualenv with no existing Pipfile/Pipfile.lock.

Please note that *"Warning: --system is intended to be used for Pipfile installation, ..."* is printed despite not using the `--system` argument.
@kvikshaug er right, yes, totally missed that... people don't normally fill out the issue template accurately :sweat_smile: 

I thought I fixed this before releasing... but yeah this is definitely still present... sorry, this is bad
No problem :slightly_smiling_face: to be clear, the linked PR is a bit misleading and we are not moving away from pipenv as a tool in general. Thanks for following up.
Please release this.
I'm still seeing this issue on version 11.10.4, I checked my pipenv/core.py file, it includes the change of #2091.

```
(venv) # pipenv install -r requirements.txt
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.
Requirements file provided! Importing into Pipfile…
Warning: --system is intended to be used for Pipfile installation, not installation of specific packages. Aborting.
See also: --deploy flag.

(venv) # pipenv --version
pipenv, version 11.10.4
```

I am also still seeing this error with pipenv v11.10.4.

In the [fix](https://github.com/pypa/pipenv/pull/2091/files#diff-ec74dda0078733c5b6755671cacf1de5R1355), should it have been the following?

```
if (system or allow_global) and not PIPENV_VIRTUALENV:
```

Resolving patch:
diff --git a/pipenv/core.py b/pipenv/core.py
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -1346,7 +1346,9 @@ def do_init(
                 do_lock(system=system, pre=pre, keep_outdated=keep_outdated)
     # Write out the lockfile if it doesn't exist.
     if not project.lockfile_exists and not skip_lock:
-        if system or allow_global and not PIPENV_VIRTUALENV:
+        # Unless we're in a virtualenv not managed by pipenv, abort if we're
+        # using the system's python.
+        if (system or allow_global) and not PIPENV_VIRTUALENV:
             click.echo(
                 '{0}: --system is intended to be used for Pipfile installation, '
                 'not installation of specific packages. Aborting.'.format(


Test patch: