File: install.html

package info (click to toggle)
petsc4py 3.18.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 26,596 kB
  • sloc: javascript: 9,493; python: 9,230; ansic: 1,727; makefile: 324; f90: 313; sh: 10
file content (178 lines) | stat: -rw-r--r-- 8,386 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

<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Installation &#8212; PETSc for Python 3.18.5 documentation</title>
    <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="_static/classic.css" />
    
    <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
    <script src="_static/doctools.js"></script>
    <script src="_static/sphinx_highlight.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.18.5 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">
            
  <section id="installation">
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this heading">¶</a></h1>
<section id="using-pip">
<span id="petsc4py-install"></span><h2>Using <strong>pip</strong><a class="headerlink" href="#using-pip" title="Permalink to this heading">¶</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>$ python -m pip install [--user] numpy mpi4py  (or pip install [--user] numpy mpi4py)
$ python -m pip install [--user] petsc petsc4py (or pip install [--user] petsc petsc4py)
</pre></div>
</div>
</section>
<section id="using-setuptools">
<h2>Using <strong>setuptools</strong><a class="headerlink" href="#using-setuptools" title="Permalink to this heading">¶</a></h2>
<p>You can also install dependencies manually and then invoke setuptools
from the <cite>petsc4py</cite> source directory:</p>
<blockquote>
<div><p>$ python setup.py build
$ python setup.py install</p>
</div></blockquote>
<p>You may use the <cite>–install-lib</cite> argument to the <cite>install</cite> command to alter the
<cite>site-packages</cite> directory where the package is to be installed.</p>
<p>If you are cross-compiling, and the <cite>numpy</cite> module cannot be loaded on your
build host, then before invoking <cite>setup.py</cite>, set <cite>NUMPY_INCLUDE</cite> environment
variable to the path that would be returned by <cite>import numpy;
numpy.get_include()</cite>:</p>
<blockquote>
<div><p>$ export NUMPY_INCLUDE=/usr/lib/pythonX/site-packages/numpy/core/include</p>
</div></blockquote>
</section>
<section id="from-petsc-source">
<h2>From PETSc source<a class="headerlink" href="#from-petsc-source" title="Permalink to this heading">¶</a></h2>
<p>If you already have downloaded PETSc source and have installed the dependencies
of <cite>petsc4py</cite>, then to build the <cite>petsc4py</cite> module along with PETSc, add the
<cite>–with-petsc4py=1</cite> argument to the configure command when building PETSc:</p>
<blockquote>
<div><p>$ ./configure –with-petsc4py=1
$ make
$ make install</p>
</div></blockquote>
<p>This will install PETSc and the <cite>petsc4py</cite> module into the PETSc directory
under the prefix specified to the PETSc configure command.</p>
<p>If you wish to make the module importable without having to set the
<cite>PYTHONPATH</cite> environment variable, you may add a shortcut to the system-wide
<cite>site-packages</cite> directory creating a special <cite>.pth</cite> file with exactly one line
of Python code. This can be done by the following command, where the
system-wide path is assumed to be <cite>/usr/lib/pythonX/site-packages</cite> (replace <cite>X</cite>
with your python version):</p>
<blockquote>
<div><dl class="simple">
<dt>$ echo </dt><dd><p>“import sys, os;” “p = os.getenv(‘PETSC_DIR’);” “a = os.getenv(‘PETSC_ARCH’) or ‘’;” “p = p and os.path.join(p, a, ‘lib’);” “p and (p in sys.path or sys.path.append(p))” &gt; /usr/lib/pythonX/site-packages/petsc4py.pth</p>
</dd>
</dl>
</div></blockquote>
<p>If you are cross-compiling, and <cite>numpy</cite> cannot be loaded on your build host,
then pass <cite>–have-numpy=1 –with-numpy-include=PATH</cite>, where <cite>PATH</cite> is the path
that would be returned by <cite>import numpy; print(numpy.get_include())</cite>. This will
suppress autodetection of the include path on the build host.</p>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <div>
    <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">Using <strong>pip</strong></a></li>
<li><a class="reference internal" href="#using-setuptools">Using <strong>setuptools</strong></a></li>
<li><a class="reference internal" href="#from-petsc-source">From PETSc source</a></li>
</ul>
</li>
</ul>

  </div>
  <div>
    <h4>Previous topic</h4>
    <p class="topless"><a href="overview.html"
                          title="previous chapter">Overview</a></p>
  </div>
  <div>
    <h4>Next topic</h4>
    <p class="topless"><a href="tutorial.html"
                          title="next chapter">Tutorial</a></p>
  </div>
  <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" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</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.18.5 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> 5.3.0.
    </div>
  </body>
</html>