File: install.html

package info (click to toggle)
petsc4py 3.14.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 22,504 kB
  • sloc: javascript: 8,795; python: 8,131; ansic: 1,531; f90: 322; makefile: 316; sh: 10
file content (245 lines) | stat: -rw-r--r-- 13,437 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245

<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Installation &#8212; PETSc for Python 3.14.1 documentation</title>
    <link rel="stylesheet" href="_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/doctools.js"></script>
    <script src="_static/language_data.js"></script>
    
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Tutorial" href="tutorial.html" />
    <link rel="prev" title="Overview" href="overview.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="tutorial.html" title="Tutorial"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="overview.html" title="Overview"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">PETSc for Python 3.14.1 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">Installation</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="installation">
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h1>
<div class="section" id="using-pip-or-easy-install">
<h2>Using <strong>pip</strong> or <strong>easy_install</strong><a class="headerlink" href="#using-pip-or-easy-install" title="Permalink to this headline">¶</a></h2>
<p>You can use <strong class="program">pip</strong> to install <code class="xref py py-mod docutils literal notranslate"><span class="pre">petsc4py</span></code> and its
dependencies (<code class="xref py py-mod docutils literal notranslate"><span class="pre">mpi4py</span></code> is optional but highly recommended):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ pip install [--user] numpy mpi4py
$ pip install [--user] petsc petsc4py
</pre></div>
</div>
<p>Alternatively, you can use <strong class="program">easy_install</strong> (deprecated):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ easy_install petsc4py
</pre></div>
</div>
<p>If you already have a working PETSc installation, set environment
variables <span class="target" id="index-0"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PETSC_DIR</span></code> and <span class="target" id="index-1"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PETSC_ARCH</span></code> to appropriate
values and next use <strong class="program">pip</strong>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ export PETSC_DIR=/path/to/petsc
$ export PETSC_ARCH=arch-linux2-c-opt
$ pip install petsc4py
</pre></div>
</div>
</div>
<div class="section" id="using-distutils">
<h2>Using <strong>distutils</strong><a class="headerlink" href="#using-distutils" title="Permalink to this headline">¶</a></h2>
<div class="section" id="requirements">
<h3>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline">¶</a></h3>
<p>You need to have the following software properly installed in order to
build <em>PETSc for Python</em>:</p>
<ul class="simple">
<li><p>Any <a class="reference external" href="http://www.mpi-forum.org">MPI</a> implementation <a class="footnote-reference brackets" href="#id2" id="id1">1</a> (e.g., <a class="reference external" href="http://www.mpich.org/">MPICH</a> or <a class="reference external" href="http://www.open-mpi.org">Open MPI</a>),
built with shared libraries.</p></li>
<li><p>A matching version of <a class="reference external" href="http://www.mcs.anl.gov/petsc/">PETSc</a> built with shared libraries.</p></li>
<li><p><a class="reference external" href="http://www.numpy.org">NumPy</a> package.</p></li>
</ul>
<dl class="footnote brackets">
<dt class="label" id="id2"><span class="brackets"><a class="fn-backref" href="#id1">1</a></span></dt>
<dd><p>Unless you have appropiatelly configured and built PETSc
without MPI (configure option <code class="docutils literal notranslate"><span class="pre">--with-mpi=0</span></code>).</p>
</dd>
<dt class="label" id="id3"><span class="brackets">2</span></dt>
<dd><p>You may need to use a parallelized version of the Python
interpreter with some MPI-1 implementations (e.g. MPICH1).</p>
</dd>
</dl>
</div>
<div class="section" id="downloading">
<h3>Downloading<a class="headerlink" href="#downloading" title="Permalink to this headline">¶</a></h3>
<p>The <em>PETSc for Python</em> package is available for download at the
Python Package Index. You can use
<strong class="program">curl</strong> or <strong class="program">wget</strong> to get a release tarball.</p>
<ul>
<li><p>Using <strong class="program">curl</strong>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ curl -LO https://pypi.io/packages/source/p/petsc4py/petsc4py-X.Y.Z.tar.gz
</pre></div>
</div>
</li>
<li><p>Using <strong class="program">wget</strong>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ wget https://pypi.io/packages/source/p/petsc4py/petsc4py-X.Y.Z.tar.gz
</pre></div>
</div>
</li>
</ul>
</div>
<div class="section" id="building">
<h3>Building<a class="headerlink" href="#building" title="Permalink to this headline">¶</a></h3>
<p>After unpacking the release tarball:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ tar -zxf petsc4py-X.Y.Z.tar.gz
$ cd petsc4py-X.Y.Z
</pre></div>
</div>
<p>the distribution is ready for building.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p><strong>Mac OS X</strong> users employing a Python distribution built
with <strong>universal binaries</strong> may need to set the environment
variables <span class="target" id="index-2"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">MACOSX_DEPLOYMENT_TARGET</span></code>, <span class="target" id="index-3"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">SDKROOT</span></code>,
and <span class="target" id="index-4"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">ARCHFLAGS</span></code> to appropriate values. As an example,
assume your Mac is running <strong>Snow Leopard</strong> on a <strong>64-bit Intel</strong>
processor and you want to override the hard-wired cross-development
SDK in Python configuration, your environment should be modified
like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ export MACOSX_DEPLOYMENT_TARGET=10.6
$ export SDKROOT=/
$ export ARCHFLAGS=&#39;-arch x86_64&#39;
</pre></div>
</div>
</div>
<p>Some environment configuration is needed to inform the location of
PETSc. You can set (using <strong class="command">setenv</strong>, <strong class="command">export</strong> or what
applies to you shell or system) the environment variables
<span class="target" id="index-5"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PETSC_DIR</span></code>, and <span class="target" id="index-6"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PETSC_ARCH</span></code> indicating where you
have built/installed PETSc:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ export PETSC_DIR=/usr/local/petsc
$ export PETSC_ARCH=arch-linux2-c-opt
</pre></div>
</div>
<p>Alternatively, you can edit the file <code class="file docutils literal notranslate"><span class="pre">setup.cfg</span></code> and provide the
required information below the <code class="docutils literal notranslate"><span class="pre">[config]</span></code> section:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">config</span><span class="p">]</span>
<span class="n">petsc_dir</span>  <span class="o">=</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">petsc</span>
<span class="n">petsc_arch</span> <span class="o">=</span> <span class="n">arch</span><span class="o">-</span><span class="n">linux2</span><span class="o">-</span><span class="n">c</span><span class="o">-</span><span class="n">opt</span>
<span class="o">...</span>
</pre></div>
</div>
<p>Finally, you can build the distribution by typing:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python setup.py build
</pre></div>
</div>
</div>
<div class="section" id="installing">
<h3>Installing<a class="headerlink" href="#installing" title="Permalink to this headline">¶</a></h3>
<p>After building, the distribution is ready for installation.</p>
<p>If you have root privileges (either by log-in as the root user of by
using <strong class="command">sudo</strong>) and you want to install <em>PETSc for Python</em> in
your system for all users, just do:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python setup.py install
</pre></div>
</div>
<p>The previous steps will install the <code class="xref py py-mod docutils literal notranslate"><span class="pre">petsc4py</span></code> package at standard
location <code class="file docutils literal notranslate"><em><span class="pre">prefix</span></em><span class="pre">/lib/python</span><em><span class="pre">X</span></em><span class="pre">.</span><em><span class="pre">Y</span></em><span class="pre">/site-packages</span></code>.</p>
<p>If you do not have root privileges or you want to install <em>PETSc for
Python</em> for your private use, just do:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python setup.py install --user
</pre></div>
</div>
</div>
</div>
</div>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Installation</a><ul>
<li><a class="reference internal" href="#using-pip-or-easy-install">Using <strong>pip</strong> or <strong>easy_install</strong></a></li>
<li><a class="reference internal" href="#using-distutils">Using <strong>distutils</strong></a><ul>
<li><a class="reference internal" href="#requirements">Requirements</a></li>
<li><a class="reference internal" href="#downloading">Downloading</a></li>
<li><a class="reference internal" href="#building">Building</a></li>
<li><a class="reference internal" href="#installing">Installing</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="overview.html"
                        title="previous chapter">Overview</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="tutorial.html"
                        title="next chapter">Tutorial</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/install.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="tutorial.html" title="Tutorial"
             >next</a> |</li>
        <li class="right" >
          <a href="overview.html" title="Overview"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">PETSc for Python 3.14.1 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">Installation</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021, Lisandro Dalcin.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
    </div>
  </body>
</html>