Project Installation

Version 206 (Paul Carensac, 08/09/2016 04:47 pm)

1 1 Etienne Pallier
h1. Project Installation
2 1 Etienne Pallier
3 6 Etienne Pallier
4 189 Etienne Pallier
This page describes the installation phase of the Pyros software
5 189 Etienne Pallier
6 189 Etienne Pallier
7 11 Etienne Pallier
Project Development page : [[Project Development]]
8 11 Etienne Pallier
9 6 Etienne Pallier
HOWTO Format Redmine Wiki : http://www.redmine.org/projects/redmine/wiki/FrRedmineWikiFormatting
10 6 Etienne Pallier
11 193 Etienne Pallier
{{toc}}
12 6 Etienne Pallier
13 6 Etienne Pallier
14 3 Etienne Pallier
---
15 3 Etienne Pallier
16 170 Etienne Pallier
---
17 170 Etienne Pallier
18 178 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}DATABASE SCHEMA (v0.2.1)%
19 4 Etienne Pallier
20 4 Etienne Pallier
21 192 Etienne Pallier
{{thumbnail(PYROS_PDM_v021.png, size=2000, title=Pyros data model)}}
22 4 Etienne Pallier
23 4 Etienne Pallier
24 4 Etienne Pallier
---
25 5 Etienne Pallier
26 170 Etienne Pallier
---
27 170 Etienne Pallier
28 177 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}I - PREREQUISITES%
29 177 Etienne Pallier
30 181 Paul Carensac
Pyros needs some prerequisites : 
31 177 Etienne Pallier
32 1 Etienne Pallier
* Python 3
33 181 Paul Carensac
* RabbitMQ
34 177 Etienne Pallier
* (optional) a Mysql Database server (but you can use Sqlite instead, with no installation)
35 177 Etienne Pallier
36 177 Etienne Pallier
37 177 Etienne Pallier
---
38 177 Etienne Pallier
39 177 Etienne Pallier
h3. Install Python3 + pip + virtualenv (only if necessary)
40 177 Etienne Pallier
41 177 Etienne Pallier
_If Python 3 is already installed on your computer, skip this section_
42 177 Etienne Pallier
43 177 Etienne Pallier
44 177 Etienne Pallier
 * Linux (CentOS 7.1, main target): (python35 not yet available as rpm)
45 177 Etienne Pallier
<pre>
46 177 Etienne Pallier
$ sudo yum update yum
47 177 Etienne Pallier
$ sudo yum update kernel
48 177 Etienne Pallier
$ sudo yum update
49 1 Etienne Pallier
50 1 Etienne Pallier
$ sudo yum install python34
51 1 Etienne Pallier
$ python3.4 -V
52 1 Etienne Pallier
Python 3.4.3
53 1 Etienne Pallier
54 1 Etienne Pallier
$ sudo yum install python34-devel
55 1 Etienne Pallier
(needed for python package mysqlclient)
56 1 Etienne Pallier
57 1 Etienne Pallier
$ sudo yum update python-setuptools
58 1 Etienne Pallier
$ easy_install --version
59 1 Etienne Pallier
setuptools 0.9.8
60 1 Etienne Pallier
$ sudo easy_install pip
61 1 Etienne Pallier
$ pip --version
62 1 Etienne Pallier
pip 8.1.1 from /usr/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg (python 2.7)
63 1 Etienne Pallier
64 1 Etienne Pallier
$ sudo pip install virtualenv
65 1 Etienne Pallier
$ virtualenv --version
66 1 Etienne Pallier
15.0.1
67 1 Etienne Pallier
68 1 Etienne Pallier
Necessary for "lxml" python package:
69 1 Etienne Pallier
$ sudo yum install libxml2 libxml2-devel
70 1 Etienne Pallier
$ sudo yum install libxslt libxslt-devel
71 1 Etienne Pallier
72 1 Etienne Pallier
</pre>
73 1 Etienne Pallier
74 1 Etienne Pallier
75 1 Etienne Pallier
 * Linux (Ubuntu) :
76 1 Etienne Pallier
<pre>
77 1 Etienne Pallier
$ sudo add-apt-repository ppa:fkrull/deadsnakes
78 1 Etienne Pallier
$ sudo apt-get update
79 1 Etienne Pallier
$ sudo apt-get install python3.5
80 1 Etienne Pallier
81 1 Etienne Pallier
$ sudo apt-get install python3.5-dev
82 1 Etienne Pallier
(needed for python package mysqlclient)
83 1 Etienne Pallier
84 1 Etienne Pallier
$ sudo pip install virtualenv
85 1 Etienne Pallier
</pre>
86 1 Etienne Pallier
87 1 Etienne Pallier
88 1 Etienne Pallier
 * Mac OS X :
89 1 Etienne Pallier
90 1 Etienne Pallier
  * From binary (Mac OS native application)
91 1 Etienne Pallier
(TODO:)
92 1 Etienne Pallier
93 1 Etienne Pallier
  * From MacPort
94 1 Etienne Pallier
95 1 Etienne Pallier
   * a) install macport
96 1 Etienne Pallier
(TODO:)
97 1 Etienne Pallier
98 1 Etienne Pallier
   * b) install the "port" python35
99 1 Etienne Pallier
<pre>
100 1 Etienne Pallier
$ sudo port install python35
101 1 Etienne Pallier
</pre>
102 1 Etienne Pallier
103 1 Etienne Pallier
104 202 Paul Carensac
 * Windows (tested with Windows 7 & 10) :
105 1 Etienne Pallier
<pre>
106 1 Etienne Pallier
Go to https://www.python.org/downloads/windows/ , choose the wanted version
107 1 Etienne Pallier
On the wanted version’s page, download Windows x86 executable installer
108 1 Etienne Pallier
109 1 Etienne Pallier
Run the executable
110 1 Etienne Pallier
    * On the first page, check "Add python3.5 to PATH"
111 1 Etienne Pallier
    * Choose "Install now" option
