======================================
Mirroring a PyPI repository (AER 2.26)
======================================

.. raw:: html

    <div class="section" id="before-you-begin">
    <h2>Before you begin<a class="headerlink" href="#before-you-begin" title="Permalink to this headline">¶</a></h2>
    <p>You need to have already completed <a class="reference external" href="install.html">installing and configuring your Anaconda Repository instance</a>.  Due to the size of Anaconda Repository, it is important that you have configured a file storage location with sufficient disk space.  If necessary please see the <a class="reference external" href="install.html#configure-the-server">instructions for setting the file storage location</a>.</p>
    <p>The full PyPI mirror requires approximately 120GB.</p>
    </div>
    <div class="section" id="the-mirror-command">
    <h2>The mirror command<a class="headerlink" href="#the-mirror-command" title="Permalink to this headline">¶</a></h2>
    <p>To create a PyPI mirror run:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">anaconda</span><span class="o">-</span><span class="n">server</span><span class="o">-</span><span class="n">sync</span><span class="o">-</span><span class="n">pypi</span>
    </pre></div>
    </div>
    <p>This will load all of the packages on pypi.python.org into the <cite>~pypi</cite> binstar user account.</p>
    <p>Verify that this is working by opening your browser to <code class="docutils literal"><span class="pre">http://your.anaconda.repository/pypi/~pypi</span></code></p>
    <p>NOTE: Replace your.anaconda.repository with the actual URL to your Anaconda Repository.</p>
    <p>Alternately, you may not wish to mirror all packages. The license_blacklist feature is not available for PyPI due to the non-standardization of license metadata for these packages. To mirror a subset of the total repository, specify which platforms you want to include, or use the whitelist or blacklist functionality to control which packages are mirrored:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">anaconda</span><span class="o">-</span><span class="n">server</span><span class="o">-</span><span class="n">sync</span><span class="o">-</span><span class="n">pypi</span> <span class="o">--</span><span class="n">mirror</span><span class="o">-</span><span class="n">config</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">binstar</span><span class="o">/</span><span class="n">mirrors</span><span class="o">/</span><span class="n">pypi</span><span class="o">.</span><span class="n">yaml</span>
    </pre></div>
    </div>
    <p>If necessary, refer to more information on <a class="reference internal" href="../2.23/admin/mirrors-sync-configuration.html#mirrors-sync-configuration-2-23"><span class="std std-ref">whitelist, blacklist and license_blacklist functionality</span></a>.</p>
    </div>
    <div class="section" id="configure-pip">
    <h2>Configure pip<a class="headerlink" href="#configure-pip" title="Permalink to this headline">¶</a></h2>
    <p>To configure pip to use this new mirror you must edit your <cite>~/.pip/pip.conf</cite> file:</p>
    <div class="highlight-default"><div class="highlight"><pre><span></span><span class="p">[</span><span class="k">global</span><span class="p">]</span>
    <span class="n">index</span><span class="o">-</span><span class="n">url</span> <span class="o">=</span> <span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">your</span><span class="o">.</span><span class="n">anaconda</span><span class="o">.</span><span class="n">repo</span><span class="p">:</span><span class="o">&lt;</span><span class="n">port</span><span class="o">&gt;/</span><span class="n">pypi</span><span class="o">/~</span><span class="n">pypi</span><span class="o">/</span><span class="n">simple</span>
    </pre></div>
    </div>
    <p>NOTE: Replace <code class="docutils literal"><span class="pre">your.anaconda.repo</span></code> with the actual URL to your Anaconda Repository.</p>
    </div>
