Project Installation

Version 358 (Etienne Pallier, 01/12/2018 06:13 pm)

1 1 Etienne Pallier
h1. Project Installation
2 1 Etienne Pallier
3 270 Etienne Pallier
This page describes the installation phase of the Pyros software.
4 1 Etienne Pallier
5 314 Etienne Pallier
If you want access to the ETC-IS-VC software, go to this page : https://projects.irap.omp.eu/projects/gft-etc-is/wiki
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 221 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}DATABASE SCHEMA (v0.2.2)%
19 4 Etienne Pallier
20 4 Etienne Pallier
21 222 Etienne Pallier
{{thumbnail(PYROS_DBM_V0_2_2.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 226 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}COMPATIBLE PLATFORMS (TESTED)%
29 226 Etienne Pallier
30 253 Jeremy Barneron
This software is targetted first for Linux CentOS 7 (+ Fedora and Ubuntu), but also for Mac OS X and Windows.
31 231 Etienne Pallier
All these systems should run Python 3 (3.5+)
32 226 Etienne Pallier
33 227 Etienne Pallier
Pyros has been tested on these platforms:
34 226 Etienne Pallier
35 232 Etienne Pallier
* CentOS 7.1 (with Python 3.4)
36 235 Paul Carensac
* Linux Mint 17.2 ( == Ubuntu 14.04.3) (with Python 3.5)
37 254 Jeremy Barneron
* Ubuntu 16.04 (with python 3.5.2)
38 232 Etienne Pallier
* Mac OS 10.11.6 (with Python 3.5)
39 232 Etienne Pallier
* Windows 10 (with Python 3.5)
40 226 Etienne Pallier
41 287 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}I - GET THE PYROS SOFTWARE%
42 5 Etienne Pallier
43 274 Etienne Pallier
h3. A. Authenticate to the gitlab
44 125 Etienne Pallier
45 273 Etienne Pallier
In order to get this software, you must first authenticate on the IRAP gitlab https://gitlab.irap.omp.eu/epallier/pyros
46 125 Etienne Pallier
47 125 Etienne Pallier
For this, just go to https://gitlab.irap.omp.eu/epallier/pyros
48 125 Etienne Pallier
and either sign in with your LDAP account (if you are from IRAP),
49 125 Etienne Pallier
or register via the "Sign up" form.
50 5 Etienne Pallier
51 279 Etienne Pallier
---
52 279 Etienne Pallier
53 315 Etienne Pallier
h3. B. Get the software
54 1 Etienne Pallier
55 114 Etienne Pallier
56 1 Etienne Pallier
* *DYNAMIC VERSION (Developers) : Get a dynamic version (synchronized) :*
57 203 Paul Carensac
58 321 Etienne Pallier
_If do not want to contribute to this project but just want to try it, you can download a STATIC version of it : go to next section "STATIC VERSION"_
59 321 Etienne Pallier
60 323 Etienne Pallier
_*Windows users : you first need to get the GIT software (see below, section C)*_
61 122 Etienne Pallier
62 114 Etienne Pallier
By getting the software from git, you will get a dynamically synchronized version,
63 114 Etienne Pallier
which means that you will be able to update your version as soon as a new version is available
64 114 Etienne Pallier
(with the command : "git pull").
65 111 Etienne Pallier
66 283 Etienne Pallier
_From Eclipse : See below, section "NOTES FOR ECLIPSE USERS"_
67 111 Etienne Pallier
68 283 Etienne Pallier
From the terminal :
69 5 Etienne Pallier
70 5 Etienne Pallier
<pre>
71 5 Etienne Pallier
git clone https://gitlab.irap.omp.eu/epallier/pyros.git PYROS
72 1 Etienne Pallier
</pre>
73 86 Etienne Pallier
74 86 Etienne Pallier
_(or also : git clone git@gitlab.irap.omp.eu:epallier/pyros.git PYROS)_
75 5 Etienne Pallier
76 5 Etienne Pallier
If you ever get this error message :
77 1 Etienne Pallier
<pre>
78 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.
79 1 Etienne Pallier
</pre>
80 1 Etienne Pallier
81 1 Etienne Pallier
Then, type this command (and then run again the git clone command):
82 1 Etienne Pallier
<pre>
83 1 Etienne Pallier
$ git config --global http.sslVerify false
84 1 Etienne Pallier
</pre>
85 1 Etienne Pallier
86 1 Etienne Pallier
(Also, the first time you get the project, it will ask you for a login and password)
87 1 Etienne Pallier
88 1 Etienne Pallier
This creates a PYROS/ folder containing the project (with a .git/ subfolder for synchronization with the git repository)
89 1 Etienne Pallier
90 341 Etienne Pallier
By default, you are on the "master" branch :
91 342 Etienne Pallier
<pre>
92 1 Etienne Pallier
$ git branch
93 342 Etienne Pallier
*  master
94 342 Etienne Pallier
</pre>
95 341 Etienne Pallier
96 341 Etienne Pallier
You should NEVER do any modification directly on this branch, so instead jump to the "dev" branch :
97 342 Etienne Pallier
<pre>
98 340 Etienne Pallier
$ git checkout dev
99 340 Etienne Pallier
$ git branch
100 342 Etienne Pallier
* dev
101 342 Etienne Pallier
  master
102 342 Etienne Pallier
</pre>
103 340 Etienne Pallier
104 340 Etienne Pallier
105 321 Etienne Pallier
106 321 Etienne Pallier
* *STATIC VERSION (Non developers) : Download a static version (not synchronized) :*
107 321 Etienne Pallier
108 321 Etienne Pallier
Go to https://gitlab.irap.omp.eu/epallier/pyros/tree/master
109 321 Etienne Pallier
110 321 Etienne Pallier
Click on "Download zip" on the up right hand corner.
111 321 Etienne Pallier
112 321 Etienne Pallier
Double-click on it to unzip it.
113 321 Etienne Pallier
114 321 Etienne Pallier
You should get a "pyros.git" folder.
115 321 Etienne Pallier
116 321 Etienne Pallier
In this documentation, this software folder will be referenced as "PYROS".
117 1 Etienne Pallier
118 321 Etienne Pallier
(you can rename "pyros.git" as "PYROS" if you want : "mv pyros.git PYROS")
119 322 Etienne Pallier
120 279 Etienne Pallier
---
121 273 Etienne Pallier
122 315 Etienne Pallier
h3. C. For WINDOWS users
123 273 Etienne Pallier
124 273 Etienne Pallier
 * Download git at https://git-scm.com/download/win
125 273 Etienne Pallier
 * Run setup (keep default configurations)
126 273 Etienne Pallier
 * Once installed, open cmd
127 273 Etienne Pallier
<pre>
128 273 Etienne Pallier
$ git config --global http.sslVerify false
129 273 Etienne Pallier
</pre>
130 273 Etienne Pallier
131 1 Etienne Pallier
You can now use your git from the cmd or the graphic client !
132 287 Etienne Pallier
133 287 Etienne Pallier
134 287 Etienne Pallier
---
135 317 Etienne Pallier
136 318 Etienne Pallier
h3. D. Miscellaneous
137 1 Etienne Pallier
138 318 Etienne Pallier
You can browse the code from gitlab :
139 318 Etienne Pallier
140 1 Etienne Pallier
https://gitlab.irap.omp.eu/epallier/pyros/tree/master
141 1 Etienne Pallier
142 318 Etienne Pallier
More information about the project structure :
143 316 Etienne Pallier
144 318 Etienne Pallier
See [[Project_structure|Project Structure]] page
145 316 Etienne Pallier
146 290 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}II - INSTALLATION OF PREREQUISITES%
147 287 Etienne Pallier
148 287 Etienne Pallier
Pyros needs some prerequisites : 
149 1 Etienne Pallier
150 319 Etienne Pallier
* Python 3.5+ (3.6 recommended)
151 287 Etienne Pallier
* RabbitMQ
152 324 Etienne Pallier
* Mysql Database server
153 287 Etienne Pallier
154 287 Etienne Pallier
155 287 Etienne Pallier
---
156 287 Etienne Pallier
157 289 Etienne Pallier
h3. A. Install Python3 (3.5+) + pip
158 1 Etienne Pallier
159 288 Etienne Pallier
@todo: remplacer virtualenv par le module python "venv" (utilisation: python3 -m venv nom_du_venv) : https://docs.python.org/3/library/venv.html
160 288 Etienne Pallier
161 287 Etienne Pallier
_If Python 3 is already installed on your computer, skip this section_
162 287 Etienne Pallier
163 287 Etienne Pallier
164 287 Etienne Pallier
 * Linux (CentOS 7.1, main target): (python35 not yet available as rpm)
