title: pip: Why sometimes installed as egg, sometimes installed as files
body: <p>Where can you force pip to install as "flat" and not as "egg".</p>
  
  <p>For me it seems random. Sometimes it gets installed as egg, sometime as flat.</p>
  
  <p><code>pip help install</code> shows only an option <code>--egg</code> which forces an egg installation. But I could not find a <code>--flat</code> option.</p>
  
  <p>The packages are from an own pypiserver, and uploaded like this:</p>
  
  <p><code>python setup.py sdist upload -r internal</code></p>
  
  <p>Output of pip during install:</p>
  
  <pre><code>Best match: foo-client 2015.2
  Downloading https://installserver:40443/pypi/packages/foo_client-2015.2.tar.gz
  Processing foo_client-2015.2.tar.gz
  Writing /home/bar_eins_daad/tmp/easy_install-z20B7b/foo_client-2015.2/setup.cfg
  Running foo_client-2015.2/setup.py -q bdist_egg --dist-dir /home/bar_eins_daad/tmp/easy_install-z20B7b/foo_client-2015.2/egg-dist-tmp-GO1snX
  </code></pre>
  
  <p>I don't know why <code>bdist_egg</code> gets used here. Does it force creating an egg install?</p>
  
  <p>The <code>setup.py</code> does use <code>setuptools</code> not <code>distutils</code>.</p>
  
  <p>The package on our pypiserver looks like this:</p>
  
  <pre><code>tar -tzf packages/foo_client-2015.3.tar.gz
  </code></pre>
  
  <p>content:</p>
  
  <pre><code>foo_client-2015.2/
  foo_client-2015.2/foo_client.egg-info/
  foo_client-2015.2/foo_client.egg-info/SOURCES.txt
  foo_client-2015.2/foo_client.egg-info/top_level.txt
  foo_client-2015.2/foo_client.egg-info/dependency_links.txt
  foo_client-2015.2/foo_client.egg-info/PKG-INFO
  foo_client-2015.2/setup.cfg
  foo_client-2015.2/PKG-INFO
  foo_client-2015.2/foo_client/
  foo_client-2015.2/foo_client/models.py
  ...
  </code></pre>
  
  <p><strong>Background</strong></p>
  
  <p>pip seems to sometimes install packages several times if zipped eggs are installed.</p>
  
  <p><strong>Update</strong></p>
  
  <p>I found under which condition the package gets installed as egg: if it gets installed via <code>python setup.py develop</code> (it is an install_requires dependency). </p>
  
  <p>If I use <code>pip install foo_client</code> it gets installed flat (the way I want it).</p>
  
  <p><strong>Update2</strong></p>
  
  <p>The very ugly part: If the egg gets installed, the old version installed flat does not get removed.</p>
  
  <p>Version: pip 1.5.6</p>