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
|
.. _silx-venv:
Installing silx in a virtualenv
===============================
This step-by-step guide explains how to install *silx* in a virtualenv.
Prerequisites
-------------
This guide assumes that your system meets the following requirements:
- a version of python compatible with *silx* is installed (python 2.7 or python >= 3.5)
- the *pip* installer for python packages is installed
- the Qt and PyQt libraries are installed (optional, required for using ``silx.gui``)
Installation procedure
----------------------
Install vitrualenv
******************
.. code-block:: bash
pip install virtualenv --user
.. note::
This step is not required for recent version of Python 3.
Virtual environments are created using a builtin standard library,
``venv``.
On Debian platforms, you might need to install the ``python3-venv``
package.
Create a virtualenv
*******************
The files required by a virtual environment are created in a new folder
with the same name as the virtualenv. So make sure you are in a directory
in which you have write permissions.
In this tutorial we use a folder ``venvs`` in our home directory, and we create
a virtual environment named ``silx_venv``
.. code-block:: bash
cd
mkdir -p venvs
cd venvs
virtualenv silx_venv
A virtualenv contains a copy of your default python interpreter with a few tools
to install packages (pip, setuptools).
To use a different python interpreter, you can specify it on the command line.
For example, to use python 3.4:
.. code-block:: bash
virtualenv -p /usr/bin/python3.4 silx_venv
But for python 3 you should use the builtin ``venv`` module:
.. code-block:: bash
python3 -m venv /path/to/new/virtual/environment
.. note::
If you don't need to start with a clean environment and you don't want
to install each required library one by one, you can use a command line
option to create a virtualenv with access to all system packages:
``--system-site-packages``
Activate a virtualenv
*********************
A script is provided in your virtualenv to activate it.
.. code-block:: bash
source silx_venv/bin/activate
After activating your new virtualenv, this python interpreter and its
package tools are used, instead of the ones from the system.
Any libraries you will install or upgrade will be inside the virtual
environment, and will not affect the rest of system.
To deactivate the virtual environment, just type ``deactivate``.
Upgrade pip
***********
After activating *silx_venv*, you should upgrade *pip*:
.. code-block:: bash
python -m pip install --upgrade pip
Upgrade setuptools and wheel
****************************
Upgrading the python packaging related libraries can make installing the
rest of the libraries much easier.
.. code-block:: bash
pip install setuptools --upgrade
pip install wheel --upgrade
Install build dependencies
**************************
The following command installs libraries that are required to build and
install *silx*:
.. code-block:: bash
pip install numpy cython
.. since 0.5, numpy is now automatically installed when doing `pip install silx`
Install optional dependencies
*****************************
The following command installs libraries that are needed by various modules
of *silx*:
.. code-block:: bash
pip install matplotlib fabio h5py
The next command installs libraries that are used by the python modules
handling parallel computing:
.. code-block:: bash
pip install pyopencl mako
Install pyqt
************
If your python version is 3.5 or newer, installing PyQt5 and all required packages
is as simple as typing:
.. code-block:: bash
pip install PyQt5
For previous versions of python, there are no PyQt wheels available, so the installation
is not as simple.
The simplest way, assuming that PyQt is installed on your system, is to use that
system package directly. For this, you need to add a symbolic link to your virtualenv.
If you want to use PyQt5 installed in ``/usr/lib/python2.7/dist-packages/``, type:
.. code-block:: bash
ln -s /usr/lib/python2.7/dist-packages/PyQt5 silx_venv/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/sip.so silx_venv/lib/python2.7/site-packages/
Install silx
************
.. code-block:: bash
pip install silx
To test *silx*, open an interactive python console. If you managed to install PyQt5 or PySide2
in your virtualenv, type:
.. code-block:: bash
python
If you don't have PyQt, use:
.. code-block:: bash
WITH_QT_TEST=False python
Run the test suite using:
>>> import silx.test
>>> silx.test.run_tests()
|