Repository: pypa/pip

Issue:
`pip install --egg` break's pip's dependency resolution
`pip install --egg` remove's pip's use of `--single-version-externally-managed`, which is the basis for pip's dependency resolution, which underlies it's "requirements file" feature.

e.g. do this:  `pip install --egg peppercorn==0.2 deform`

you should end up with peppercorn v0.2, but instead you get v0.4

--egg ignored when wheels available
- Pip version: 8.1.2
- Python version: 3.5.1
- Operating System: OS X 10.11.5
### Description:

I'm working to use pip in place of easy_install, but due to #3, I have to install packages as eggs. So I tried installing a package as an egg, but because a wheel was available, pip installed that, and not as an egg. I would expect (in order of preference):
1. Pip would convert the wheel to an egg and install it.
2. Pip would disregard wheels and build and egg from a source distribution and install it.
3. Pip would raise an error that it can't install as an egg when a wheel is available.
### What I've run:

```
$ python -m pip install --egg setuptools
Collecting setuptools
  Using cached setuptools-21.1.0-py2.py3-none-any.whl
Installing collected packages: setuptools
Successfully installed setuptools-21.1.0
$ python -c "import setuptools; print(setuptools.__file__)"
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/setuptools/__init__.py
```



Discussion:
original PR  #541 (and issue that motivated it #3)
related issue  #1037

I feel like this is yet another reason that `--egg` should go :/

@jaraco since the actual issue causing #3 is, that editable installs and "normal" non egg installs are incompatible, i see this more of a bug of the setuptools develop command than pip

> I feel like this is yet another reason that --egg should go :/

Yes, I share that sentiment. And if there were a viable alternative, I would agree. I'm conscientiously  seeking to find that alternative.


Resolving patch:
diff --git a/pip/commands/install.py b/pip/commands/install.py
--- a/pip/commands/install.py
+++ b/pip/commands/install.py
@@ -179,6 +179,15 @@ def run(self, options, args):
         cmdoptions.resolve_wheel_no_use_binary(options)
         cmdoptions.check_install_build_global(options)
 
+        if options.as_egg:
+            warnings.warn(
+                "--egg has been deprecated and will be removed in the future. "
+                "This flag is mutually exclusive with large parts of pip, and "
+                "actually using it invalidates pip's ability to manage the "
+                "installation process.",
+                RemovedInPip10Warning,
+            )
+
         if options.allow_external:
             warnings.warn(
                 "--allow-external has been deprecated and will be removed in "


Test patch:
diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py
--- a/tests/functional/test_install.py
+++ b/tests/functional/test_install.py
@@ -397,7 +397,7 @@ def test_install_as_egg(script, data):
     Test installing as egg, instead of flat install.
     """
     to_install = data.packages.join("FSPkg")
-    result = script.pip('install', to_install, '--egg', expect_error=False)
+    result = script.pip('install', to_install, '--egg', expect_error=True)
     fspkg_folder = script.site_packages / 'fspkg'
     egg_folder = script.site_packages / 'FSPkg-0.1.dev0-py%s.egg' % pyversion
     assert fspkg_folder not in result.files_created, str(result.stdout)
diff --git a/tests/functional/test_uninstall.py b/tests/functional/test_uninstall.py
--- a/tests/functional/test_uninstall.py
+++ b/tests/functional/test_uninstall.py
@@ -341,7 +341,7 @@ def test_uninstall_as_egg(script, data):
     Test uninstall package installed as egg.
     """
     to_install = data.packages.join("FSPkg")
-    result = script.pip('install', to_install, '--egg', expect_error=False)
+    result = script.pip('install', to_install, '--egg', expect_error=True)
     fspkg_folder = script.site_packages / 'fspkg'
     egg_folder = script.site_packages / 'FSPkg-0.1.dev0-py%s.egg' % pyversion
     assert fspkg_folder not in result.files_created, str(result.stdout)