165 287 Etienne Pallier
<pre>
166 287 Etienne Pallier
$ sudo yum update yum
167 287 Etienne Pallier
$ sudo yum update kernel
168 287 Etienne Pallier
$ sudo yum update
169 311 Quentin Durand
$ sudo yum update
170 310 Quentin Durand
$ sudo yum install yum-utils
171 310 Quentin Durand
$ sudo yum groupinstall development
172 310 Quentin Durand
$ sudo yum install https://centos7.iuscommunity.org/ius-release.rpm
173 1 Etienne Pallier
$ sudo yum install python34
174 310 Quentin Durand
175 287 Etienne Pallier
$ python3.4 -V
176 287 Etienne Pallier
Python 3.4.3
177 287 Etienne Pallier
178 287 Etienne Pallier
$ sudo yum install python34-devel
179 287 Etienne Pallier
(needed for python package mysqlclient)
180 1 Etienne Pallier
181 310 Quentin Durand
((
182 310 Quentin Durand
NO MORE NECESSARY:
183 287 Etienne Pallier
$ sudo yum update python-setuptools
184 287 Etienne Pallier
$ easy_install --version 
185 287 Etienne Pallier
setuptools 0.9.8
186 287 Etienne Pallier
$ sudo easy_install pip
187 1 Etienne Pallier
$ pip --version
188 288 Etienne Pallier
pip 8.1.1 from /usr/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg (python 2.7)
189 288 Etienne Pallier
190 288 Etienne Pallier
$ sudo pip install --upgrade pip
191 287 Etienne Pallier
$ sudo pip install --upgrade virtualenv
192 287 Etienne Pallier
$ virtualenv --version
193 1 Etienne Pallier
15.0.1
194 288 Etienne Pallier
))
195 287 Etienne Pallier
196 287 Etienne Pallier
Necessary for "lxml" python package:
197 287 Etienne Pallier
$ sudo yum install libxml2 libxml2-devel
198 287 Etienne Pallier
$ sudo yum install libxslt libxslt-devel
199 287 Etienne Pallier
200 309 Quentin Durand
201 287 Etienne Pallier
</pre>
202 287 Etienne Pallier
203 287 Etienne Pallier
204 287 Etienne Pallier
 * Linux (Ubuntu) :
205 287 Etienne Pallier
<pre>
206 287 Etienne Pallier
$ sudo add-apt-repository ppa:fkrull/deadsnakes
207 287 Etienne Pallier
$ sudo apt-get update
208 287 Etienne Pallier
$ sudo apt-get install python3.5
209 301 Quentin Durand
$ sudo apt-get install python3.5-dev
210 301 Quentin Durand
(needed for python package mysqlclient && lxml)
211 287 Etienne Pallier
$ sudo apt-get install libxml2-dev
212 287 Etienne Pallier
$ sudo apt-get install libxslt-dev
213 309 Quentin Durand
$ sudo apt-get install zlib1g-dev can be required too
214 287 Etienne Pallier
$ sudo apt-get install python-pip
215 308 Quentin Durand
$ sudo apt-get install python-lxml
216 287 Etienne Pallier
217 1 Etienne Pallier
218 288 Etienne Pallier
((
219 288 Etienne Pallier
NO MORE NECESSARY
220 1 Etienne Pallier
$ sudo pip install --upgrade virtualenv
221 288 Etienne Pallier
))
222 287 Etienne Pallier
</pre>
223 287 Etienne Pallier
224 287 Etienne Pallier
225 287 Etienne Pallier
 * Mac OS X :
226 287 Etienne Pallier
227 287 Etienne Pallier
  * From binary (Mac OS native application)
228 287 Etienne Pallier
(TODO:)
229 287 Etienne Pallier
230 287 Etienne Pallier
  * From MacPort
231 287 Etienne Pallier
232 287 Etienne Pallier
   * a) install macport
233 287 Etienne Pallier
cf https://www.macports.org/install.php
234 287 Etienne Pallier
235 287 Etienne Pallier
   * b) install the "port" python36
236 287 Etienne Pallier
<pre>
237 287 Etienne Pallier
$ sudo port install python36
238 287 Etienne Pallier
$ sudo port select --set python3 python36
239 287 Etienne Pallier
$ sudo port install py36-readline
240 287 Etienne Pallier
$ sudo port install py36-pip
241 287 Etienne Pallier
$ port select --set pip pip36
242 287 Etienne Pallier
</pre>
243 287 Etienne Pallier
244 287 Etienne Pallier
245 287 Etienne Pallier
 * Windows (tested with Windows 7 & 10) :
246 287 Etienne Pallier
<pre>
247 287 Etienne Pallier
Go to https://www.python.org/downloads/windows/ , choose the wanted version
248 287 Etienne Pallier
On the wanted version’s page, download Windows x86 executable installer
249 287 Etienne Pallier
250 287 Etienne Pallier
Run the executable
251 287 Etienne Pallier
    * On the first page, check "Add python3.5 to PATH"
252 287 Etienne Pallier
    * Choose "Install now" option
253 287 Etienne Pallier
254 287 Etienne Pallier
Open cmd (windows + R, cmd) :
255 1 Etienne Pallier
 $ python -m pip install --upgrade pip
256 288 Etienne Pallier
((
257 288 Etienne Pallier
NO MORE NECESSARY
258 1 Etienne Pallier
 $ pip install virtualenv
259 288 Etienne Pallier
))
260 287 Etienne Pallier
</pre>
261 287 Etienne Pallier
262 1 Etienne Pallier
---
263 287 Etienne Pallier
264 346 Etienne Pallier
h3. B. Install a database server
265 287 Etienne Pallier
266 287 Etienne Pallier
_If the MySql database server is already installed on your computer, skip this section_
267 287 Etienne Pallier
268 287 Etienne Pallier
By default, Pyros uses Mysql, but this implies that you have to install the Mysql database server...
269 287 Etienne Pallier
270 287 Etienne Pallier
Thus, to make things easier, avoid Mysql installation by using Sqlite instead as the database server (which will need no installation at all) :
271 287 Etienne Pallier
272 287 Etienne Pallier
=> *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*
273 287 Etienne Pallier
274 287 Etienne Pallier
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.
275 287 Etienne Pallier
276 287 Etienne Pallier
_(Skip this if you are using Sqlite instead of MySql)_
277 287 Etienne Pallier
278 352 Etienne Pallier
 * *Linux Ubuntu*
