retire ofswiki
[iankelling.org] / _site / technical-notes / setup.py-uninstall.html
diff --git a/_site/technical-notes/setup.py-uninstall.html b/_site/technical-notes/setup.py-uninstall.html
new file mode 100644 (file)
index 0000000..5c87018
--- /dev/null
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <title>setup.py uninstall</title>
+    <link rel="stylesheet" href="/css/main.css">
+    <link rel="shortcut icon" href="/assets/favicon.png" />
+    <meta name="description" content="Ian Kelling's personal site and blog on software">
+<link rel="canonical" href="https://iankelling.org//technical-notes/setup.py-uninstall.html">
+
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+  </head>
+  <body>
+    <header class="page_header">
+      <h3><a href="/">iankelling.org</a> / <a href="/technical-notes.html">technical notes</a> /</h3>
+    </header>
+    <div class="main-content-stripe">
+      <div class="prose">
+        <h1>setup.py uninstall</h1><b>Contents</b><ul>
+<li>
+<a href="#unix-like">Unix-like</a>
+</li>
+<li>
+<a href="#windows">Windows</a>
+</li>
+<li>
+<a href="#use-other-methods-which-fully-support-uninstall-when-available">Use other methods which fully support uninstall when available</a>
+</li>
+</ul>
+<h2 id="unix-like">Unix-like</h2>
+
+<p>Install over the existing installation with the same sources, recording installed files, then delete them.</p>
+<div class="highlight"><pre>sudo python setup.py install --record files.txt
+<span class="c1"># inspect files.txt to make sure it looks ok. Then in bash:</span>
+tr <span class="s1">&#39;\n&#39;</span> <span class="s1">&#39;\0&#39;</span> &lt; files.txt <span class="p">|</span> xargs -0 sudo rm -f --
+</pre></div>
+<h2 id="windows">Windows</h2>
+
+<p>Install on top of the existing installation with a windows installer, then add-remove programs to uninstall.</p>
+<div class="highlight"><pre>python setup.py bdist_wininst
+dist/foo-1.0.win32.exe
+</pre></div>
+<h2 id="use-other-methods-which-fully-support-uninstall-when-available">Use other methods which fully support uninstall when available</h2>
+
+<p>Uninstalling setup.py install has some <em>inherent problems</em>, which usually aren&#39;t a problem:</p>
+
+<ul>
+<li>Files which a different package also depends on will be removed by uninstall</li>
+<li>Can&#39;t remove installed directories. --record only records non-directory files.</li>
+<li>If a file is installed which includes a newline, the command this page
+recommends will fail. This won&#39;t happen except for a rare bug or a
+malicious program. We could overcome this by using bdist_dumb, then
+removing the files found in the archive which that command
+builds. However, I&#39;m no more confident of that command not having a
+bug or edge case in which it would produce different files than a
+normal install than I am of a package having a file with a newline in
+it.</li>
+</ul>
+
+<h3 id="alternatives">Alternatives</h3>
+
+<ul>
+<li>pip</li>
+<li>python setup.py install bdist_rpm</li>
+<li>python setup.py bdist_wininst</li>
+<li><a href="https://packaging.python.org/">official python recommendations</a></li>
+</ul>
+
+<p>This page is also at <a href="http://stackoverflow.com/a/25209129/14456">stackoverflow answer</a>.</p>
+
+<p>TODO: contribute this under https://wiki.python.org/moin/Distutils/Cookbook.</p>
+
+      </div>
+    </div>
+    <div class="comment-stripe">
+
+    </div>
+    <footer>
+
+      <p>Sources in <a href="/git/?p=iankelling.org;a=summary">git</a>. Mostly markdown files. Default is <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img class="cc-by-sa" alt="Creative Commons License" src="/assets/cc-by-sa-4.0-80x15.png" /></a></p>
+      <p><address><a href="mailto:ian@iankelling.org">ian@iankelling.org</a> let me know what you think</address></p>
+    </footer>
+  </body>
+</html>