install_pip.md 4.08 KB
Newer Older
1 2
# Install Silkaj with Pip

Moul's avatar
Moul committed
3
You have to use a shell on GNU/Linux or a command tool (`cmd.exe`) on Windows.
4

5
## GNU/Linux
Moul's avatar
Moul committed
6
The system must use UTF-8 locales…
7

8 9 10 11 12 13 14 15
### Install libsodium

```bash
sudo apt install libsodium23 # Debian Buster
sudo apt install libsodium18 # Debian Stretch
sudo dnf install libsodium # Fedora
```

16
### Install dependencies before installing
17 18 19 20 21

```bash
sudo apt install python3-pip libssl-dev
```

22
On Ubuntu (14.04 and 16.04) and Debian 8, you need this package too:
23 24 25 26
```bash
sudo apt install libffi-dev
```

27
Linux Mint is reported to require the installation of this package too:
Moul's avatar
Moul committed
28
```bash
29 30 31
sudo apt install python3-dev
```

Moul's avatar
Moul committed
32
### Completing `PATH`
33

34 35 36 37 38 39
After intallation, if you get a `bash: silkaj: command not found` error, you should add `~/.local/bin` to your `PATH`:
```bash
echo "export PATH=$PATH:$HOME/.local/bin" >> $HOME/.bashrc
source $HOME/.bashrc
```

40 41 42 43 44 45 46 47 48 49 50 51 52
## macOS
To install Python, run the following command:
```bash
brew install python3
```

`pip3` will automatically be installed with `python3` installation.

Then, install Silkaj with:
```bash
pip3 install silkaj --user
```

Moul's avatar
Moul committed
53
## Windows
54

Moul's avatar
Moul committed
55 56
### Administrator rights
Please note that the administrator rights might be mandatory for some of these operations.
57

Moul's avatar
Moul committed
58
### The `PATH` variable
59

Moul's avatar
Moul committed
60
The main issue on Windows is about finding where are the requested files.
61

Moul's avatar
Moul committed
62
Python must be installed (version 3.5 minimum). For instance https://sourceforge.net/projects/winpython/
63

Moul's avatar
Moul committed
64
You can test that Python is available by opening a command tool (cmd.exe) and running:
65 66 67 68 69
```bash
C:\>python --version
Python 3.6.7
```

Moul's avatar
Moul committed
70
When installing Python, take care to specify the good folder (for instance: `C:\WPy-3670`)
71

Moul's avatar
Moul committed
72
After the installation, you commonly have to add by yourself this folder in the `PATH` environment variable:
73

74
To make it by command tool (cmd.exe):
75
```bash
76
set PATH=%PATH%;C:\WPy-3670\
77
```
Moul's avatar
Moul committed
78
Then you have to exit the cmd tool so that `PATH` variable can be updated internally.
79

Moul's avatar
Moul committed
80
You may right click on computer, then go to Advanced System Parameters and use in the bottom the button Environment Variables.
81

Moul's avatar
Moul committed
82
In order to be able to use silkaj and specifically the OpenSSL binaries, you also have to add the following folder to the `PATH` variable:
83 84 85 86 87 88
C:\WPy-3670\python-3.6.7.amd64\Lib\site-packages\PyQt5\Qt\bin\

```bash
set PATH=%PATH%;C:\WPy-3670\python-3.6.7.amd64\Lib\site-packages\PyQt5\Qt\bin\
```

Moul's avatar
Moul committed
89
### Creating the command file `silkaj.bat`
90

Moul's avatar
Moul committed
91 92
In order to be able to launch silkaj as a Windows command, you have to create a file `silkaj.bat` in the following folder:
`C:\WPy-3670\python-3.6.7.amd64\Scripts\silkaj.bat`
93

Moul's avatar
Moul committed
94
containing:
95
```bash
96 97
rem @echo off
python "%~dpn0" %*
98
```
99

Moul's avatar
Moul committed
100
and then to add this folder into the `PATH` variable:
101 102 103 104
```bash
set PATH=%PATH%;C:\WPy-3670\python-3.6.7.amd64\Scripts\
```

105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
## Install directly from internet (implicitely uses binaries from website Pypi)

Assuming that Python v3 and pip version 3 are installed and available. You can check with:
```bash
pip3 --version
```

### Install for all users

```bash
pip3 install silkaj
```

### Install for current user only

```bash
pip3 install silkaj --user
```

### Upgrade

```bash
pip3 install silkaj --user --upgrade
```

### Uninstall (useful to see the real paths)

```bash
pip3 uninstall silkaj --user
```

### Check silkaj is working

```bash
silkaj info
```

142 143
---

144
## Install from original sources from the forge
145

146
### Retrieve silkaj sources on linux
147 148 149 150 151 152
```bash
sudo apt install git
git clone https://git.duniter.org/clients/python/silkaj.git
cd silkaj
```

Moul's avatar
Moul committed
153
### Retrieve silkaj sources on Windows
154

Moul's avatar
Moul committed
155
First, you have to install the git tool from https://git-scm.com/download/win
156 157 158 159 160 161

Then change directory to where you want to download the sources, for instance:
```bash
cd  ~/appdata/Roaming/
```

Moul's avatar
Moul committed
162
Then download Silkaj sources (`dev` branch) with git tool
163 164 165 166
which will create a folder silkaj

```bash
 git clone https://git.duniter.org/clients/python/silkaj.git
167 168
```

169 170 171 172 173
Then change directory to the downloaded folder
```bash
 cd ~/appdata/Roaming/silkaj
```

Moul's avatar
Moul committed
174
### Install
175

Moul's avatar
Moul committed
176
After being sure you have changed directory to the downloaded folder
177 178 179 180 181 182 183 184
```bash
pip3 install .
```

Or install it as "editable", for development:
```bash
pip3 install -e .
```