Debian Codegraph @

sites/www/installing-1.x.rst

raw
1 ================
2 Installing (1.x)
3 ================
4
5 .. note:: Installing Paramiko 2.0 or above? See :doc:`installing` instead.
6
7 This document includes legacy notes on installing Paramiko 1.x (specifically,
8 1.13 and up). Users are strongly encouraged to upgrade to 2.0 when possible;
9 PyCrypto (the dependency covered below) is no longer maintained and contains
10 security vulnerabilities.
11
12 General install notes
13 =====================
14
15 * Python 2.6+ and 3.3+ are supported; Python <=2.5 and 3.0-3.2 are **not
16 supported**.
17 * See the note in the main install doc about :ref:`release-lines` for details
18 on specific versions you may want to install.
19
20 .. note:: 1.x will eventually be entirely end-of-lifed.
21 * Paramiko 1.7-1.14 have only one dependency: :ref:`pycrypto`.
22 * Paramiko 1.15+ (not including 2.x and above) add a second, pure-Python
23 dependency: the ``ecdsa`` module, trivially installable via PyPI.
24 * Paramiko 1.15+ (again, not including 2.x and up) also allows you to
25 optionally install a few more dependencies to gain support for
26 :ref:`GSS-API/Kerberos <gssapi-on-1x>`.
27 * Users on Windows may want to opt for the :ref:`pypm` approach.
28
29
30 .. _pycrypto:
31
32 PyCrypto
33 ========
34
35 `PyCrypto <https://www.dlitz.net/software/pycrypto/>`__ provides the low-level
36 (C-based) encryption algorithms we need to implement the SSH protocol. There
37 are a couple gotchas associated with installing PyCrypto: its compatibility
38 with Python's package tools, and the fact that it is a C-based extension.
39
40 C extension
41 -----------
42
43 Unless you are installing from a precompiled source such as a Debian apt
44 repository or RedHat RPM, or using :ref:`pypm <pypm>`, you will also need the
45 ability to build Python C-based modules from source in order to install
46 PyCrypto. Users on **Unix-based platforms** such as Ubuntu or Mac OS X will
47 need the traditional C build toolchain installed (e.g. Developer Tools / XCode
48 Tools on the Mac, or the ``build-essential`` package on Ubuntu or Debian Linux
49 -- basically, anything with ``gcc``, ``make`` and so forth) as well as the
50 Python development libraries, often named ``python-dev`` or similar.
51
52 Slow vs fast crypto math
53 ~~~~~~~~~~~~~~~~~~~~~~~~
54
55 PyCrypto attempts to use the ``gmp`` C math library if it is present on your
56 system, which enables what it internally calls "fastmath" (``_fastmath.so``).
57 When those headers are not available, it falls back to "slowmath"
58 (``_slowmath.py``) which is a pure-Python implementation.
59
60 Real-world tests have shown significant benefits to using the C version of this
61 code; thus we strongly recommend you install the ``gmp`` development headers
62 **before** installing Paramiko/PyCrypto. E.g.::
63
64 $ apt-get install libgmp-dev # or just apt
65 $ yum install gmp-devel # or dnf
66 $ brew install gmp
67
68 If you're unsure which version of math you've ended up with, a quick way to
69 check is to examine whether ``_fastmath.so`` or ``_slowmath.py`` appears in the
70 output of::
71
72 from Crypto.PublicKey import RSA
73 print(RSA._impl._math)
74
75 Windows
76 ~~~~~~~
77
78 For **Windows** users we recommend using :ref:`pypm`, installing a C
79 development environment such as `Cygwin <http://cygwin.com>`_ or obtaining a
80 precompiled Win32 PyCrypto package from `voidspace's Python modules page
81 <http://www.voidspace.org.uk/python/modules.shtml#pycrypto>`_.
82
83 .. note::
84 Some Windows users whose Python is 64-bit have found that the PyCrypto
85 dependency ``winrandom`` may not install properly, leading to ImportErrors.
86 In this scenario, you'll probably need to compile ``winrandom`` yourself
87 via e.g. MS Visual Studio. See `Fabric #194
88 <https://github.com/fabric/fabric/issues/194>`_ for info.
89
90
91 .. _pypm:
92
93 ActivePython and PyPM
94 =====================
95
96 Windows users who already have ActiveState's `ActivePython
97 <http://www.activestate.com/activepython/downloads>`_ distribution installed
98 may find Paramiko is best installed with `its package manager, PyPM
99 <http://code.activestate.com/pypm/>`_. Below is example output from an
100 installation of Paramiko via ``pypm``::
101
102 C:\> pypm install paramiko
103 The following packages will be installed into "%APPDATA%\Python" (2.7):
104 paramiko-1.7.8 pycrypto-2.4
105 Get: [pypm-free.activestate.com] paramiko 1.7.8
106 Get: [pypm-free.activestate.com] pycrypto 2.4
107 Installing paramiko-1.7.8
108 Installing pycrypto-2.4
109 C:\>
110
111
112 .. _gssapi-on-1x:
113
114 Optional dependencies for GSS-API / SSPI / Kerberos
115 ===================================================
116
117 First, see the main install doc's notes: :ref:`gssapi` - everything there is
118 required for Paramiko 1.x as well.
119
120 Additionally, users of Paramiko 1.x, on all platforms, need a final dependency:
121 `pyasn1 <https://pypi.org/project/pyasn1/>`_ ``0.1.7`` or better.