title: pip: prioritize a private pypi server
body: <p>I'm using Artifactory to host a large number of python modules. A couple of times, a new python module on <a href="https://pypi.python.org/pypi" rel="noreferrer">https://pypi.python.org/pypi</a> will be uploaded with the same name. This causes problems when someone tries to install one of my modules from Artifactory using pip. By default, pip looks for public packages first.</p>
  
  <p>Here's what I've tried:</p>
  
  <p><strong>1. I've tried modifying my .pypirc file accordingly,</strong></p>
  
  <pre>
  [distutils]
  index-servers=
          artifactory
          pypi
  </pre>
  
  <p>with appropriate entries for the two index servers, but I'm fairly certain that pip is ignoring this information.</p>
  
  <p><strong>2. I've tried manually specifying which index server to use.</strong></p>
  
  <p>I can specify <code>--index-url</code> or <code>--extra-index-url</code> but the latter does not help when the public package has a higher version number than my private package. If I specify the former, then public dependencies can't be found! It's like I can't win.</p>
  
  <p><strong>3. I've tried specifying <code>dependency_links</code> in setup.py.</strong></p>
  
  <p>... but this is deprecated as per this answer: <a href="https://stackoverflow.com/questions/12518499/pip-ignores-dependency-links-in-setup-py">pip ignores dependency_links in setup.py</a></p>
  
  <p>How do I configure pip to prefer my Artifactory repository over the public one?</p>