112 1 Etienne Pallier
113 1 Etienne Pallier
Open cmd (windows + R, cmd) :
114 1 Etienne Pallier
 $ python -m pip install --upgrade pip
115 1 Etienne Pallier
 $ pip install virtualenv
116 1 Etienne Pallier
</pre>
117 200 Paul Carensac
118 200 Paul Carensac
---
119 200 Paul Carensac
120 200 Paul Carensac
h3. Install a database server (only if necessary)
121 200 Paul Carensac
122 200 Paul Carensac
_If the MySql database server is already installed on your computer, skip this section_
123 200 Paul Carensac
124 200 Paul Carensac
By default, Pyros uses Mysql, but this implies that you have to install the Mysql database server...
125 200 Paul Carensac
126 200 Paul Carensac
Thus, to make things easier, avoid Mysql installation by using Sqlite instead as the database server (which will need no installation at all) :
127 200 Paul Carensac
128 200 Paul Carensac
=> *For this, just edit the file PYROS/src/pyros/settings.py and set MYSQL variable to False, and that's it. You can go to next section*
129 200 Paul Carensac
130 200 Paul Carensac
Now, if you really want to use Mysql (which is the default), you will need to install it (only if not already installed), so keep reading.
131 200 Paul Carensac
132 200 Paul Carensac
_(Skip this if you are using Sqlite instead of MySql)_
133 200 Paul Carensac
134 200 Paul Carensac
 * Linux Ubuntu
135 200 Paul Carensac
<pre>
136 200 Paul Carensac
First, update your system:
137 200 Paul Carensac
$ sudo apt-get update
138 200 Paul Carensac
139 200 Paul Carensac
$ sudo apt-get install mysql-server
140 200 Paul Carensac
$ sudo apt-get install mysql-client
141 200 Paul Carensac
142 200 Paul Carensac
$ sudo apt-get install libmysqlclient-dev
143 200 Paul Carensac
(needed for python package mysqlclient)
144 200 Paul Carensac
</pre>
145 200 Paul Carensac
146 200 Paul Carensac
 * Linux CentOS : cf https://www.howtoforge.com/apache_php_mysql_on_centos_7_lamp#-installing-mysql-
147 200 Paul Carensac
<pre>
148 200 Paul Carensac
First, update your system:
149 200 Paul Carensac
$ sudo yum update yum
150 200 Paul Carensac
$ sudo yum update kernel
151 200 Paul Carensac
$ sudo yum update
152 200 Paul Carensac
153 200 Paul Carensac
$ sudo yum install mariadb-server 
154 200 Paul Carensac
$ sudo yum install mariadb
155 200 Paul Carensac
156 200 Paul Carensac
$ sudo yum install mariadb-devel
157 200 Paul Carensac
(needed for python package mysqlclient)
158 200 Paul Carensac
159 200 Paul Carensac
$ sudo systemctl start mariadb.service
160 200 Paul Carensac
161 200 Paul Carensac
$ sudo systemctl enable mariadb.service
162 200 Paul Carensac
=> Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
163 200 Paul Carensac
164 200 Paul Carensac
$ sudo mysql_secure_installation
165 200 Paul Carensac
</pre>
166 200 Paul Carensac
167 200 Paul Carensac
 * Mac OS X
168 200 Paul Carensac
Install XAMPP
169 200 Paul Carensac
(but you could also use the pre-installed Mac OS MySql, or install MySql from macport)
170 200 Paul Carensac
<pre>
171 200 Paul Carensac
TODO:
172 200 Paul Carensac
</pre>
173 200 Paul Carensac
174 201 Paul Carensac
 * Windows (tested with Windows 7 & 10)
175 200 Paul Carensac
176 200 Paul Carensac
<pre>
177 200 Paul Carensac
Download and install the newest version on https://dev.mysql.com/downloads/installer/
178 200 Paul Carensac
179 200 Paul Carensac
Once installed, launch MySQL Installer. Clic on 'Add...' on the right.
180 200 Paul Carensac
In MySQLServers section, choose the newest, then clic on next.
181 200 Paul Carensac
Install and configure the server (just follow the installation guide).
182 200 Paul Carensac
183 200 Paul Carensac
Then launch mysql (via the Windows menu).
184 200 Paul Carensac
</pre>
185 200 Paul Carensac
186 177 Etienne Pallier
187 1 Etienne Pallier
---
188 181 Paul Carensac
189 181 Paul Carensac
h3. Install RabbitMQ
190 181 Paul Carensac
191 181 Paul Carensac
RabbitMQ is a message queue server used by Celery to handle tasks queues.
192 181 Paul Carensac
193 181 Paul Carensac
 * Ubuntu (the server is automatically started) :
194 181 Paul Carensac
<pre>
195 181 Paul Carensac
$ sudo apt-get install rabbitmq-server
196 181 Paul Carensac
</pre>
197 183 Paul Carensac
198 195 Etienne Pallier
 * CentOS :
199 195 Etienne Pallier
<pre>
200 195 Etienne Pallier
$ sudo yum install rabbitmq-server
201 196 Etienne Pallier
202 196 Etienne Pallier
Installation :
203 196 Etienne Pallier
 rabbitmq-server                                                           noarch                          3.3.5-17.el7
204 196 Etienne Pallier
Installation pour dépendances :
205 196 Etienne Pallier
 erlang-asn1                                                               x86_64                          R16B-03.16.el7
206 195 Etienne Pallier
</pre>
207 195 Etienne Pallier
208 183 Paul Carensac
 * MacOS :
209 183 Paul Carensac
<pre>
210 194 Etienne Pallier
With MacPort:
211 194 Etienne Pallier
$ sudo port install rabbitmq-server
212 194 Etienne Pallier
--->  Installing erlang @18.2.1_1+hipe+ssl
213 194 Etienne Pallier
...
214 194 Etienne Pallier
--->  Installing rabbitmq-server @3.5.7_0
215 194 Etienne Pallier
--->  Activating rabbitmq-server @3.5.7_0
216 194 Etienne Pallier
...
217 183 Paul Carensac
</pre>
218 183 Paul Carensac
219 183 Paul Carensac
 * Windows :
220 191 Paul Carensac
221 191 Paul Carensac
  * Take the wanted Erlang version at http://www.erlang.org/downloads and install it (required)
222 191 Paul Carensac
  * Take the wanted RabbitMQ version at https://www.rabbitmq.com/install-windows.html and install it. Then the server will run automatically
223 191 Paul Carensac
224 191 Paul Carensac
225 177 Etienne Pallier
226 177 Etienne Pallier
---
227 177 Etienne Pallier
228 179 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}II - GET THE PYROS SOFTWARE%
229 5 Etienne Pallier
230 125 Etienne Pallier
h3. Authenticate to https://gitlab.irap.omp.eu/epallier/pyros
231 125 Etienne Pallier
232 125 Etienne Pallier
In order to get this software, you must first authenticate on the IRAP gitlab.
233 125 Etienne Pallier
234 125 Etienne Pallier
For this, just go to https://gitlab.irap.omp.eu/epallier/pyros
235 125 Etienne Pallier
and either sign in with your LDAP account (if you are from IRAP),
236 125 Etienne Pallier
or register via the "Sign up" form.
237 5 Etienne Pallier
238 113 Etienne Pallier
h3. Software structure
239 5 Etienne Pallier
240 206 Paul Carensac
See [[Project_structure||Project Structure]] page.
241 1 Etienne Pallier
242 112 Etienne Pallier
h3. Browse the code (from gitlab)
243 111 Etienne Pallier
244 111 Etienne Pallier
https://gitlab.irap.omp.eu/epallier/pyros/tree/master
245 111 Etienne Pallier
246 203 Paul Carensac
h3. You can download it (static version, not synchronized)
247 111 Etienne Pallier
248 114 Etienne Pallier
You can download the current version of the software.
249 114 Etienne Pallier
250 115 Etienne Pallier
Go to https://gitlab.irap.omp.eu/epallier/pyros/tree/master
251 115 Etienne Pallier
252 115 Etienne Pallier
Click on "Download zip" on the up right hand corner.
253 115 Etienne Pallier
254 115 Etienne Pallier
Double-click on it to unzip it.
255 115 Etienne Pallier
256 115 Etienne Pallier
You should get a "pyros.git" folder.
257 115 Etienne Pallier
258 116 Etienne Pallier
In this documentation, this software folder will be referenced as "PYROS".
259 115 Etienne Pallier
260 118 Etienne Pallier
(you can rename "pyros.git" as "PYROS" if you want : "mv pyros.git PYROS")
261 114 Etienne Pallier
262 203 Paul Carensac
h3. (Windows developers only) : Get git for Windows
263 1 Etienne Pallier
264 203 Paul Carensac
 * Download git at https://git-scm.com/download/win
265 203 Paul Carensac
 * Run setup (keep default configurations)
266 203 Paul Carensac
 * Once installed, open cmd
267 203 Paul Carensac
<pre>
268 203 Paul Carensac
$ git config --global http.sslVerify false
269 203 Paul Carensac
</pre>
270 203 Paul Carensac
271 203 Paul Carensac
You can now use your git from the cmd or the graphic client !
272 203 Paul Carensac
273 203 Paul Carensac
h3. (Developers only) Get it from GIT (dynamic version, synchronized)
274 203 Paul Carensac
275 122 Etienne Pallier
(If you are using Windows, you must first get the git software, see below "Get git for Windows")
276 122 Etienne Pallier
277 114 Etienne Pallier
By getting the software from git, you will get a dynamically synchronized version,
278 114 Etienne Pallier
which means that you will be able to update your version as soon as a new version is available
279 114 Etienne Pallier
(with the command : "git pull").
280 111 Etienne Pallier
281 111 Etienne Pallier
* From Eclipse : See below, section "NOTES FOR ECLIPSE USERS"
282 111 Etienne Pallier
283 111 Etienne Pallier
* From the terminal
284 5 Etienne Pallier
285 5 Etienne Pallier
<pre>
286 5 Etienne Pallier
git clone https://gitlab.irap.omp.eu/epallier/pyros.git PYROS
287 1 Etienne Pallier
</pre>
288 86 Etienne Pallier
289 86 Etienne Pallier
_(or also : git clone git@gitlab.irap.omp.eu:epallier/pyros.git PYROS)_
290 5 Etienne Pallier
291 5 Etienne Pallier
If you ever get this error message :
292 1 Etienne Pallier
<pre>
293 1 Etienne Pallier
fatal: unable to access 'https://gitlab.irap.omp.eu/epallier/pyros.git/': Peer's certificate issuer has been marked as not trusted by the user.
294 122 Etienne Pallier
</pre>
295 122 Etienne Pallier
296 122 Etienne Pallier
Then, type this command (and then run again the git clone command):
297 121 Paul Carensac
<pre>
298 121 Paul Carensac
$ git config --global http.sslVerify false
299 121 Paul Carensac
</pre>
300 121 Paul Carensac
301 1 Etienne Pallier
(Also, the first time you get the project, it will ask you for a login and password)
302 121 Paul Carensac
303 168 Etienne Pallier
This creates a PYROS/ folder containing the project (with a .git/ subfolder for synchronization with the git repository)
304 168 Etienne Pallier
305 168 Etienne Pallier
306 169 Etienne Pallier
307 169 Etienne Pallier
308 169 Etienne Pallier
---
309 169 Etienne Pallier
310 169 Etienne Pallier
---
311 169 Etienne Pallier
312 186 Paul Carensac
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}III - INSTALLATION OF NEEDED PROJECT DEPENDENCIES%
313 166 Etienne Pallier
314 186 Paul Carensac
---
315 186 Paul Carensac
316 186 Paul Carensac
h3. Install Comet
317 186 Paul Carensac
318 186 Paul Carensac
Comet is a broker to receive and send VOEvents (https://github.com/jdswinbank/Comet/tree/py3)
319 187 Paul Carensac
You MUST have your virtualenv activated (*source venv_py3_pyros/bin/activate* in your 'private/' directory)
320 186 Paul Carensac
Documentation is available here : http://comet.readthedocs.io/en/stable/installation.html
321 186 Paul Carensac
322 186 Paul Carensac
 * Ubuntu :
323 186 Paul Carensac
324 186 Paul Carensac
<pre>
325 186 Paul Carensac
# You can do this anywhere on your computer
326 1 Etienne Pallier
$ git clone https://github.com/jdswinbank/Comet.git
327 1 Etienne Pallier
$ cd Comet
328 1 Etienne Pallier
$ (sudo ?) python setup.py install
329 1 Etienne Pallier
330 1 Etienne Pallier
# Now you can test it, no failure are expected, please contact the dev team for help
331 1 Etienne Pallier
$ trial comet
332 1 Etienne Pallier
</pre>
333 1 Etienne Pallier
334 1 Etienne Pallier
335 1 Etienne Pallier
 * MacOS :
336 1 Etienne Pallier
<pre>
337 1 Etienne Pallier
TODO:
338 1 Etienne Pallier
</pre>
339 1 Etienne Pallier
340 1 Etienne Pallier
 * Windows :
341 1 Etienne Pallier
<pre>
342 1 Etienne Pallier
TODO:
343 1 Etienne Pallier
</pre>
344 190 Paul Carensac
345 190 Paul Carensac
---
346 190 Paul Carensac
347 190 Paul Carensac
Install the needed Project dependencies and the database (within a Python virtual environment)
348 190 Paul Carensac
349 190 Paul Carensac
Go into the PYROS/install/ folder and Run the install_requirements.sh script.
350 190 Paul Carensac
351 190 Paul Carensac
(You will be prompted to enter a username, an email, and a password for the superuser)
352 190 Paul Carensac
353 190 Paul Carensac
* Mac and Linux:
354 190 Paul Carensac
<pre>
355 190 Paul Carensac
./install_requirements.sh
356 190 Paul Carensac
</pre>
357 190 Paul Carensac
358 190 Paul Carensac
* Windows:
359 190 Paul Carensac
<pre>
360 190 Paul Carensac
install_requirements_windows.bat
361 190 Paul Carensac
</pre>
362 190 Paul Carensac
363 190 Paul Carensac
_If something goes wrong, install manually each package (see section "MANUAL INSTALLATION OF PYTHON PACKAGES, ONE BY ONE")_
364 186 Paul Carensac
365 98 Etienne Pallier
366 9 Etienne Pallier
---
367 9 Etienne Pallier
368 9 Etienne Pallier
h3. (Eclipse only) Set the Python3 virtual environment as the project interpreter
369 9 Etienne Pallier
370 65 Etienne Pallier
See below, in section "NOTES FOR ECLIPSE USERS"
371 9 Etienne Pallier
372 1 Etienne Pallier
---
373 1 Etienne Pallier
374 170 Etienne Pallier
---
375 170 Etienne Pallier
376 17 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}IV - TEST%
377 17 Etienne Pallier
378 108 Etienne Pallier
379 90 Etienne Pallier
(Tests are classes declared in all apps' test.py file. The test classes inherit from django.test.TestCase)
380 17 Etienne Pallier
381 17 Etienne Pallier
You can run the tests suite, just to be sure that the software is well installed.
382 17 Etienne Pallier
383 19 Etienne Pallier
h3. From Terminal
384 19 Etienne Pallier
385 19 Etienne Pallier
386 1 Etienne Pallier
<pre>
387 1 Etienne Pallier
388 205 Paul Carensac
$ cd PYROS/src/scripts
389 20 Etienne Pallier
390 205 Paul Carensac
$ ./test_all_usual
391 94 Etienne Pallier
Ran 5 tests in 0.093s
392 21 Etienne Pallier
OK
393 17 Etienne Pallier
</pre>
394 19 Etienne Pallier
395 160 Paul Carensac
h3. From Eclipse
396 1 Etienne Pallier
397 77 Etienne Pallier
See below, in section "NOTES FOR ECLIPSE USERS"
398 25 Paul Carensac
399 25 Paul Carensac
400 160 Paul Carensac
h3. Custom commands
401 27 Paul Carensac
402 25 Paul Carensac
$ [./manage.py] test app.tests                           # Run tests for the application 'app'
403 25 Paul Carensac
$ [./manage.py] test app.tests.ModelTests                # Run test methods declared in the class app.tests.ModelTests
404 25 Paul Carensac
$ [./manage.py] test app.tests.ModelTests.test_method    # Only run the method test_method declared in app.tests.ModelTests
405 33 Etienne Pallier
406 33 Etienne Pallier
407 1 Etienne Pallier
---
408 1 Etienne Pallier
409 170 Etienne Pallier
---
410 170 Etienne Pallier
411 92 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}V - RUN%
412 75 Etienne Pallier
413 109 Etienne Pallier
414 75 Etienne Pallier
* From the terminal
415 75 Etienne Pallier
416 75 Etienne Pallier
<pre>
417 75 Etienne Pallier
418 95 Etienne Pallier
$ cd PYROS/
419 1 Etienne Pallier
420 158 Paul Carensac
$ ./pyrosrun server
421 93 Paul Carensac
</pre>
422 75 Etienne Pallier
423 158 Paul Carensac
Now, go to "http://localhost:8000/admin" in your browser
424 91 Etienne Pallier
425 158 Paul Carensac
(and login as "pyros" with the password 'DjangoPyros')
426 105 Etienne Pallier
427 91 Etienne Pallier
(Ctrl-c to stop)
428 91 Etienne Pallier
429 91 Etienne Pallier
430 75 Etienne Pallier
431 106 Etienne Pallier
* From Eclipse : see below, in section "NOTES FOR ECLIPSE USERS"
432 75 Etienne Pallier
433 75 Etienne Pallier
434 1 Etienne Pallier
---
435 1 Etienne Pallier
436 170 Etienne Pallier
---
437 170 Etienne Pallier
438 33 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}NOTES FOR ECLIPSE USERS%
439 35 Etienne Pallier
440 35 Etienne Pallier
0) Install Eclipse (if necessary)
441 35 Etienne Pallier
442 35 Etienne Pallier
Get the Eclipse version for Php
443 35 Etienne Pallier
444 35 Etienne Pallier
Install the plug-in pydev (via install new software, add http://pydev.org/updates)
445 35 Etienne Pallier
446 35 Etienne Pallier
Install the django template editor (via install new software, add http://eclipse.kacprzak.org/updates)
447 35 Etienne Pallier
448 35 Etienne Pallier
1) Deactivate CA certificate verification
449 35 Etienne Pallier
450 35 Etienne Pallier
Window -> Preferences -> Team -> git -> configuration -> Add entry
451 35 Etienne Pallier
452 35 Etienne Pallier
Key = http.sslVerify
453 35 Etienne Pallier
Value = false
454 35 Etienne Pallier
455 35 Etienne Pallier
2) Fetch the project
456 35 Etienne Pallier
457 35 Etienne Pallier
File/Import project from git
458 35 Etienne Pallier
459 35 Etienne Pallier
Select repository source: Clone URI: https://gitlab.irap.omp.eu/epallier/pyros.git
460 35 Etienne Pallier
461 35 Etienne Pallier
Directory: 
462 35 Etienne Pallier
par défaut, il propose : /Users/epallier/git/pyros
463 35 Etienne Pallier
mais on peut le mettre ailleurs (c'est ce que j'ai fait)
464 35 Etienne Pallier
465 35 Etienne Pallier
initial branch: master
466 35 Etienne Pallier
remote name: origin
467 35 Etienne Pallier
468 35 Etienne Pallier
Import as general project
469 35 Etienne Pallier
470 35 Etienne Pallier
Project name: PYROS
471 35 Etienne Pallier
472 35 Etienne Pallier
473 35 Etienne Pallier
3) Configure the project
474 35 Etienne Pallier
475 35 Etienne Pallier
The project is created. Now, you have to set it as a «PyDev » and a « Django » project.
476 35 Etienne Pallier
477 35 Etienne Pallier
clic droit sur le projet / PyDev / set as a PyDev project
478 35 Etienne Pallier
479 35 Etienne Pallier
clic droit sur le projet / PyDev / set as a Django project
480 35 Etienne Pallier
481 35 Etienne Pallier
clic droit sur le projet : on doit maintenant avoir un sous-menu Django
482 35 Etienne Pallier
483 35 Etienne Pallier
clic droit sur le dossier src / PyDev / set as source folder (add to PYTHONPATH)
484 35 Etienne Pallier
485 35 Etienne Pallier
clic droit sur projet / Properties / Pydev-Django :
486 35 Etienne Pallier
  - Django manage.py : src/manage.py
487 35 Etienne Pallier
  - Django settings module : pyros.settings
488 35 Etienne Pallier
489 35 Etienne Pallier
490 35 Etienne Pallier
4) Set Code style
491 35 Etienne Pallier
492 35 Etienne Pallier
Window/Preferences : Pydev / Editor
493 35 Etienne Pallier
- Auto Imports : uncheck « Do auto import »
494 35 Etienne Pallier
- Code style:
495 35 Etienne Pallier
	- Locals … : camelCase
496 35 Etienne Pallier
	- Methods : camelCase() with first lower
497 35 Etienne Pallier
- Code style / Code Formatter: activer « use autopep8.py for code formatting »
498 35 Etienne Pallier
- Tabs : Tab length : 4
499 35 Etienne Pallier
500 67 Etienne Pallier
5) Now, once the Python3 virtual environment is installed (see above),
501 66 Etienne Pallier
set it in Eclipse as the project interpreter:
502 66 Etienne Pallier
503 68 Etienne Pallier
Right clic on the project / Properties / PyDev - Interpreter/Grammar :
504 66 Etienne Pallier
Grammar version : 3
505 66 Etienne Pallier
506 66 Etienne Pallier
Interpreter : click on « click here to configure an interpreter not listed »
507 66 Etienne Pallier
508 66 Etienne Pallier
click on « New... » :
509 66 Etienne Pallier
- Interpreter name : venv_py35_pyros
510 66 Etienne Pallier
- Interpreter executable : click on « Browse »
511 66 Etienne Pallier
	Select your virtualenv python35 executable (private/venv_py35_pyros/bin/python3.5)
512 66 Etienne Pallier
	click OK
513 66 Etienne Pallier
514 66 Etienne Pallier
*Now, a last thing to do so that Pydev finds Django:*
515 66 Etienne Pallier
516 66 Etienne Pallier
In the Python interpreters list, select your virtual env (venv_py35_pyros)
517 66 Etienne Pallier
518 66 Etienne Pallier
Click on the tab "Libraries"
519 66 Etienne Pallier
520 66 Etienne Pallier
clic on 'New folder', then select your virtualenv's lib/python3.5/site-packages folder
521 66 Etienne Pallier
522 66 Etienne Pallier
OK
523 66 Etienne Pallier
524 66 Etienne Pallier
Interpreter: select now venv_py35_pyros from the list
525 66 Etienne Pallier
526 66 Etienne Pallier
OK
527 62 Etienne Pallier
528 78 Etienne Pallier
6) Test
529 1 Etienne Pallier
530 78 Etienne Pallier
* Right-clic on the project / Django / Run Django tests
531 78 Etienne Pallier
532 78 Etienne Pallier
* Right-clic on the project / Django / Custom command / ...
533 78 Etienne Pallier
534 78 Etienne Pallier
535 78 Etienne Pallier
7) Run
536 70 Etienne Pallier
537 70 Etienne Pallier
Right clic on project -> Django/Custom command/runserver
538 70 Etienne Pallier
539 70 Etienne Pallier
Error on Ubuntu :
540 70 Etienne Pallier
541 70 Etienne Pallier
<pre>
542 70 Etienne Pallier
543 70 Etienne Pallier
Traceback (most recent call last):
544 70 Etienne Pallier
  File "/home/carens_p/git/pyros/src/manage.py", line 8, in <module>
545 70 Etienne Pallier
    from django.core.management import execute_from_command_line
546 70 Etienne Pallier
ImportError: No module named 'django'
547 70 Etienne Pallier
548 70 Etienne Pallier
</pre>
549 70 Etienne Pallier
550 70 Etienne Pallier
Project -> Properties -> Pydev interpreter -> Clic here to configure an interpreter not listed
551 70 Etienne Pallier
552 70 Etienne Pallier
select venv_py35_pyros
553 70 Etienne Pallier
554 70 Etienne Pallier
In Libraries, clic on 'New folder', then select your virtualenv's lib/python3.5/site-packages folder.
555 70 Etienne Pallier
556 70 Etienne Pallier
OK -> re-select venv_py35_pyros in 'Interpreter' dropdown menu
557 70 Etienne Pallier
558 70 Etienne Pallier
Then right clic on project -> Django/Custom command/runserver
559 70 Etienne Pallier
560 70 Etienne Pallier
check http://localhost:8000/
561 70 Etienne Pallier
562 70 Etienne Pallier
563 62 Etienne Pallier
---
564 62 Etienne Pallier
565 62 Etienne Pallier
---
566 62 Etienne Pallier
567 81 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}MANUAL INSTALLATION OF PYTHON PACKAGES ONE BY ONE%
568 81 Etienne Pallier
569 172 Etienne Pallier
*Follow these steps only if the previous guided and nearly automatic installation did not work for you*
570 100 Etienne Pallier
571 172 Etienne Pallier
572 174 Etienne Pallier
h3. (Only if using Mysql) Create the database "pyros" and the pyros user
573 174 Etienne Pallier
574 174 Etienne Pallier
Only if you are using Mysql, you need to create an empty database "pyros"
575 174 Etienne Pallier
(which will be filled automatically by django)
576 174 Etienne Pallier
577 174 Etienne Pallier
<pre>
578 174 Etienne Pallier
$ mysql -u root -p
579 174 Etienne Pallier
(enter your root password)
580 174 Etienne Pallier
581 174 Etienne Pallier
$ mysql> create database if not exists pyros;
582 174 Etienne Pallier
</pre>
583 174 Etienne Pallier
584 174 Etienne Pallier
The user creation depends on your MySQL version :
585 174 Etienne Pallier
586 174 Etienne Pallier
 * 5.7 and above :
587 174 Etienne Pallier
<pre>
588 174 Etienne Pallier
$ mysql> DROP USER IF EXISTS pyros;
589 174 Etienne Pallier
$ mysql> CREATE USER 'pyros' IDENTIFIED BY 'DjangoPyros';
590 174 Etienne Pallier
$ mysql> GRANT ALL PRIVILEGES ON pyros.* TO pyros;
591 174 Etienne Pallier
</pre>
592 174 Etienne Pallier
593 174 Etienne Pallier
 * under 5.7 :
594 174 Etienne Pallier
<pre>
595 174 Etienne Pallier
$ mysql> GRANT USAGE ON *.* TO 'pyros';
596 174 Etienne Pallier
$ mysql> DROP USER 'pyros';
597 174 Etienne Pallier
$ mysql> CREATE USER 'pyros' IDENTIFIED BY 'DjangoPyros';
598 174 Etienne Pallier
$ mysql> GRANT ALL PRIVILEGES ON pyros.* TO pyros;
599 174 Etienne Pallier
</pre>
600 174 Etienne Pallier
601 174 Etienne Pallier
If none of these solution work, check on the internet to create a user named pyros with the password DjangoPyros.
602 174 Etienne Pallier
603 100 Etienne Pallier
h3. Create a Python3 virtual environment dedicated to the project (inside the project folder)
604 100 Etienne Pallier
605 100 Etienne Pallier
<pre>
606 100 Etienne Pallier
607 100 Etienne Pallier
$ mkdir private/
608 100 Etienne Pallier
609 100 Etienne Pallier
$ cd private/
610 100 Etienne Pallier
611 100 Etienne Pallier
$ which python3.5 ("where python" for windows)
612 100 Etienne Pallier
/opt/local/bin/python3.5
613 100 Etienne Pallier
614 100 Etienne Pallier
$ virtualenv venv_py35_pyros -p /opt/local/bin/python3.5
615 100 Etienne Pallier
=> creates a venv_py35_pyros/ folder inside PYROS/private/
616 100 Etienne Pallier
617 100 Etienne Pallier
</pre>
618 100 Etienne Pallier
619 100 Etienne Pallier
620 100 Etienne Pallier
---
621 100 Etienne Pallier
622 100 Etienne Pallier
h3. Activate the python virtual environment (from inside the project)
623 100 Etienne Pallier
624 100 Etienne Pallier
<pre>
625 100 Etienne Pallier
626 100 Etienne Pallier
$ pwd
627 100 Etienne Pallier
.../PYROS/private
628 100 Etienne Pallier
629 100 Etienne Pallier
$ source ./venv_py35_pyros/bin/activate (venv_py35_pyros/Scripts/activate on Windows)
630 100 Etienne Pallier
631 100 Etienne Pallier
</pre>
632 100 Etienne Pallier
633 100 Etienne Pallier
---
634 100 Etienne Pallier
635 100 Etienne Pallier
h3. Install needed python packages
636 100 Etienne Pallier
637 81 Etienne Pallier
Check that the virtual environment is activated
638 81 Etienne Pallier
<pre>
639 81 Etienne Pallier
$ python -V
640 81 Etienne Pallier
Python 3...
641 81 Etienne Pallier
642 81 Etienne Pallier
$ which pip
643 81 Etienne Pallier
.../PYROS/venv_py35_pyros/bin/pip
644 81 Etienne Pallier
</pre>
645 81 Etienne Pallier
646 81 Etienne Pallier
647 81 Etienne Pallier
Upgrade pip to last version available:
648 81 Etienne Pallier
<pre>
649 81 Etienne Pallier
$ pip install --upgrade pip
650 81 Etienne Pallier
Collecting pip
651 81 Etienne Pallier
  Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)
652 81 Etienne Pallier
Installing collected packages: pip
653 81 Etienne Pallier
  Found existing installation: pip 7.1.2
654 81 Etienne Pallier
    Uninstalling pip-7.1.2:
655 81 Etienne Pallier
      Successfully uninstalled pip-7.1.2
656 81 Etienne Pallier
Successfully installed pip-8.1.1
657 81 Etienne Pallier
658 81 Etienne Pallier
Upgrade wheel to last version available:
659 81 Etienne Pallier
$ pip install --upgrade wheel
660 81 Etienne Pallier
Collecting wheel
661 81 Etienne Pallier
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
662 81 Etienne Pallier
Installing collected packages: wheel
663 81 Etienne Pallier
  Found existing installation: wheel 0.24.0
664 81 Etienne Pallier
    Uninstalling wheel-0.24.0:
665 81 Etienne Pallier
      Successfully uninstalled wheel-0.24.0
666 81 Etienne Pallier
Successfully installed wheel-0.29.0
667 81 Etienne Pallier
668 81 Etienne Pallier
</pre>
669 81 Etienne Pallier
670 81 Etienne Pallier
Go into the install/ folder:
671 81 Etienne Pallier
<pre>
672 81 Etienne Pallier
$ cd .../PYROS/install/
673 81 Etienne Pallier
</pre>
674 81 Etienne Pallier
675 84 Etienne Pallier
Install all the needed python packages at once:
676 85 Etienne Pallier
<pre>
677 1 Etienne Pallier
$ pip install -r REQUIREMENTS.txt
678 85 Etienne Pallier
</pre>
679 84 Etienne Pallier
680 84 Etienne Pallier
If something goes wrong, install them one by one:
681 62 Etienne Pallier
682 62 Etienne Pallier
  * *Install Django* :
683 62 Etienne Pallier
<pre>
684 62 Etienne Pallier
$ pip install django
685 62 Etienne Pallier
Collecting django
686 62 Etienne Pallier
  Downloading Django-1.9.4-py2.py3-none-any.whl (6.6MB)
687 62 Etienne Pallier
Installing collected packages: django
688 62 Etienne Pallier
Successfully installed django-1.9.4
689 62 Etienne Pallier
690 62 Etienne Pallier
$ pip install django-admin-tools
691 62 Etienne Pallier
Collecting django-admin-tools
692 62 Etienne Pallier
  Downloading django_admin_tools-0.7.2-py2.py3-none-any.whl (289kB)
693 62 Etienne Pallier
Installing collected packages: django-admin-tools
694 62 Etienne Pallier
Successfully installed django-admin-tools-0.7.2
695 62 Etienne Pallier
696 62 Etienne Pallier
$ pip install django-debug-toolbar
697 62 Etienne Pallier
Collecting django-debug-toolbar
698 62 Etienne Pallier
  Downloading django_debug_toolbar-1.4-py2.py3-none-any.whl (212kB)
699 62 Etienne Pallier
Requirement already satisfied (use --upgrade to upgrade): Django>=1.7 in ./venv_py35_pyros/lib/python3.5/site-packages (from django-debug-toolbar)
700 62 Etienne Pallier
Collecting sqlparse (from django-debug-toolbar)
701 62 Etienne Pallier
  Downloading sqlparse-0.1.19.tar.gz (58kB)
702 62 Etienne Pallier
Building wheels for collected packages: sqlparse
703 62 Etienne Pallier
  Running setup.py bdist_wheel for sqlparse ... done
704 62 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/7b/d4/72/6011bb100dd5fc213164e4bbee13d4e03261dd54ce6a5de6b8
705 62 Etienne Pallier
Successfully built sqlparse
706 62 Etienne Pallier
Installing collected packages: sqlparse, django-debug-toolbar
707 62 Etienne Pallier
Successfully installed django-debug-toolbar-1.4 sqlparse-0.1.19
708 62 Etienne Pallier
709 62 Etienne Pallier
$ pip install django-extensions
710 62 Etienne Pallier
Collecting django-extensions
711 62 Etienne Pallier
  Downloading django_extensions-1.6.1-py2.py3-none-any.whl (202kB)
712 62 Etienne Pallier
Collecting six>=1.2 (from django-extensions)
713 62 Etienne Pallier
  Downloading six-1.10.0-py2.py3-none-any.whl
714 62 Etienne Pallier
Installing collected packages: six, django-extensions
715 62 Etienne Pallier
Successfully installed django-extensions-1.6.1 six-1.10.0
716 62 Etienne Pallier
717 62 Etienne Pallier
$ pip install django-suit
718 62 Etienne Pallier
Collecting django-suit
719 62 Etienne Pallier
  Downloading django-suit-0.2.18.tar.gz (587kB)
720 62 Etienne Pallier
Building wheels for collected packages: django-suit
721 62 Etienne Pallier
  Running setup.py bdist_wheel for django-suit ... done
722 62 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/12/8b/9a/e02ab0ad9229881638aa040d47d77c8f562999533811927d41
723 62 Etienne Pallier
Successfully built django-suit
724 62 Etienne Pallier
Installing collected packages: django-suit
725 62 Etienne Pallier
Successfully installed django-suit-0.2.18
726 62 Etienne Pallier
727 62 Etienne Pallier
</pre>
728 62 Etienne Pallier
729 62 Etienne Pallier
  * *Install the django boostrap css package* :
730 62 Etienne Pallier
<pre>
731 62 Etienne Pallier
$ pip install django-bootstrap3
732 62 Etienne Pallier
</pre>
733 62 Etienne Pallier
(==> 'bootstrap3' is then to be added as an application in settings.py -> INSTALLED_APPS)
734 62 Etienne Pallier
735 62 Etienne Pallier
  * *Install the web application server gunicorn (will be used in production instead of the dev django web server)* :
