Skip to content

Commit b51380f

Browse files
committedJul 25, 2015
lxml needs a lot of RAM to compile
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
1 parent bad4476 commit b51380f

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed
 

Diff for: ‎stories/getting-started.html

+30-15
Original file line numberDiff line numberDiff line change
@@ -106,47 +106,62 @@ <h4 class="panel-title"><a class="collapsed" role="button" data-toggle="collapse
106106
</div>
107107
</div>
108108
<div class="panel panel-default">
109-
<div class="panel-heading" role="tab" id="headingLxmlErrors">
110-
<h4 class="panel-title"><a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseLxmlErrors" aria-expanded="false" aria-controls="collapseLxmlErrors"><i class="fa fa-exclamation-triangle"></i> Error: missing libxml/libxslt</a></h4>
109+
<div class="panel-heading" role="tab" id="headingPythonHeaders">
110+
<h4 class="panel-title"><a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapsePythonHeaders" aria-expanded="false" aria-controls="collapsePythonHeaders"><i class="fa fa-exclamation-triangle"></i> Error: Python.h not found</a></h4>
111111
</div>
112-
<div id="collapseLxmlErrors" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingLxmlErrors">
112+
<div id="collapsePythonHeaders" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingPythonHeaders">
113113
<div class="panel-body">
114-
<p>If you get errors about various files missing while compiling <code class="gs-code">lxml</code>, you must install headers for the <code class="gs-code">libxml</code>, <code class="gs-code">libxslt</code> and <code class="gs-code">zlib</code> libraries, like so:</p>
114+
<p>If you get an error to the effect of <code class="gs-code">Python.h not found</code>, you need to install development packages for Python.</p>
115115
<p>Debian systems:</p>
116116
<pre class="gs-console">
117-
<code># <span class="gs-root">sudo apt-get install libxml2-dev libxslt1-dev zlib1g-dev</span></code>
117+
<code># <span class="gs-root">sudo apt-get install python-dev</span></code>
118118
</pre>
119119
<p>Fedora 22+:</p>
120120
<pre class="gs-console">
121-
<code># <span class="gs-root">sudo dnf install libxslt-devel libxml2-devel zlib-devel</span></code>
121+
<code># <span class="gs-root">sudo dnf install python-devel</span></code>
122122
</pre>
123123
<p>Red Hat/CentOS/Fedora 21:</p>
124124
<pre class="gs-console">
125-
<code># <span class="gs-root">sudo yum install libxslt-devel libxml2-devel zlib-devel</span></code>
125+
<code># <span class="gs-root">sudo yum install python-devel</span></code>
126126
</pre>
127+
<p>Note that many other distros/operating systems (including Arch Linux, *BSD and OS X) do not require such packages, as C headers are included with the base distribution of Python.</p>
127128
</div>
128129
</div>
129130
</div>
130131
<div class="panel panel-default">
131-
<div class="panel-heading" role="tab" id="headingPythonHeaders">
132-
<h4 class="panel-title"><a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapsePythonHeaders" aria-expanded="false" aria-controls="collapsePythonHeaders"><i class="fa fa-exclamation-triangle"></i> Error: Python.h not found</a></h4>
132+
<div class="panel-heading" role="tab" id="headingLxmlErrors">
133+
<h4 class="panel-title"><a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseLxmlErrors" aria-expanded="false" aria-controls="collapseLxmlErrors"><i class="fa fa-exclamation-triangle"></i> Error: missing libxml/libxslt</a></h4>
133134
</div>
134-
<div id="collapsePythonHeaders" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingPythonHeaders">
135+
<div id="collapseLxmlErrors" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingLxmlErrors">
135136
<div class="panel-body">
136-
<p>If you get an error to the effect of <code class="gs-code">Python.h not found</code>, you need to install development packages for Python.</p>
137+
<p>If you get errors about various files missing while compiling <code class="gs-code">lxml</code>, you must install headers for the <code class="gs-code">libxml</code>, <code class="gs-code">libxslt</code> and <code class="gs-code">zlib</code> libraries, like so:</p>
137138
<p>Debian systems:</p>
138139
<pre class="gs-console">
139-
<code># <span class="gs-root">sudo apt-get install python-dev</span></code>
140+
<code># <span class="gs-root">sudo apt-get install libxml2-dev libxslt1-dev zlib1g-dev</span></code>
140141
</pre>
141142
<p>Fedora 22+:</p>
142143
<pre class="gs-console">
143-
<code># <span class="gs-root">sudo dnf install python-devel</span></code>
144+
<code># <span class="gs-root">sudo dnf install libxml2-devel libxslt-devel zlib-devel</span></code>
144145
</pre>
145146
<p>Red Hat/CentOS/Fedora 21:</p>
146147
<pre class="gs-console">
147-
<code># <span class="gs-root">sudo yum install python-devel</span></code>
148+
<code># <span class="gs-root">sudo yum install libxml2-devel libxslt-devel zlib-devel</span></code>
148149
</pre>
149-
<p>Note that many other distros/operating systems (including Arch Linux, *BSD and OS X) do not require such packages, as C headers are included with the base distribution of Python.</p>
150+
</div>
151+
</div>
152+
</div>
153+
<div class="panel panel-default">
154+
<div class="panel-heading" role="tab" id="headingLxmlKilled">
155+
<h4 class="panel-title"><a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseLxmlKilled" aria-expanded="false" aria-controls="collapseLxmlKilled"><i class="fa fa-exclamation-triangle"></i> Error: gcc killed when compiling lxml</a></h4>
156+
</div>
157+
<div id="collapseLxmlKilled" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingLxmlKilled">
158+
<div class="panel-body">
159+
<p>If gcc/cc1 is killed when compiling lxml, you might not have enough RAM — lxml requires at least ~1.5 GB of RAM to compile. To fix this, you can:</p>
160+
<ul>
161+
<li>Install a system package and create your virtualenv with the <code class="gs-code">--system-site-packages</code></li>
162+
<li>Install a system package and symlink it from /usr/lib/pythonX.Y/site-packages to your virtualenv</li>
163+
<li>Use a temporary <a href="https://wiki.archlinux.org/index.php/Swap#Swap_file_creation">swapfile</a> to compile lxml</li>
164+
<li>Create a wheel on a system with more RAM with <code class="gs-code">STATIC_DEPS=true pip wheel lxml</code> (must have the same architecture) and install that instead</li>
150165
</div>
151166
</div>
152167
</div>

0 commit comments

Comments
 (0)
Please sign in to comment.