279 287 Etienne Pallier
<pre>
280 287 Etienne Pallier
First, update your system:
281 287 Etienne Pallier
$ sudo apt-get update
282 287 Etienne Pallier
283 287 Etienne Pallier
$ sudo apt-get install mysql-server
284 287 Etienne Pallier
$ sudo apt-get install mysql-client
285 287 Etienne Pallier
286 287 Etienne Pallier
$ sudo apt-get install libmysqlclient-dev
287 287 Etienne Pallier
(needed for python package mysqlclient)
288 287 Etienne Pallier
</pre>
289 287 Etienne Pallier
290 352 Etienne Pallier
 * *Linux CentOS* : cf https://www.howtoforge.com/apache_php_mysql_on_centos_7_lamp#-installing-mysql-
291 287 Etienne Pallier
<pre>
292 287 Etienne Pallier
First, update your system:
293 287 Etienne Pallier
$ sudo yum update yum
294 287 Etienne Pallier
$ sudo yum update kernel
295 287 Etienne Pallier
$ sudo yum update
296 287 Etienne Pallier
297 287 Etienne Pallier
$ sudo yum install mariadb-server 
298 287 Etienne Pallier
$ sudo yum install mariadb
299 287 Etienne Pallier
300 287 Etienne Pallier
$ sudo yum install mariadb-devel
301 287 Etienne Pallier
(needed for python package mysqlclient)
302 287 Etienne Pallier
303 287 Etienne Pallier
$ sudo systemctl start mariadb.service
304 287 Etienne Pallier
305 287 Etienne Pallier
$ sudo systemctl enable mariadb.service
306 287 Etienne Pallier
=> Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
307 287 Etienne Pallier
308 287 Etienne Pallier
$ sudo mysql_secure_installation
309 287 Etienne Pallier
</pre>
310 287 Etienne Pallier
311 350 Etienne Pallier
 * *Mac OS X*
