Repository: pypa/pipenv

Issue:
`--exists-action`'s `w` flag, is interpretted as a request for a package called `w` when using `pipenv install -e "."`
Been using pipenv for months, never ran into this before: 

run `pipenv install -e "."` seems to result in the request/collection of some random package called `w` ([Wallace](https://github.com/berkeley-cocosci/Wallace)!!) that's on pypi!!!!

As far as I can tell the reason why it searches for "w" is the `--exists-action` option in core.py ([line 1488](https://github.com/pypa/pipenv/blob/e00fce7335c23153ba8303e3ae2360914ff6f2e8/pipenv/core.py#L1488)). 

(it doesn't help that the authors of `Wallace` attempt to open a `requirements.txt` file in their `setup.py`)

**Verbose output:**
(ubuntu 18.04, python 2.7.15, pip 10.0.1, pipenv 2018-05-18)

```
mani@host:~/code/ReportCreator(hotfix/v2.6.3)$pipenv install -e "." -v
Installing -e .…
⠋Installing '-e .'
$ "/home/mani/.local/share/virtualenvs/ReportCreator-PmaoAZkd/bin/pip" install   --verbose    -e "." -i https://pypi.org/simple --extra-index-url ${PIP_EXTRA_INDEX_URL} --exists-action w
Created temporary directory: /tmp/pip-ephem-wheel-cache-xspLxQ
Created temporary directory: /tmp/pip-install-RJPkTE
Looking in indexes: https://pypi.org/simple, https://my.private.pypi.io/secret/index/, --exists-action
Obtaining file:///home/mani/code/ReportCreator
  Running setup.py (path:/home/mani/code/ReportCreator/setup.py) egg_info for package from file:///home/mani/code/ReportCreator
    Running command python setup.py egg_info
    running egg_info
    writing requirements to abcreporter.egg-info/requires.txt
    writing abcreporter.egg-info/PKG-INFO
    writing top-level names to abcreporter.egg-info/top_level.txt
    writing dependency_links to abcreporter.egg-info/dependency_links.txt
    reading manifest file 'abcreporter.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'abcreporter.egg-info/SOURCES.txt'
  Source in /home/mani/code/ReportCreator has version 2.6.3, which satisfies requirement abcreporter==2.6.3 from file:///home/mani/code/ReportCreator
Collecting w
  2 location(s) to search for versions of w:
  * https://pypi.org/simple/w/
  * https://my.private.pypi.io/secret/index/w/
  Getting page https://pypi.org/simple/w/
  Looking up "https://pypi.org/simple/w/" in the cache
  Current age based on date: 1055
  Freshness lifetime from max-age: 600
  Freshness lifetime from request max-age: 600
  Starting new HTTPS connection (1): pypi.org
  https://pypi.org:443 "GET /simple/w/ HTTP/1.1" 304 0
  Analyzing links from page https://pypi.org/simple/w/
    Found link https://files.pythonhosted.org/packages/0d/6f/613f18ccb1fc24d007b72c8215bcf49c445adb720a9d1621ccdf86cf9265/w-0.11.1.tar.gz#sha256=3c9f0bcea99476294aa87092cb6c71a98538a8b1a55203be586378a02394821b (from https://pypi.org/simple/w/), version: 0.11.1
  Getting page https://my.private.pypi.io/secret/index/w/
  Looking up "https://my.private.pypi.io/secret/index/w/" in the cache
  No cache entry available
  Starting new HTTPS connection (1): dl.cloudsmith.io
  https://dl.cloudsmith.io:443 "GET /my.private.pypi.io/secret/index/w/ HTTP/1.1" 404 None
  Status code 404 not in (200, 203, 300, 301)
  Could not fetch URL https://my.private.pypi.io/secret/index/w/: 404 Client Error: Not Found for url: https://my.private.pypi.io/secret/index/w/ - skipping
  Using version 0.11.1 (newest of versions: 0.11.1)
  Created temporary directory: /tmp/pip-unpack-bDSjkY
  Looking up "https://files.pythonhosted.org/packages/0d/6f/613f18ccb1fc24d007b72c8215bcf49c445adb720a9d1621ccdf86cf9265/w-0.11.1.tar.gz" in the cache
  Ignoring unknown cache-control directive: 
  Current age based on date: 6901
  Ignoring unknown cache-control directive: immutable
  Freshness lifetime from max-age: 365000000
  The response is "fresh", returning cached response
  365000000 > 6901
  Using cached https://files.pythonhosted.org/packages/0d/6f/613f18ccb1fc24d007b72c8215bcf49c445adb720a9d1621ccdf86cf9265/w-0.11.1.tar.gz
  Downloading from URL https://files.pythonhosted.org/packages/0d/6f/613f18ccb1fc24d007b72c8215bcf49c445adb720a9d1621ccdf86cf9265/w-0.11.1.tar.gz#sha256=3c9f0bcea99476294aa87092cb6c71a98538a8b1a55203be586378a02394821b (from https://pypi.org/simple/w/)
  Running setup.py (path:/tmp/pip-install-RJPkTE/w/setup.py) egg_info for package w
    Running command python setup.py egg_info
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-RJPkTE/w/setup.py", line 27, in <module>
        with open('requirements.txt') as f:
    IOError: [Errno 2] No such file or directory: 'requirements.txt'
Cleaning up...
  Removing source in /tmp/pip-install-RJPkTE/w
Exception information:
Traceback (most recent call last):
  File "/home/mani/.local/share/virtualenvs/ReportCreator-PmaoAZkd/local/lib/python2.7/site-packages/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
  File "/home/mani/.local/share/virtualenvs/ReportCreator-PmaoAZkd/local/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 291, in run
    resolver.resolve(requirement_set)
  File "/home/mani/.local/share/virtualenvs/ReportCreator-PmaoAZkd/local/lib/python2.7/site-packages/pip/_internal/resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "/home/mani/.local/share/virtualenvs/ReportCreator-PmaoAZkd/local/lib/python2.7/site-packages/pip/_internal/resolve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/mani/.local/share/virtualenvs/ReportCreator-PmaoAZkd/local/lib/python2.7/site-packages/pip/_internal/resolve.py", line 210, in _get_abstract_dist_for
    self.require_hashes
  File "/home/mani/.local/share/virtualenvs/ReportCreator-PmaoAZkd/local/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 324, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "/home/mani/.local/share/virtualenvs/ReportCreator-PmaoAZkd/local/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 154, in prep_for_dist
    self.req.run_egg_info()
  File "/home/mani/.local/share/virtualenvs/ReportCreator-PmaoAZkd/local/lib/python2.7/site-packages/pip/_internal/req/req_install.py", line 486, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/home/mani/.local/share/virtualenvs/ReportCreator-PmaoAZkd/local/lib/python2.7/site-packages/pip/_internal/utils/misc.py", line 698, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-RJPkTE/w/

Error:  An error occurred while installing -e .!
  Url '--exists-action/w/' is ignored. It is either a non-existing path or lacks a specific scheme.
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-RJPkTE/w/

This is likely caused by a bug in -e .. Report this to its maintainers.
```



Discussion:
Sorry for the confusing issue.  The exists-action should probably be moved to an environment variable, but in the meantime, don't surround the `.` with quotes.  Better parsing for this has also made it into the master branch already, so I think this is probably handled.

Thanks for reporting!
related: #2279 (another reason to implement this)
thanks @techalchemy , but I tried with and without quotation marks already and no dice! :( 
Oh boy that’s very odd. And if you leave out the `-v` as well?
yeah, sorry :disappointed: removed `-v` and still no dice...
@techalchemy what is bizarre is that it has no problems whatsoever, when i try to install the same package from a DIFFERENT directory, e.g. when I make a directory `~/elsewhere/` and do `pipenv install -e ~/code/mani/ReportCreator` it succesfully installs it with all its dependencies. 

I tried `pipenv install -e ~/code/mani/ReportCreator` from that directory itself as well, but didn't work!!??? 
@techalchemy I think I found the problem.. I only get the error when I replace the url for our private [[source]] with `url = "${PIP_EXTRA_INDEX_URL}"`. Changing this to `url = "https://private.pypyi/${MY_KEY}/index/"` seems to solve the problem.

Not sure why, but thank god I can finally move on! Thanks for your help. 
:trumpet: 

Resolving patch:
diff --git a/pipenv/core.py b/pipenv/core.py
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -1438,7 +1438,7 @@ def pip_install(
     upgrade_strategy = (
         "--upgrade --upgrade-strategy=only-if-needed" if selective_upgrade else ""
     )
-    pip_command = "{0} install {4} {5} {6} {7} {3} {1} {2} --exists-action w".format(
+    pip_command = "{0} install {4} {5} {6} {7} --exists-action w {3} {1} {2}".format(
         quoted_pip,
         install_reqs,
         " ".join(prepare_pip_source_args(sources)),


Test patch: