Blame view

docs/source/install_for_dev.rst 2.08 KB
6a9e1893   Alain Klotz   Work before holli...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
***************************************************
Installing GuitAstro for development
***************************************************

Prerequisite: You have ever downloaded Guitastro and installed Python.

1. Recommanded use of virtual environment
*****************************************

We are going to create and use the virtual environment named (guitastro).

.. code-block:: bash

	conda create -n guitastro python=3.8 spyder
	conda activate guitastro

2. Python requirements
**********************

As Guitastro uses many Python libraries, they must be installed
before using Guitastro. To do that we use the file requirements.txt
containing all the required library names and version. The
file requirements.txt is placed in the install folder where
Guitastro was downloaded.

For Linux users:

.. code-block:: bash

	cd ~/Documents/guitastro/install
	pip3 install pip-tools
	python3 -m piptools compile requirements.in	
	python3 -m pip install -r requirements.txt

For Windows users, open a Powershell as administrator. 
A quick way to open Powershell as administrator is 
Win+R (execute commands) and put: 

.. code-block:: bash

	powershell Start-Process powershell -Verb runAs
	
Then, in the Powershell terminal:

.. code-block:: bash

	cd C:\Users\xxx\Documents\guitastro\install
	pip install pip-tools
	python3 -m piptools compile requirements.in	
	python -m pip install -r requirements.txt

3. Import guitastro from everywhere
***********************************

We considered to have installed guitastro in the xxx/Documents/guitastro
directory of the computer. If you want to import guitastro with
the simple line "import guitastro" you must have your calling program
in the directory Documents which is not easy to manage. 
To avoid this constraint, just before 
the import line you must add the guitastro installation directory in the list of
the variable sys.path of Python:

.. code-block:: python

	import sys
	path = r"C:\Users\xxx\Documents\guitastro\src"
	if path not in sys.path:
		sys.path.insert(0,path)
	import guitastro