312 350 Etienne Pallier
Install MySql with brew or macport, or install XAMPP (https://www.apachefriends.org/fr/index.html)
313 350 Etienne Pallier
- +With brew+ :
314 350 Etienne Pallier
<pre>
315 350 Etienne Pallier
$ brew update
316 350 Etienne Pallier
$ brew install mysql
317 350 Etienne Pallier
$ mysql -V
318 351 Etienne Pallier
319 353 Etienne Pallier
Now, start the Mysql server :
320 350 Etienne Pallier
$ mysql.server start
321 351 Etienne Pallier
322 351 Etienne Pallier
Now, connect to the Mysql server with the mysql client :
323 350 Etienne Pallier
$ mysql -u root
324 350 Etienne Pallier
mysql> exit
325 350 Etienne Pallier
</pre>
326 287 Etienne Pallier
327 287 Etienne Pallier
328 352 Etienne Pallier
 * *Windows* (tested with Windows 7 & 10)
329 287 Etienne Pallier
330 287 Etienne Pallier
<pre>
331 287 Etienne Pallier
Download and install the newest version on https://dev.mysql.com/downloads/installer/
332 287 Etienne Pallier
333 287 Etienne Pallier
Once installed, launch MySQL Installer. Clic on 'Add...' on the right.
334 287 Etienne Pallier
In MySQLServers section, choose the newest, then clic on next.
335 287 Etienne Pallier
Install and configure the server (just follow the installation guide).
336 287 Etienne Pallier
337 287 Etienne Pallier
Then launch mysql (via the Windows menu).
338 287 Etienne Pallier
</pre>
339 287 Etienne Pallier
340 1 Etienne Pallier
341 287 Etienne Pallier
---
342 287 Etienne Pallier
343 289 Etienne Pallier
h3. C. Install RabbitMQ
344 287 Etienne Pallier
345 287 Etienne Pallier
RabbitMQ is a message queue server used by Celery to handle tasks queues.
346 287 Etienne Pallier
It uses the amqp protocol to manage queue messages.
347 287 Etienne Pallier
348 335 Etienne Pallier
 * *Ubuntu (the server is automatically started)* :
349 287 Etienne Pallier
<pre>
350 287 Etienne Pallier
$ sudo apt-get install rabbitmq-server
351 287 Etienne Pallier
352 287 Etienne Pallier
Get status:
353 287 Etienne Pallier
$ sudo invoke-rc.d rabbitmq-server status
354 287 Etienne Pallier
355 287 Etienne Pallier
Stop:
356 287 Etienne Pallier
$ sudo invoke-rc.d rabbitmq-server stop
357 287 Etienne Pallier
358 287 Etienne Pallier
Start:
359 287 Etienne Pallier
$ sudo invoke-rc.d rabbitmq-server start
360 287 Etienne Pallier
361 287 Etienne Pallier
</pre>
362 287 Etienne Pallier
363 287 Etienne Pallier
364 287 Etienne Pallier
365 335 Etienne Pallier
 * *CentOS* :
366 287 Etienne Pallier
<pre>
367 287 Etienne Pallier
$ sudo yum install rabbitmq-server
368 287 Etienne Pallier
369 287 Etienne Pallier
Installation :
370 287 Etienne Pallier
 rabbitmq-server                                                           noarch                          3.3.5-17.el7
371 287 Etienne Pallier
Installation pour dépendances :
372 287 Etienne Pallier
 erlang-asn1                                                               x86_64                          R16B-03.16.el7
373 287 Etienne Pallier
374 287 Etienne Pallier
Get status:
375 287 Etienne Pallier
(CentOS7) $ sudo rabbitmqctl status
376 287 Etienne Pallier
(older CentOS) $ sudo /sbin/service rabbitmq-server status
377 287 Etienne Pallier
378 287 Etienne Pallier
Stop:
379 287 Etienne Pallier
(CentOS7) $ sudo systemctl stop rabbitmq-server
380 287 Etienne Pallier
(older CentOS) $ sudo /sbin/service rabbitmq-server stop
381 287 Etienne Pallier
382 287 Etienne Pallier
Start:
383 287 Etienne Pallier
(CentOS7) $ sudo systemctl start rabbitmq-server
384 287 Etienne Pallier
(older CentOS) $ sudo /sbin/service rabbitmq-server start
385 287 Etienne Pallier
</pre>
386 287 Etienne Pallier
387 335 Etienne Pallier
 * *MacOS* :
388 333 Etienne Pallier
- +With brew+ : (for more details, see https://www.rabbitmq.com/install-homebrew.html)
389 1 Etienne Pallier
<pre>
390 330 Etienne Pallier
$ brew update
391 330 Etienne Pallier
$ brew install rabbitmq
392 326 Etienne Pallier
393 336 Etienne Pallier
RabbitMQ is now installed under /usr/local/sbin
394 336 Etienne Pallier
395 326 Etienne Pallier
Add 
396 330 Etienne Pallier
  PATH=$PATH:/usr/local/sbin 
397 326 Etienne Pallier
to your .bash_profile or .profile. 
398 326 Etienne Pallier
399 1 Etienne Pallier
The server can then be started with :
400 331 Etienne Pallier
$ rabbitmq-server &
401 331 Etienne Pallier
(All scripts run under your own user account. Sudo is not required) 
402 331 Etienne Pallier
403 331 Etienne Pallier
Get status:
404 331 Etienne Pallier
$ rabbitmqctl status
405 331 Etienne Pallier
406 331 Etienne Pallier
To stop rabbitmq : 
407 331 Etienne Pallier
$ rabbitmqctl stop
408 334 Etienne Pallier
409 334 Etienne Pallier
The following command
410 334 Etienne Pallier
$ launchctl limit
411 334 Etienne Pallier
can be used to display effective limits for the current user
412 328 Etienne Pallier
</pre>
413 333 Etienne Pallier
- +With MacPort+:
414 326 Etienne Pallier
<pre>
415 287 Etienne Pallier
$ sudo port install rabbitmq-server
416 287 Etienne Pallier
--->  Installing erlang @18.2.1_1+hipe+ssl
417 287 Etienne Pallier
...
418 287 Etienne Pallier
--->  Installing rabbitmq-server @3.5.7_0
419 287 Etienne Pallier
--->  Activating rabbitmq-server @3.5.7_0
420 287 Etienne Pallier
...
421 287 Etienne Pallier
422 287 Etienne Pallier
To start rabbitmq : 
423 287 Etienne Pallier
$ sudo rabbitmq-server
424 287 Etienne Pallier
425 287 Etienne Pallier
Get status:
426 287 Etienne Pallier
$ sudo rabbitmqctl status
427 287 Etienne Pallier
428 287 Etienne Pallier
To stop rabbitmq : 
429 287 Etienne Pallier
$ sudo rabbitmqctl stop
430 287 Etienne Pallier
</pre>
431 287 Etienne Pallier
432 287 Etienne Pallier
433 335 Etienne Pallier
 * *Windows* :
434 287 Etienne Pallier
435 287 Etienne Pallier
  * Take the wanted Erlang version at http://www.erlang.org/downloads and install it (required)
436 287 Etienne Pallier
  * Take the wanted RabbitMQ version at https://www.rabbitmq.com/install-windows.html and install it. Then the server will run automatically
437 287 Etienne Pallier
438 169 Etienne Pallier
439 169 Etienne Pallier
440 169 Etienne Pallier
---
441 169 Etienne Pallier
442 291 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}III - INSTALLATION OF NEEDED PYTHON PACKAGES%
443 166 Etienne Pallier
444 293 Etienne Pallier
h3. A. Install all the needed python packages and the PyROS database (within a Python virtual environment)
445 293 Etienne Pallier
446 337 Etienne Pallier
Go into the PYROS/install/ folder and Run the install.py script with the parameter install
447 339 Etienne Pallier
(_You will be prompted to enter a username, an email, and a password for the superuser_)
448 293 Etienne Pallier
449 293 Etienne Pallier
<pre>
450 338 Etienne Pallier
$ cd install/
451 338 Etienne Pallier
$ python3 install.py
452 337 Etienne Pallier
</pre>
453 1 Etienne Pallier
454 1 Etienne Pallier
NB: _you might need to drop your pyros database (and pyros_test ?) before running the install script (if migrations are too big)_
455 1 Etienne Pallier
456 1 Etienne Pallier
_If something goes wrong, install manually each package (see section "MANUAL INSTALLATION OF PYTHON PACKAGES, ONE BY ONE")_
457 339 Etienne Pallier
458 339 Etienne Pallier
459 339 Etienne Pallier
Information for dev only :
460 339 Etienne Pallier
_older version : python3 install.py install_
461 339 Etienne Pallier
_TODO: update "create user if exists" => does not work with mysql 5.6 (only with 5.7)_
462 339 Etienne Pallier
463 339 Etienne Pallier
464 293 Etienne Pallier
465 293 Etienne Pallier
---
466 293 Etienne Pallier
467 343 Etienne Pallier
h3. B. (OPTIONAL) Install the Comet python package 
468 293 Etienne Pallier
469 295 Etienne Pallier
Latest info on this package : http://comet.transientskp.org/en/stable/
470 294 Etienne Pallier
471 190 Paul Carensac
Comet is needed as a broker to receive and send VOEvents (https://github.com/jdswinbank/Comet/tree/py3)
472 291 Etienne Pallier
*You MUST have your virtualenv activated (source venv_py3_pyros/bin/activate in your 'private/' directory)*
473 190 Paul Carensac
Documentation is available here : http://comet.readthedocs.io/en/stable/installation.html
474 267 Etienne Pallier
(see also http://voevent.readthedocs.io/en/latest/setup.html)
475 1 Etienne Pallier
476 297 Etienne Pallier
477 298 Etienne Pallier
1) Essayer d'abord la méthode automatique (avec pip) :
478 297 Etienne Pallier
479 297 Etienne Pallier
$ source private/venv_py3_pyros/bin/activate
480 297 Etienne Pallier
$ pip install comet
481 297 Etienne Pallier
482 1 Etienne Pallier
483 297 Etienne Pallier
484 298 Etienne Pallier
2) Si ça ne marche pas, essayer la méthode manuelle (download puis install) :
485 298 Etienne Pallier
486 292 Etienne Pallier
* Ubuntu :
487 265 Etienne Pallier
488 291 Etienne Pallier
<pre>
489 1 Etienne Pallier
# You can do this anywhere on your computer
490 291 Etienne Pallier
$ git clone https://github.com/jdswinbank/Comet.git
491 266 Etienne Pallier
$ cd Comet
492 190 Paul Carensac
$ (sudo ?) python setup.py install
493 190 Paul Carensac
$ sudo apt-get install python-lxml
494 256 Jeremy Barneron
495 190 Paul Carensac
</pre>
496 256 Jeremy Barneron
497 1 Etienne Pallier
498 267 Etienne Pallier
* MacOS :
499 190 Paul Carensac
<pre>
500 1 Etienne Pallier
Idem Ubuntu
501 1 Etienne Pallier
</pre>
502 1 Etienne Pallier
503 1 Etienne Pallier
* Windows :
504 1 Etienne Pallier
<pre>
505 1 Etienne Pallier
TODO:
506 1 Etienne Pallier
</pre>
507 298 Etienne Pallier
508 298 Etienne Pallier
509 298 Etienne Pallier
510 298 Etienne Pallier
3) Test Comet
511 298 Etienne Pallier
512 298 Etienne Pallier
$ twistd comet --help
513 298 Etienne Pallier
$ trial comet
514 298 Etienne Pallier
515 298 Etienne Pallier
All tests should pass
516 298 Etienne Pallier
517 9 Etienne Pallier
518 9 Etienne Pallier
---
519 9 Etienne Pallier
520 300 Etienne Pallier
h3. C. (Eclipse only) Set the Python3 virtual environment as the project interpreter
521 300 Etienne Pallier
522 300 Etienne Pallier
See below, in section "NOTES FOR ECLIPSE USERS"
523 300 Etienne Pallier
524 300 Etienne Pallier
---
525 300 Etienne Pallier
526 17 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}IV - TEST%
527 17 Etienne Pallier
528 108 Etienne Pallier
529 90 Etienne Pallier
(Tests are classes declared in all apps' test.py file. The test classes inherit from django.test.TestCase)
530 17 Etienne Pallier
531 17 Etienne Pallier
You can run the tests suite, just to be sure that the software is well installed.
532 17 Etienne Pallier
533 356 Etienne Pallier
*First, be sure that all the pre-requisites are well installed and running* :
534 345 Etienne Pallier
535 1 Etienne Pallier
* MySQL : see [[Project_Installation#B-Install-a-database-server|B-Install-a-database-server]]
536 354 Etienne Pallier
* RabbitMQ : see [[Project_Installation#C-Install-RabbitMQ|C-Install-RabbitMQ]]
537 344 Etienne Pallier
538 355 Etienne Pallier
*Now, run the tests* :
539 19 Etienne Pallier
540 1 Etienne Pallier
<pre>
541 1 Etienne Pallier
542 1 Etienne Pallier
$ cd PYROS/
543 1 Etienne Pallier
544 355 Etienne Pallier
Activate the pyros virtual environment :
545 355 Etienne Pallier
$ source private/venv_py3_pyros/bin/activate
546 355 Etienne Pallier
(venv_py3_pyros)$
547 355 Etienne Pallier
548 243 Etienne Pallier
Be sure that at least unit tests pass:
549 355 Etienne Pallier
(venv_py3_pyros)$ python pyros.py unittest
550 1 Etienne Pallier
551 355 Etienne Pallier
If ever the tests don't pass because of mysql try :
552 355 Etienne Pallier
(venv_py3_pyros)$ python pyros.py updatedb
553 242 Etienne Pallier
554 242 Etienne Pallier
If unit tests pass, then run ALL tests:
555 355 Etienne Pallier
(venv_py3_pyros)$ python pyros.py test_all
556 1 Etienne Pallier
557 358 Etienne Pallier
Test with simulators (TBC) :
558 357 Etienne Pallier
(venv_py3_pyros)$ python pyros.py simulator_development
559 357 Etienne Pallier
560 242 Etienne Pallier
</pre>
561 242 Etienne Pallier
562 17 Etienne Pallier
563 355 Etienne Pallier
*To run the tests from Eclipse* :
564 355 Etienne Pallier
565 1 Etienne Pallier
Right-clic on the project / Django / Run Django tests
566 216 Etienne Pallier
567 1 Etienne Pallier
(for more information, see below, in section "NOTES FOR ECLIPSE USERS")
568 216 Etienne Pallier
569 355 Etienne Pallier
570 355 Etienne Pallier
571 355 Etienne Pallier
*Custom commands* :
572 25 Paul Carensac
573 25 Paul Carensac
$ [./manage.py] test app.tests                           # Run tests for the application 'app'
574 25 Paul Carensac
$ [./manage.py] test app.tests.ModelTests                # Run test methods declared in the class app.tests.ModelTests
575 33 Etienne Pallier
$ [./manage.py] test app.tests.ModelTests.test_method    # Only run the method test_method declared in app.tests.ModelTests
576 33 Etienne Pallier
577 1 Etienne Pallier
578 1 Etienne Pallier
---
579 170 Etienne Pallier
580 170 Etienne Pallier
---
581 92 Etienne Pallier
582 75 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}V - RUN%
583 109 Etienne Pallier
584 223 Etienne Pallier
585 223 Etienne Pallier
Before launching Pyros, check that all the pre-requisites are running :
586 223 Etienne Pallier
587 223 Etienne Pallier
 * RabbitMQ: 
588 223 Etienne Pallier
<pre>
589 223 Etienne Pallier
$ systemctl status rabbitmq-server
590 223 Etienne Pallier
591 223 Etienne Pallier
If inactive, start it:
592 223 Etienne Pallier
$ sudo systemctl start rabbitmq-server
593 224 Etienne Pallier
594 223 Etienne Pallier
(To stop it, use "stop" instead of "start")
595 223 Etienne Pallier
596 223 Etienne Pallier
</pre>
597 223 Etienne Pallier
598 225 Etienne Pallier
 * Mysql (only if you are not using Sqlite):
599 306 Quentin Durand
<pre>
600 225 Etienne Pallier
$ systemctl status (mysqld or mysql in function of the one you're using)
601 225 Etienne Pallier
602 306 Quentin Durand
If inactive, start it:
603 225 Etienne Pallier
$ sudo systemctl start (mysqld or mysql in function of the one you're using)
604 225 Etienne Pallier
605 225 Etienne Pallier
(To stop it, use "stop" instead of "start")
606 223 Etienne Pallier
</pre>
607 75 Etienne Pallier
608 75 Etienne Pallier
* From the terminal
609 75 Etienne Pallier
610 75 Etienne Pallier
<pre>
611 95 Etienne Pallier
612 1 Etienne Pallier
$ cd PYROS/
613 307 Quentin Durand
614 217 Etienne Pallier
$ first start the server with "python manage.py runserver YOUR_IP_ADDRESS:8000" if you want to access the website from another pc with http://YOUR_IP_ADDRESS:8000) (from within a virtual env, and from src/)
615 307 Quentin Durand
616 217 Etienne Pallier
$ then launch pyros : python3 pyros.py start 
617 307 Quentin Durand
618 217 Etienne Pallier
#obsolète(To check that this service is actually running, type "$ netstat -an |grep 8000" and you should get "tcp        0      0 127.0.0.1:8000          0.0.0.0:*               LISTEN")
619 93 Paul Carensac
620 75 Etienne Pallier
</pre>
621 158 Paul Carensac
622 91 Etienne Pallier
Now, go to "http://localhost:8000/admin" in your browser
623 158 Paul Carensac
624 105 Etienne Pallier
(and login as "pyros" with the password 'DjangoPyros')
625 91 Etienne Pallier
626 91 Etienne Pallier
(Ctrl-c to stop)
627 91 Etienne Pallier
628 75 Etienne Pallier
629 106 Etienne Pallier
630 75 Etienne Pallier
* From Eclipse : see below, in section "NOTES FOR ECLIPSE USERS"
631 75 Etienne Pallier
632 1 Etienne Pallier
633 1 Etienne Pallier
---
634 170 Etienne Pallier
635 170 Etienne Pallier
---
636 33 Etienne Pallier
637 35 Etienne Pallier
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}NOTES FOR ECLIPSE USERS%
638 35 Etienne Pallier
639 35 Etienne Pallier
0) Install Eclipse (if necessary)
640 35 Etienne Pallier
641 35 Etienne Pallier
Get the Eclipse version for Php
642 35 Etienne Pallier
643 35 Etienne Pallier
Install the plug-in pydev (via install new software, add http://pydev.org/updates)
644 35 Etienne Pallier
645 35 Etienne Pallier
Install the django template editor (via install new software, add http://eclipse.kacprzak.org/updates)
646 35 Etienne Pallier
647 35 Etienne Pallier
1) Deactivate CA certificate verification
648 35 Etienne Pallier
649 35 Etienne Pallier
Window -> Preferences -> Team -> git -> configuration -> Add entry
650 35 Etienne Pallier
651 35 Etienne Pallier
Key = http.sslVerify
652 35 Etienne Pallier
Value = false
653 35 Etienne Pallier
654 35 Etienne Pallier
2) Fetch the project
655 35 Etienne Pallier
656 35 Etienne Pallier
File/Import project from git
657 35 Etienne Pallier
658 35 Etienne Pallier
Select repository source: Clone URI: https://gitlab.irap.omp.eu/epallier/pyros.git
659 35 Etienne Pallier
660 35 Etienne Pallier
Directory: 
661 35 Etienne Pallier
par défaut, il propose : /Users/epallier/git/pyros
662 35 Etienne Pallier
mais on peut le mettre ailleurs (c'est ce que j'ai fait)
663 35 Etienne Pallier
664 35 Etienne Pallier
initial branch: master
665 35 Etienne Pallier
remote name: origin
666 35 Etienne Pallier
667 35 Etienne Pallier
Import as general project
668 35 Etienne Pallier
669 35 Etienne Pallier
Project name: PYROS
670 35 Etienne Pallier
671 35 Etienne Pallier
672 35 Etienne Pallier
3) Configure the project
673 35 Etienne Pallier
674 35 Etienne Pallier
The project is created. Now, you have to set it as a «PyDev » and a « Django » project.
675 35 Etienne Pallier
676 35 Etienne Pallier
clic droit sur le projet / PyDev / set as a PyDev project
677 35 Etienne Pallier
678 35 Etienne Pallier
clic droit sur le projet / PyDev / set as a Django project
679 35 Etienne Pallier
680 35 Etienne Pallier
clic droit sur le projet : on doit maintenant avoir un sous-menu Django
681 35 Etienne Pallier
682 35 Etienne Pallier
clic droit sur le dossier src / PyDev / set as source folder (add to PYTHONPATH)
683 35 Etienne Pallier
684 215 Etienne Pallier
clic droit sur projet / Properties / Pydev-Django :
685 215 Etienne Pallier
  - *Django manage.py : src/manage.py*
686 35 Etienne Pallier
  - *Django settings module : pyros.settings*
687 35 Etienne Pallier
688 35 Etienne Pallier
689 35 Etienne Pallier
4) Set Code style
690 35 Etienne Pallier
691 35 Etienne Pallier
Window/Preferences : Pydev / Editor
692 35 Etienne Pallier
- Auto Imports : uncheck « Do auto import »
693 35 Etienne Pallier
- Code style:
694 35 Etienne Pallier
	- Locals … : camelCase
695 35 Etienne Pallier
	- Methods : camelCase() with first lower
696 35 Etienne Pallier
- Code style / Code Formatter: activer « use autopep8.py for code formatting »
697 35 Etienne Pallier
- Tabs : Tab length : 4
698 67 Etienne Pallier
699 66 Etienne Pallier
5) Now, once the Python3 virtual environment is installed (see above),
700 66 Etienne Pallier
set it in Eclipse as the project interpreter:
701 68 Etienne Pallier
702 66 Etienne Pallier
Right clic on the project / Properties / PyDev - Interpreter/Grammar :
703 66 Etienne Pallier
Grammar version : 3
704 66 Etienne Pallier
705 66 Etienne Pallier
Interpreter : click on « click here to configure an interpreter not listed »
706 66 Etienne Pallier
707 66 Etienne Pallier
click on « New... » :
708 66 Etienne Pallier
- Interpreter name : venv_py35_pyros
709 66 Etienne Pallier
- Interpreter executable : click on « Browse »
710 66 Etienne Pallier
	Select your virtualenv python35 executable (private/venv_py35_pyros/bin/python3.5)
711 66 Etienne Pallier
	click OK
712 66 Etienne Pallier
713 66 Etienne Pallier
*Now, a last thing to do so that Pydev finds Django:*
714 66 Etienne Pallier
715 66 Etienne Pallier
In the Python interpreters list, select your virtual env (venv_py35_pyros)
716 66 Etienne Pallier
717 66 Etienne Pallier
Click on the tab "Libraries"
718 66 Etienne Pallier
719 66 Etienne Pallier
clic on 'New folder', then select your virtualenv's lib/python3.5/site-packages folder
720 66 Etienne Pallier
721 66 Etienne Pallier
OK
722 66 Etienne Pallier
723 66 Etienne Pallier
Interpreter: select now venv_py35_pyros from the list
724 66 Etienne Pallier
725 62 Etienne Pallier
OK
726 78 Etienne Pallier
727 1 Etienne Pallier
6) Test
728 78 Etienne Pallier
729 78 Etienne Pallier
* Right-clic on the project / Django / Run Django tests
730 78 Etienne Pallier
731 78 Etienne Pallier
* Right-clic on the project / Django / Custom command / ...
732 78 Etienne Pallier
733 78 Etienne Pallier
734 70 Etienne Pallier
7) Run
735 70 Etienne Pallier
736 70 Etienne Pallier
Right clic on project -> Django/Custom command/runserver
737 70 Etienne Pallier
738 70 Etienne Pallier
Error on Ubuntu :
739 70 Etienne Pallier
740 70 Etienne Pallier
<pre>
741 70 Etienne Pallier
742 70 Etienne Pallier
Traceback (most recent call last):
743 70 Etienne Pallier
  File "/home/carens_p/git/pyros/src/manage.py", line 8, in <module>
744 70 Etienne Pallier
    from django.core.management import execute_from_command_line
745 70 Etienne Pallier
ImportError: No module named 'django'
746 70 Etienne Pallier
747 70 Etienne Pallier
</pre>
748 70 Etienne Pallier
749 70 Etienne Pallier
Project -> Properties -> Pydev interpreter -> Clic here to configure an interpreter not listed
750 70 Etienne Pallier
751 70 Etienne Pallier
select venv_py35_pyros
752 70 Etienne Pallier
753 70 Etienne Pallier
In Libraries, clic on 'New folder', then select your virtualenv's lib/python3.5/site-packages folder.
754 70 Etienne Pallier
755 70 Etienne Pallier
OK -> re-select venv_py35_pyros in 'Interpreter' dropdown menu
756 70 Etienne Pallier
757 70 Etienne Pallier
Then right clic on project -> Django/Custom command/runserver
758 70 Etienne Pallier
759 70 Etienne Pallier
check http://localhost:8000/
760 70 Etienne Pallier
761 62 Etienne Pallier
762 62 Etienne Pallier
---
763 62 Etienne Pallier
764 62 Etienne Pallier
---
765 250 Jeremy Barneron
766 250 Jeremy Barneron
h2. %{margin-left:0px; font-weight:bold; font-size:25px;  display:block; color:red;}NOTES FOR PYCHARM USERS%
767 250 Jeremy Barneron
768 250 Jeremy Barneron
1) Install Pycharm
769 251 Jeremy Barneron
770 251 Jeremy Barneron
2) import pyros project
771 252 Jeremy Barneron
772 250 Jeremy Barneron
3) Mark the src directory and simulators directory as source root directories
773 252 Jeremy Barneron
774 258 Jeremy Barneron
4) Go in file -> settings (CTRL + ALT + S) -> Project : Pyros -> Project Interpreter
775 250 Jeremy Barneron
   Add an interpreter which is the one from your virtual environment : Add Local -> find the python 3 binary in your virtualenv