736 62 Etienne Pallier
<pre>
737 62 Etienne Pallier
$ pip install gunicorn
738 62 Etienne Pallier
Collecting gunicorn
739 62 Etienne Pallier
  Downloading gunicorn-19.4.5-py2.py3-none-any.whl (112kB)
740 62 Etienne Pallier
Installing collected packages: gunicorn
741 62 Etienne Pallier
Successfully installed gunicorn-19.4.5
742 62 Etienne Pallier
</pre>
743 62 Etienne Pallier
744 62 Etienne Pallier
  * *Install the python mysql client* (not needed if you want to use sqlite):
745 62 Etienne Pallier
<pre>
746 62 Etienne Pallier
$ pip install mysqlclient
747 62 Etienne Pallier
...
748 62 Etienne Pallier
</pre>
749 62 Etienne Pallier
750 146 Etienne Pallier
   * => If issue under Mac OS X:
751 62 Etienne Pallier
<pre>
752 62 Etienne Pallier
$ pip install mysqlclient
753 62 Etienne Pallier
Collecting mysqlclient
754 62 Etienne Pallier
  Downloading mysqlclient-1.3.7.tar.gz (79kB)
755 62 Etienne Pallier
Building wheels for collected packages: mysqlclient
756 62 Etienne Pallier
  Running setup.py bdist_wheel for mysqlclient ... error
757 62 Etienne Pallier
758 62 Etienne Pallier
  ----------------------------------------
759 62 Etienne Pallier
  Failed building wheel for mysqlclient
760 62 Etienne Pallier
  Running setup.py clean for mysqlclient
761 62 Etienne Pallier
Failed to build mysqlclient
762 62 Etienne Pallier
Installing collected packages: mysqlclient
763 62 Etienne Pallier
  Running setup.py install for mysqlclient ... done
764 62 Etienne Pallier
Successfully installed mysqlclient-1.3.7
765 62 Etienne Pallier
766 62 Etienne Pallier
BOUH !!!
767 1 Etienne Pallier
768 152 Etienne Pallier
=> Need to upgrade wheel:
769 146 Etienne Pallier
770 62 Etienne Pallier
$ pip install --upgrade wheel
771 62 Etienne Pallier
Collecting wheel
772 62 Etienne Pallier
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
773 62 Etienne Pallier
Installing collected packages: wheel
774 62 Etienne Pallier
  Found existing installation: wheel 0.24.0
775 62 Etienne Pallier
    Uninstalling wheel-0.24.0:
776 62 Etienne Pallier
      Successfully uninstalled wheel-0.24.0
777 62 Etienne Pallier
Successfully installed wheel-0.29.0
778 62 Etienne Pallier
779 153 Etienne Pallier
YES !!!
780 1 Etienne Pallier
781 154 Etienne Pallier
Only if necessary, you can reinstall mysqlclient:
782 153 Etienne Pallier
$ pip uninstall mysqlclient
783 62 Etienne Pallier
$ pip install mysqlclient
784 62 Etienne Pallier
Collecting mysqlclient
785 62 Etienne Pallier
  Using cached mysqlclient-1.3.7.tar.gz
786 62 Etienne Pallier
Building wheels for collected packages: mysqlclient
787 62 Etienne Pallier
  Running setup.py bdist_wheel for mysqlclient ... done
788 62 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/9b/06/50/d11418c26cf8f2156b13d4363b5afde8e7e75ebb8540d0228d
789 62 Etienne Pallier
Successfully built mysqlclient
790 62 Etienne Pallier
Installing collected packages: mysqlclient
791 62 Etienne Pallier
Successfully installed mysqlclient-1.3.7
792 62 Etienne Pallier
793 1 Etienne Pallier
</pre>
794 62 Etienne Pallier
795 146 Etienne Pallier
   * => If issue under Windows
796 62 Etienne Pallier
<pre>
797 62 Etienne Pallier
Same message as the issue for Mac.
798 146 Etienne Pallier
799 204 Paul Carensac
=> Need to install wheel manually :
800 62 Etienne Pallier
801 62 Etienne Pallier
Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient to download the newest mysqlclient wheel
802 62 Etienne Pallier
803 62 Etienne Pallier
$ pip install path\to\mysqlclient\wheel
804 62 Etienne Pallier
805 154 Etienne Pallier
(No need to redo "pip install mysqlclient")
806 62 Etienne Pallier
</pre>
807 163 Paul Carensac
808 163 Paul Carensac
  * *Install the julian day converter* :
809 163 Paul Carensac
<pre>
810 163 Paul Carensac
$ pip install jdcal
811 163 Paul Carensac
</pre>
812 182 Paul Carensac
813 188 Paul Carensac
  * *Install Celery and dependencies* :
814 182 Paul Carensac
<pre>
815 182 Paul Carensac
$ pip install celery
816 1 Etienne Pallier
$ pip install django-celery
817 188 Paul Carensac
$ pip install Twisted==16.0.0
818 188 Paul Carensac
</pre>
819 188 Paul Carensac
820 188 Paul Carensac
  * *Install django test without migrations (compulsory to use the prod DB for tests)* :
821 188 Paul Carensac
<pre>
822 188 Paul Carensac
$ pip install django-test-without-migrations==0.4
823 188 Paul Carensac
</pre>
824 188 Paul Carensac
825 188 Paul Carensac
  * *Install voevent parser* :
826 188 Paul Carensac
<pre>
827 188 Paul Carensac
$ pip install voevent-parse==0.9.5
828 188 Paul Carensac
</pre>
829 188 Paul Carensac
830 188 Paul Carensac
831 188 Paul Carensac
  * *Install other dependencies (useful ? TBC)* :
832 188 Paul Carensac
<pre>
833 188 Paul Carensac
$ pip install amqplib==1.0.2
834 188 Paul Carensac
$ pip install pluggy==0.3.1
835 188 Paul Carensac
$ pip install py==1.4.31
836 182 Paul Carensac
</pre>