776 303 Quentin Durand
777 304 Quentin Durand
5) 
778 304 Quentin Durand
    +For professional version :+
779 304 Quentin Durand
     Go in Language & Frameworks -> Django and set the django project root / Settings (pyros/settings.py) / Manage script
780 305 Quentin Durand
    +For community edition :+
781 304 Quentin Durand
     First: Go to edit configuration (top right corner)
782 304 Quentin Durand
     Second: Click on the (+) mark in top-left corner and add python configuration.
783 304 Quentin Durand
     Third: Click on the Script, and for django select the manage.py which resides on the project directory.
784 250 Jeremy Barneron
     Fourth: Add <your command> as Scripts parameter and click apply : you normally should be able to run your project
785 250 Jeremy Barneron
786 250 Jeremy Barneron
---
787 250 Jeremy Barneron
788 250 Jeremy Barneron
---
789 81 Etienne Pallier
790 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%
791 172 Etienne Pallier
792 100 Etienne Pallier
*Follow these steps only if the previous guided and nearly automatic installation did not work for you*
793 172 Etienne Pallier
794 174 Etienne Pallier
795 174 Etienne Pallier
h3. (Only if using Mysql) Create the database "pyros" and the pyros user
796 174 Etienne Pallier
797 174 Etienne Pallier
Only if you are using Mysql, you need to create an empty database "pyros"
798 174 Etienne Pallier
(which will be filled automatically by django)
799 174 Etienne Pallier
800 174 Etienne Pallier
<pre>
801 174 Etienne Pallier
$ mysql -u root -p
802 174 Etienne Pallier
(enter your root password)
803 174 Etienne Pallier
804 174 Etienne Pallier
$ mysql> create database if not exists pyros;
805 174 Etienne Pallier
</pre>
806 174 Etienne Pallier
807 174 Etienne Pallier
The user creation depends on your MySQL version :
808 174 Etienne Pallier
809 174 Etienne Pallier
 * 5.7 and above :
810 174 Etienne Pallier
<pre>
811 174 Etienne Pallier
$ mysql> DROP USER IF EXISTS pyros;
812 174 Etienne Pallier
$ mysql> CREATE USER 'pyros' IDENTIFIED BY 'DjangoPyros';
813 174 Etienne Pallier
$ mysql> GRANT ALL PRIVILEGES ON pyros.* TO pyros;
814 174 Etienne Pallier
</pre>
815 174 Etienne Pallier
816 174 Etienne Pallier
 * under 5.7 :
817 174 Etienne Pallier
<pre>
818 174 Etienne Pallier
$ mysql> GRANT USAGE ON *.* TO 'pyros';
819 174 Etienne Pallier
$ mysql> DROP USER 'pyros';
820 174 Etienne Pallier
$ mysql> CREATE USER 'pyros' IDENTIFIED BY 'DjangoPyros';
821 174 Etienne Pallier
$ mysql> GRANT ALL PRIVILEGES ON pyros.* TO pyros;
822 174 Etienne Pallier
</pre>
823 174 Etienne Pallier
824 174 Etienne Pallier
If none of these solution work, check on the internet to create a user named pyros with the password DjangoPyros.
825 100 Etienne Pallier
826 100 Etienne Pallier
h3. Create a Python3 virtual environment dedicated to the project (inside the project folder)
827 100 Etienne Pallier
828 100 Etienne Pallier
<pre>
829 100 Etienne Pallier
830 100 Etienne Pallier
$ mkdir private/
831 100 Etienne Pallier
832 100 Etienne Pallier
$ cd private/
833 100 Etienne Pallier
834 100 Etienne Pallier
$ which python3.5 ("where python" for windows)
835 100 Etienne Pallier
/opt/local/bin/python3.5
836 313 Quentin Durand
837 100 Etienne Pallier
$ python3 -m venv_py35_pyros -p /opt/local/bin/python3.5 ou py instead of python3 on windows 
838 100 Etienne Pallier
=> creates a venv_py35_pyros/ folder inside PYROS/private/
839 100 Etienne Pallier
840 100 Etienne Pallier
</pre>
841 100 Etienne Pallier
842 100 Etienne Pallier
843 100 Etienne Pallier
---
844 100 Etienne Pallier
845 100 Etienne Pallier
h3. Activate the python virtual environment (from inside the project)
846 100 Etienne Pallier
847 100 Etienne Pallier
<pre>
848 100 Etienne Pallier
849 100 Etienne Pallier
$ pwd
850 100 Etienne Pallier
.../PYROS/private
851 100 Etienne Pallier
852 100 Etienne Pallier
$ source ./venv_py35_pyros/bin/activate (venv_py35_pyros/Scripts/activate on Windows)
853 100 Etienne Pallier
854 100 Etienne Pallier
</pre>
855 100 Etienne Pallier
856 100 Etienne Pallier
---
857 100 Etienne Pallier
858 100 Etienne Pallier
h3. Install needed python packages
859 81 Etienne Pallier
860 81 Etienne Pallier
Check that the virtual environment is activated
861 81 Etienne Pallier
<pre>
862 81 Etienne Pallier
$ python -V
863 81 Etienne Pallier
Python 3...
864 81 Etienne Pallier
865 81 Etienne Pallier
$ which pip
866 81 Etienne Pallier
.../PYROS/venv_py35_pyros/bin/pip
867 81 Etienne Pallier
</pre>
868 81 Etienne Pallier
869 81 Etienne Pallier
870 81 Etienne Pallier
Upgrade pip to last version available:
871 81 Etienne Pallier
<pre>
872 81 Etienne Pallier
$ pip install --upgrade pip
873 81 Etienne Pallier
Collecting pip
874 81 Etienne Pallier
  Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)
875 81 Etienne Pallier
Installing collected packages: pip
876 81 Etienne Pallier
  Found existing installation: pip 7.1.2
877 81 Etienne Pallier
    Uninstalling pip-7.1.2:
878 81 Etienne Pallier
      Successfully uninstalled pip-7.1.2
879 81 Etienne Pallier
Successfully installed pip-8.1.1
880 81 Etienne Pallier
881 81 Etienne Pallier
Upgrade wheel to last version available:
882 81 Etienne Pallier
$ pip install --upgrade wheel
883 81 Etienne Pallier
Collecting wheel
884 81 Etienne Pallier
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
885 81 Etienne Pallier
Installing collected packages: wheel
886 81 Etienne Pallier
  Found existing installation: wheel 0.24.0
887 81 Etienne Pallier
    Uninstalling wheel-0.24.0:
888 81 Etienne Pallier
      Successfully uninstalled wheel-0.24.0
889 81 Etienne Pallier
Successfully installed wheel-0.29.0
890 81 Etienne Pallier
891 81 Etienne Pallier
</pre>
892 81 Etienne Pallier
893 81 Etienne Pallier
Go into the install/ folder:
894 81 Etienne Pallier
<pre>
895 81 Etienne Pallier
$ cd .../PYROS/install/
896 81 Etienne Pallier
</pre>
897 84 Etienne Pallier
898 85 Etienne Pallier
Install all the needed python packages at once:
899 1 Etienne Pallier
<pre>
900 85 Etienne Pallier
$ pip install -r REQUIREMENTS.txt
901 84 Etienne Pallier
</pre>
902 84 Etienne Pallier
903 62 Etienne Pallier
If something goes wrong, install them one by one:
904 62 Etienne Pallier
905 62 Etienne Pallier
  * *Install Django* :
906 62 Etienne Pallier
<pre>
907 62 Etienne Pallier
$ pip install django
908 62 Etienne Pallier
Collecting django
909 62 Etienne Pallier
  Downloading Django-1.9.4-py2.py3-none-any.whl (6.6MB)
910 62 Etienne Pallier
Installing collected packages: django
911 62 Etienne Pallier
Successfully installed django-1.9.4
912 62 Etienne Pallier
913 62 Etienne Pallier
$ pip install django-admin-tools
914 62 Etienne Pallier
Collecting django-admin-tools
915 62 Etienne Pallier
  Downloading django_admin_tools-0.7.2-py2.py3-none-any.whl (289kB)
916 62 Etienne Pallier
Installing collected packages: django-admin-tools
917 62 Etienne Pallier
Successfully installed django-admin-tools-0.7.2
918 62 Etienne Pallier
919 62 Etienne Pallier
$ pip install django-debug-toolbar
920 62 Etienne Pallier
Collecting django-debug-toolbar
921 62 Etienne Pallier
  Downloading django_debug_toolbar-1.4-py2.py3-none-any.whl (212kB)
922 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)
923 62 Etienne Pallier
Collecting sqlparse (from django-debug-toolbar)
924 62 Etienne Pallier
  Downloading sqlparse-0.1.19.tar.gz (58kB)
925 62 Etienne Pallier
Building wheels for collected packages: sqlparse
926 62 Etienne Pallier
  Running setup.py bdist_wheel for sqlparse ... done
927 62 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/7b/d4/72/6011bb100dd5fc213164e4bbee13d4e03261dd54ce6a5de6b8
928 62 Etienne Pallier
Successfully built sqlparse
929 62 Etienne Pallier
Installing collected packages: sqlparse, django-debug-toolbar
930 62 Etienne Pallier
Successfully installed django-debug-toolbar-1.4 sqlparse-0.1.19
931 62 Etienne Pallier
932 62 Etienne Pallier
$ pip install django-extensions
933 62 Etienne Pallier
Collecting django-extensions
934 62 Etienne Pallier
  Downloading django_extensions-1.6.1-py2.py3-none-any.whl (202kB)
935 62 Etienne Pallier
Collecting six>=1.2 (from django-extensions)
936 62 Etienne Pallier
  Downloading six-1.10.0-py2.py3-none-any.whl
937 62 Etienne Pallier
Installing collected packages: six, django-extensions
938 62 Etienne Pallier
Successfully installed django-extensions-1.6.1 six-1.10.0
939 62 Etienne Pallier
940 62 Etienne Pallier
$ pip install django-suit
941 62 Etienne Pallier
Collecting django-suit
942 62 Etienne Pallier
  Downloading django-suit-0.2.18.tar.gz (587kB)
943 62 Etienne Pallier
Building wheels for collected packages: django-suit
944 62 Etienne Pallier
  Running setup.py bdist_wheel for django-suit ... done
945 62 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/12/8b/9a/e02ab0ad9229881638aa040d47d77c8f562999533811927d41
946 62 Etienne Pallier
Successfully built django-suit
947 62 Etienne Pallier
Installing collected packages: django-suit
948 62 Etienne Pallier
Successfully installed django-suit-0.2.18
949 62 Etienne Pallier
950 62 Etienne Pallier
</pre>
951 62 Etienne Pallier
952 62 Etienne Pallier
  * *Install the django boostrap css package* :
953 62 Etienne Pallier
<pre>
954 62 Etienne Pallier
$ pip install django-bootstrap3
955 62 Etienne Pallier
</pre>
956 62 Etienne Pallier
(==> 'bootstrap3' is then to be added as an application in settings.py -> INSTALLED_APPS)
957 62 Etienne Pallier
958 62 Etienne Pallier
  * *Install the web application server gunicorn (will be used in production instead of the dev django web server)* :
959 62 Etienne Pallier
<pre>
960 62 Etienne Pallier
$ pip install gunicorn
961 62 Etienne Pallier
Collecting gunicorn
962 62 Etienne Pallier
  Downloading gunicorn-19.4.5-py2.py3-none-any.whl (112kB)
963 62 Etienne Pallier
Installing collected packages: gunicorn
964 62 Etienne Pallier
Successfully installed gunicorn-19.4.5
965 62 Etienne Pallier
</pre>
966 62 Etienne Pallier
967 62 Etienne Pallier
  * *Install the python mysql client* (not needed if you want to use sqlite):
968 62 Etienne Pallier
<pre>
969 62 Etienne Pallier
$ pip install mysqlclient
970 62 Etienne Pallier
...
971 62 Etienne Pallier
</pre>
972 146 Etienne Pallier
973 62 Etienne Pallier
   * => If issue under Mac OS X:
974 62 Etienne Pallier
<pre>
975 62 Etienne Pallier
$ pip install mysqlclient
976 62 Etienne Pallier
Collecting mysqlclient
977 62 Etienne Pallier
  Downloading mysqlclient-1.3.7.tar.gz (79kB)
978 62 Etienne Pallier
Building wheels for collected packages: mysqlclient
979 62 Etienne Pallier
  Running setup.py bdist_wheel for mysqlclient ... error
980 62 Etienne Pallier
981 62 Etienne Pallier
  ----------------------------------------
982 62 Etienne Pallier
  Failed building wheel for mysqlclient
983 62 Etienne Pallier
  Running setup.py clean for mysqlclient
984 62 Etienne Pallier
Failed to build mysqlclient
985 62 Etienne Pallier
Installing collected packages: mysqlclient
986 62 Etienne Pallier
  Running setup.py install for mysqlclient ... done
987 62 Etienne Pallier
Successfully installed mysqlclient-1.3.7
988 62 Etienne Pallier
989 1 Etienne Pallier
BOUH !!!
990 152 Etienne Pallier
991 146 Etienne Pallier
=> Need to upgrade wheel:
992 62 Etienne Pallier
993 62 Etienne Pallier
$ pip install --upgrade wheel
994 62 Etienne Pallier
Collecting wheel
995 62 Etienne Pallier
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
996 62 Etienne Pallier
Installing collected packages: wheel
997 62 Etienne Pallier
  Found existing installation: wheel 0.24.0
998 62 Etienne Pallier
    Uninstalling wheel-0.24.0:
999 62 Etienne Pallier
      Successfully uninstalled wheel-0.24.0
1000 62 Etienne Pallier
Successfully installed wheel-0.29.0
1001 153 Etienne Pallier
1002 1 Etienne Pallier
YES !!!
1003 154 Etienne Pallier
1004 153 Etienne Pallier
Only if necessary, you can reinstall mysqlclient:
1005 62 Etienne Pallier
$ pip uninstall mysqlclient
1006 62 Etienne Pallier
$ pip install mysqlclient
1007 62 Etienne Pallier
Collecting mysqlclient
1008 62 Etienne Pallier
  Using cached mysqlclient-1.3.7.tar.gz
1009 62 Etienne Pallier
Building wheels for collected packages: mysqlclient
1010 62 Etienne Pallier
  Running setup.py bdist_wheel for mysqlclient ... done
1011 62 Etienne Pallier
  Stored in directory: /Users/epallier/Library/Caches/pip/wheels/9b/06/50/d11418c26cf8f2156b13d4363b5afde8e7e75ebb8540d0228d
1012 62 Etienne Pallier
Successfully built mysqlclient
1013 62 Etienne Pallier
Installing collected packages: mysqlclient
1014 62 Etienne Pallier
Successfully installed mysqlclient-1.3.7
1015 1 Etienne Pallier
1016 62 Etienne Pallier
</pre>
1017 146 Etienne Pallier
1018 62 Etienne Pallier
   * => If issue under Windows
1019 62 Etienne Pallier
<pre>
1020 146 Etienne Pallier
Same message as the issue for Mac.
1021 204 Paul Carensac
1022 62 Etienne Pallier
=> Need to install wheel manually :
1023 62 Etienne Pallier
1024 62 Etienne Pallier
Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient to download the newest mysqlclient wheel
1025 62 Etienne Pallier
1026 62 Etienne Pallier
$ pip install path\to\mysqlclient\wheel
1027 154 Etienne Pallier
1028 62 Etienne Pallier
(No need to redo "pip install mysqlclient")
1029 163 Paul Carensac
</pre>
1030 163 Paul Carensac
1031 163 Paul Carensac
  * *Install the julian day converter* :
1032 163 Paul Carensac
<pre>
1033 163 Paul Carensac
$ pip install jdcal
1034 182 Paul Carensac
</pre>
1035 188 Paul Carensac
1036 182 Paul Carensac
  * *Install Celery and dependencies* :
1037 182 Paul Carensac
<pre>
1038 1 Etienne Pallier
$ pip install celery
1039 188 Paul Carensac
$ pip install django-celery
1040 188 Paul Carensac
$ pip install Twisted==16.0.0
1041 188 Paul Carensac
</pre>
1042 188 Paul Carensac
1043 188 Paul Carensac
  * *Install django test without migrations (compulsory to use the prod DB for tests)* :
1044 188 Paul Carensac
<pre>
1045 188 Paul Carensac
$ pip install django-test-without-migrations==0.4
1046 188 Paul Carensac
</pre>
1047 188 Paul Carensac
1048 188 Paul Carensac
  * *Install voevent parser* :
1049 188 Paul Carensac
<pre>
1050 188 Paul Carensac
$ pip install voevent-parse==0.9.5
1051 188 Paul Carensac
</pre>
1052 188 Paul Carensac
1053 188 Paul Carensac
1054 188 Paul Carensac
  * *Install other dependencies (useful ? TBC)* :
1055 188 Paul Carensac
<pre>
1056 188 Paul Carensac
$ pip install amqplib==1.0.2
1057 188 Paul Carensac
$ pip install pluggy==0.3.1
1058 182 Paul Carensac
$ pip install py==1.4.31
1059 1 Etienne Pallier
</pre>