« Annexes:Python » : différence entre les versions

De WikiFr_dbSQWare
Aller à la navigation Aller à la recherche
Aucun résumé des modifications
 
(19 versions intermédiaires par 2 utilisateurs non affichées)
Ligne 16 : Ligne 16 :
==Installation==
==Installation==
===Installation de Python-3.12.8===
===Installation de Python-3.12.8===
Téléchargez les sources et mettez-les dans /tmp :
<pre>
<pre>
# Install Python-3.12.8
# Install Python-3.12.8
Ligne 23 : Ligne 22 :


<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
# From : root@vmsqwarebox
## Pour la compil Python
dnf install -y zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel findutils ncurses-devel
# From : dbsqware@vmsqwarebox
# From : dbsqware@vmsqwarebox


mkdir /home/dbsqware/dbSQWare/SQWarePredict/python-src
mkdir -p $HOME/dbSQWare/SQWarePredict/python-src
mkdir -p /home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8
mkdir -p $HOME/dbSQWare/SQWarePredict/python/3.12.8
cd /home/dbsqware/dbSQWare/SQWarePredict/python-src
</syntaxhighlight>
 
====Récupération des sources pour une installation avec accès internet====
Téléchargez les sources et mettez-les dans /tmp :
<syntaxhighlight lang="sh" line>
# From : dbsqware@vmsqwarebox
 
cd /tmp
wget https://www.python.org/ftp/python/3.12.8/Python-3.12.8.tgz
cd $HOME/dbSQWare/SQWarePredict/python-src
tar -xzvf /tmp/Python-3.12.8.tgz
tar -xzvf /tmp/Python-3.12.8.tgz
cd Python-3.12.8


# configure, dest => /home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8
</syntaxhighlight>
./configure --prefix=/home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8 --enable-optimizations
 
====Récupération des sources pour une installation sans accès internet====
Téléchargez les sources depuis ce ticket https://support.dbsqware.com/view.php?id=497 et mettez-les dans /tmp :
<syntaxhighlight lang="sh" line>
# From : dbsqware@vmsqwarebox
 
cd $HOME/dbSQWare/SQWarePredict
tar -xzvf /tmp/python-src.tgz
 
cd python-src
tar -xzvf Python-3.12.8.tgz
 
</syntaxhighlight>
 
====Build====
 
<syntaxhighlight lang="sh" line>
cd $HOME/dbSQWare/SQWarePredict/python-src/Python-3.12.8
 
# configure, dest => $HOME/dbSQWare/SQWarePredict/python/3.12.8
./configure --prefix=$HOME/dbSQWare/SQWarePredict/python/3.12.8 --enable-optimizations
</syntaxhighlight>
</syntaxhighlight>


Ligne 42 : Ligne 73 :
checking for --with-universal-archs... no
checking for --with-universal-archs... no
...
...
config.status: creating pyconfig.h
configure: creating Modules/Setup.local
configure: creating Makefile
</pre>
</pre>


Ligne 54 : Ligne 89 :
# enabled.
# enabled.
make profile-gen-stamp
make profile-gen-stamp
make[1]: Entering directory '/home/dbsqware/dbSQWare/SQWarePredict/python-src/Python-3.12.8'
make[1]: Entering directory '$HOME/dbSQWare/SQWarePredict/python-src/Python-3.12.8'
make clean
make clean
make[2]: Entering directory '/home/dbsqware/dbSQWare/SQWarePredict/python-src/Python-3.12.8'
make[2]: Entering directory '$HOME/dbSQWare/SQWarePredict/python-src/Python-3.12.8'
find . -depth -name '__pycache__' -exec rm -rf {} ';'
find . -depth -name '__pycache__' -exec rm -rf {} ';'
...
...
Checked 111 modules (31 built-in, 74 shared, 1 n/a on linux-x86_64, 0 disabled, 5 missing, 0 failed on import)
make[1]: Leaving directory '/home/dbsqware/dbSQWare/SQWarePredict/python-src/Python-3.12.8'
</pre>
</pre>


Ligne 67 : Ligne 107 :


<pre>
<pre>
Creating directory /home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8/bin
Creating directory $HOME/dbSQWare/SQWarePredict/python/3.12.8/bin
Creating directory /home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8/lib
Creating directory $HOME/dbSQWare/SQWarePredict/python/3.12.8/lib
if test "no-framework" = "no-framework" ; then \
if test "no-framework" = "no-framework" ; then \
         /usr/bin/install -c python /home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8/bin/python3.9; \
         /usr/bin/install -c python $HOME/dbSQWare/SQWarePredict/python/3.12.8/bin/python3.9; \
...
...
...
...
Installing collected packages: setuptools, pip
Installing collected packages: setuptools, pip
   WARNING: The scripts pip3 and pip3.9 are installed in '/home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8/bin' which is not on PATH.
   WARNING: The scripts pip3 and pip3.9 are installed in '$HOME/dbSQWare/SQWarePredict/python/3.12.8/bin' which is not on PATH.
   Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
   Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-23.0.1 setuptools-58.1.0
Successfully installed pip-23.0.1 setuptools-58.1.0
Ligne 81 : Ligne 121 :
<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
# creation des liens python et pip
# creation des liens python et pip
cd /home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8/bin
cd $HOME/dbSQWare/SQWarePredict/python/3.12.8/bin
ln -s python3 python
ln -s python3 python
ln -s pip3 pip
ln -s pip3 pip
Ligne 90 : Ligne 130 :
<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
# env Python 3.12.8 (pour SQWarePredict)
# env Python 3.12.8 (pour SQWarePredict)
export PATH=/home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8/bin:$PATH
export PATH=$HOME/dbSQWare/SQWarePredict/python/3.12.8/bin:$PATH
export LD_LIBRARY_PATH=/home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/dbSQWare/SQWarePredict/python/3.12.8/lib:$LD_LIBRARY_PATH
</syntaxhighlight>
</syntaxhighlight>


<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
# on sourcve le .bash_profile
. $HOME/.bash_profile
# vérification du PATH
# vérification du PATH


dbsqware@vmsqwarebox:/home/dbsqware $ type python
dbsqware@vmsqwarebox:$HOME $ type python
python is /home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8/bin/python
python is $HOME/dbSQWare/SQWarePredict/python/3.12.8/bin/python


dbsqware@vmsqwarebox:/home/dbsqware $ type pip
dbsqware@vmsqwarebox:$HOME $ type pip
pip is /home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8/bin/pip
pip is $HOME/dbSQWare/SQWarePredict/python/3.12.8/bin/pip


</syntaxhighlight>
</syntaxhighlight>
Ligne 108 : Ligne 152 :
# vérification des versions
# vérification des versions


dbsqware@vmsqwarebox:/home/dbsqware $ python --version
dbsqware@vmsqwarebox:$HOME $ python --version
Python 3.12.8
Python 3.12.8


dbsqware@vmsqwarebox:/home/dbsqware $ pip --version
dbsqware@vmsqwarebox:$HOME $ pip --version
pip 24.3.1 from /home/dbsqware/dbSQWare/SQWarePredict/python/3.12.8/lib/python3.12/site-packages/pip (python 3.12)
pip 24.3.1 from $HOME/dbSQWare/SQWarePredict/python/3.12.8/lib/python3.12/site-packages/pip (python 3.12)


</syntaxhighlight>
</syntaxhighlight>
Ligne 118 : Ligne 162 :
<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
## Mise en place de l'env Python
## Mise en place de l'env Python
python -m venv /home/dbsqware/dbSQWare/SQWarePredict/python/SQWarePredict-python-env-3.12.8
python -m venv $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env-3.12.8
cd /home/dbsqware/dbSQWare/SQWarePredict/python
cd $HOME/dbSQWare/SQWarePredict/python
ll SQWarePredict-python-env-3.12.8
ll SQWarePredict-python-env-3.12.8
ln -s SQWarePredict-python-env-3.12.8 SQWarePredict-python-env
ln -s SQWarePredict-python-env-3.12.8 SQWarePredict-python-env
. /home/dbsqware/dbSQWare/SQWarePredict/python/SQWarePredict-python-env/bin/activate
. $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env/bin/activate


</syntaxhighlight>
</syntaxhighlight>


<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
dbsqware@vmsqwarebox:/home/dbsqware $ type python
dbsqware@vmsqwarebox:$HOME $ type python
python is /home/dbsqware/dbSQWare/SQWarePredict/python/SQWarePredict-python-env-3.12.8/bin/python
python is $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env-3.12.8/bin/python


dbsqware@vmsqwarebox:/home/dbsqware $ type pip
dbsqware@vmsqwarebox:$HOME $ type pip
pip is /home/dbsqware/dbSQWare/SQWarePredict/python/SQWarePredict-python-env-3.12.8/bin/pip
pip is $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env-3.12.8/bin/pip


dbsqware@vmsqwarebox:/home/dbsqware $ python --version
dbsqware@vmsqwarebox:$HOME $ python --version
Python 3.12.8
Python 3.12.8


dbsqware@vmsqwarebox:/home/dbsqware $ pip --version
dbsqware@vmsqwarebox:$HOME $ pip --version
pip 24.3.1 from /home/dbsqware/dbSQWare/SQWarePredict/python/SQWarePredict-python-env-3.12.8/lib/python3.12/site-packages/pip (python 3.12)
pip 24.3.1 from $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env-3.12.8/lib/python3.12/site-packages/pip (python 3.12)


</syntaxhighlight>
</syntaxhighlight>


<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
(SQWarePredict-python-env-3.12.8) dbsqware@srvdbsqware04:/home/dbsqware $ pip list
(SQWarePredict-python-env-3.12.8) dbsqware@srvdbsqware04:$HOME $ pip list


Package Version
Package Version
Ligne 155 : Ligne 199 :
<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
# Activation de l'env (si pas déjà fait !)
# Activation de l'env (si pas déjà fait !)
. /home/dbsqware/dbSQWare/SQWarePredict/python/SQWarePredict-python-env/bin/activate
. $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env/bin/activate
</syntaxhighlight>
 
====Installation des dépendances avec accès internet====


<syntaxhighlight lang="sh" line>
# Dépendances pip
# Dépendances pip
(SQWarePredict-python-env-3.12.8) dbsqware@srvdbsqware04:/home/dbsqware/dbSQWare/SQWarePredict/python $ pip install --upgrade pip setuptools wheel
(SQWarePredict-python-env-3.12.8) dbsqware@srvdbsqware04:$HOME/dbSQWare/SQWarePredict/python $ pip install --upgrade pip setuptools wheel
</syntaxhighlight>
</syntaxhighlight>


Ligne 170 : Ligne 218 :
   ???????????????????????????????????????? 1.2/1.2 MB 14.4 MB/s eta 0:00:00
   ???????????????????????????????????????? 1.2/1.2 MB 14.4 MB/s eta 0:00:00
Downloading wheel-0.45.1-py3-none-any.whl (72 kB)
Downloading wheel-0.45.1-py3-none-any.whl (72 kB)
Installing collected packages: wheel, setuptools
Installing collected packages: wheel, setuptools, pip
Successfully installed setuptools-75.8.0 wheel-0.45.1
  Attempting uninstall: pip
    Found existing installation: pip 24.3.1
    Uninstalling pip-24.3.1:
      Successfully uninstalled pip-24.3.1
Successfully installed pip-25.0.1 setuptools-75.8.0 wheel-0.45.1
 
</pre>
</pre>


<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
# Install dependances
# Install dependances
cd /home/dbsqware/dbSQWare/SQWarePredict/engine/
cd $HOME/dbSQWare/SQWarePredict/engine/
pip install .
pip install .


Ligne 182 : Ligne 235 :


<pre>
<pre>
Processing /home/dbsqware/dbSQWare/SQWarePredict/engine
Processing $HOME/dbSQWare/SQWarePredict/engine
   Installing build dependencies ... done
   Installing build dependencies ... done
   Getting requirements to build wheel ... done
   Getting requirements to build wheel ... done
Ligne 194 : Ligne 247 :
Successfully installed SQWarePredict-1.0 contourpy-1.3.1 cycler-0.12.1 fonttools-4.55.3 kiwisolver-1.4.8 matplotlib-3.10.0 mysql-connector-python-9.1.0 numpy-2.2.1 packaging-24.2 pandas-2.2.3 patsy-1.0.1 pillow-11.1.0 pyparsing-3.2.1 python-dateutil-2.9.0.post0 python-dotenv-1.0.1 pytz-2024.2 scipy-1.15.0 seaborn-0.13.2 six-1.17.0 statsmodels-0.14.4 toml-0.10.2 tzdata-2024.2
Successfully installed SQWarePredict-1.0 contourpy-1.3.1 cycler-0.12.1 fonttools-4.55.3 kiwisolver-1.4.8 matplotlib-3.10.0 mysql-connector-python-9.1.0 numpy-2.2.1 packaging-24.2 pandas-2.2.3 patsy-1.0.1 pillow-11.1.0 pyparsing-3.2.1 python-dateutil-2.9.0.post0 python-dotenv-1.0.1 pytz-2024.2 scipy-1.15.0 seaborn-0.13.2 six-1.17.0 statsmodels-0.14.4 toml-0.10.2 tzdata-2024.2
</pre>
</pre>
====Installation des dépendances sans accès internet====
<syntaxhighlight lang="sh" line>
# Dépendances pip
(SQWarePredict-python-env-3.12.8) dbsqware@srvdbsqware04:$HOME/dbSQWare/SQWarePredict/python $ pip install --no-index --find-links=$HOME/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict --upgrade pip setuptools wheel
</syntaxhighlight>
<pre>
Looking in links: /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict
Requirement already satisfied: pip in ./SQWarePredict-python-env-3.12.8/lib/python3.12/site-packages (24.3.1)
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/pip-25.0.1-py3-none-any.whl
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/setuptools-75.8.0-py3-none-any.whl
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/wheel-0.45.1-py3-none-any.whl
Installing collected packages: wheel, setuptools, pip
  Attempting uninstall: pip
    Found existing installation: pip 24.3.1
    Uninstalling pip-24.3.1:
      Successfully uninstalled pip-24.3.1
Successfully installed pip-25.0.1 setuptools-75.8.0 wheel-0.45.1
</pre>
<syntaxhighlight lang="sh" line>
# Install dependances
cd $HOME/dbSQWare/SQWarePredict/engine/
pip install --no-index --find-links=$HOME/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict -r $HOME/dbSQWare/SQWarePredict/python-src/requirements.txt
</syntaxhighlight>
<pre>
Looking in links: /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/contourpy-1.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 1))
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/cycler-0.12.1-py3-none-any.whl (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 2))
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/fonttools-4.55.3-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 3))
...
...
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/toml-0.10.2-py2.py3-none-any.whl (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 21))
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/tzdata-2024.2-py2.py3-none-any.whl (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 22))
Requirement already satisfied: wheel>=0.45.1 in ./SQWarePredict-python-env-3.12.8/lib/python3.12/site-packages (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 23)) (0.45.1)
Requirement already satisfied: pip>=24.3.1 in ./SQWarePredict-python-env-3.12.8/lib/python3.12/site-packages (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 24)) (25.0.1)
Installing collected packages: pytz, tzdata, toml, six, python-dotenv, pyparsing, pillow, packaging, numpy, mysql-connector-python, kiwisolver, fonttools, cycler, scipy, python-dateutil, patsy, contourpy, pandas, matplotlib, statsmodels, seaborn
Successfully installed contourpy-1.3.1 cycler-0.12.1 fonttools-4.55.3 kiwisolver-1.4.8 matplotlib-3.10.0 mysql-connector-python-9.1.0 numpy-2.2.1 packaging-24.2 pandas-2.2.3 patsy-1.0.1 pillow-11.1.0 pyparsing-3.2.1 python-dateutil-2.9.0.post0 python-dotenv-1.0.1 pytz-2024.2 scipy-1.15.0 seaborn-0.13.2 six-1.17.0 statsmodels-0.14.4 toml-0.10.2 tzdata-2024.2
</pre>
====Check des dépendances====


<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
Ligne 215 : Ligne 314 :
patsy                  1.0.1
patsy                  1.0.1
pillow                11.1.0
pillow                11.1.0
pip                    24.3.1
pip                    25.0.1
pyparsing              3.2.1
pyparsing              3.2.1
python-dateutil        2.9.0.post0
python-dateutil        2.9.0.post0
Ligne 224 : Ligne 323 :
setuptools            75.8.0
setuptools            75.8.0
six                    1.17.0
six                    1.17.0
SQWarePredict          1.0
statsmodels            0.14.4
statsmodels            0.14.4
toml                  0.10.2
toml                  0.10.2
Ligne 236 : Ligne 334 :
<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
# Paramétrage des accès à la db (vous pouvez créer un nouveau compte ou utiliser celui de SQWareCentral !)
# Paramétrage des accès à la db (vous pouvez créer un nouveau compte ou utiliser celui de SQWareCentral !)
cd /home/dbsqware/dbSQWare/SQWarePredict/engine
cd $HOME/dbSQWare/SQWarePredict/engine
cat sqwarepredict.ini
cat sqwarepredict.ini
</syntaxhighlight>
</syntaxhighlight>
Ligne 254 : Ligne 352 :
<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
# Activation de l'env et test de 'Predict'
# Activation de l'env et test de 'Predict'
. /home/dbsqware/dbSQWare/SQWarePredict/python/SQWarePredict-python-env/bin/activate
. $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env/bin/activate
cd /home/dbsqware/dbSQWare/SQWarePredict/engine
cd $HOME/dbSQWare/SQWarePredict/engine
python -m bin.predict -i sql -f /home/dbsqware/dbSQWare/SQWarePredict/param/generic/InstanceGrowth_size.ini -l Instance=SQWareCentral NbMonth=24 -m 6
python -m bin.predict -i sql -f $HOME/dbSQWare/SQWarePredict/param/generic/InstanceGrowth_size.ini -l Instance=SQWareCentral NbMonth=24 -m 6


</syntaxhighlight>
</syntaxhighlight>
Ligne 263 : Ligne 361 :
<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>
# Activation de l'environnement Python
# Activation de l'environnement Python
. /home/dbsqware/dbSQWare/SQWarePredict/python/SQWarePredict-python-env/bin/activate
. $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env/bin/activate
## Vous avez (SQWarePredict-python-env-3.12.8) qui s'affiche avant le prompt !
## Vous avez (SQWarePredict-python-env-3.12.8) qui s'affiche avant le prompt !



Dernière version du 11 février 2025 à 17:11

Généralités

Limites de cette section

Cette section n’a pas la prétention de traiter tous les cas possibles d'installation de Python …
Le principe est d'avoir la bonne version et ses dépendances pour le module SQWarePredict.

Avant de vous lancer dans l’installation, vous devez d'abord avoir la version de dbSQWare avec SQWarePredict (v2025.01 mini) pour avoir les dépendances.

Principe

Nous allons :

  • Installer Python-3.12.8
  • Configurer l'environnement
  • Installer les dépendances
  • Paramétrer et tester SQWarePredict

Installation

Installation de Python-3.12.8

# Install Python-3.12.8
# https://www.python.org/ftp/python/3.12.8/Python-3.12.8.tgz
# From : root@vmsqwarebox
## Pour la compil Python
dnf install -y zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel findutils ncurses-devel

# From : dbsqware@vmsqwarebox

mkdir -p $HOME/dbSQWare/SQWarePredict/python-src
mkdir -p $HOME/dbSQWare/SQWarePredict/python/3.12.8

Récupération des sources pour une installation avec accès internet

Téléchargez les sources et mettez-les dans /tmp :

# From : dbsqware@vmsqwarebox

cd /tmp
wget https://www.python.org/ftp/python/3.12.8/Python-3.12.8.tgz
cd $HOME/dbSQWare/SQWarePredict/python-src
tar -xzvf /tmp/Python-3.12.8.tgz

Récupération des sources pour une installation sans accès internet

Téléchargez les sources depuis ce ticket https://support.dbsqware.com/view.php?id=497 et mettez-les dans /tmp :

# From : dbsqware@vmsqwarebox

cd $HOME/dbSQWare/SQWarePredict
tar -xzvf /tmp/python-src.tgz

cd python-src
tar -xzvf Python-3.12.8.tgz

Build

cd $HOME/dbSQWare/SQWarePredict/python-src/Python-3.12.8

# configure, dest => $HOME/dbSQWare/SQWarePredict/python/3.12.8
./configure --prefix=$HOME/dbSQWare/SQWarePredict/python/3.12.8 --enable-optimizations
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.9... python3.9
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
...
config.status: creating pyconfig.h
configure: creating Modules/Setup.local
configure: creating Makefile

# compil
make
Running code to generate profile data (this can take a while):
# First, we need to create a clean build with profile generation
# enabled.
make profile-gen-stamp
make[1]: Entering directory '$HOME/dbSQWare/SQWarePredict/python-src/Python-3.12.8'
make clean
make[2]: Entering directory '$HOME/dbSQWare/SQWarePredict/python-src/Python-3.12.8'
find . -depth -name '__pycache__' -exec rm -rf {} ';'

...

Checked 111 modules (31 built-in, 74 shared, 1 n/a on linux-x86_64, 0 disabled, 5 missing, 0 failed on import)
make[1]: Leaving directory '/home/dbsqware/dbSQWare/SQWarePredict/python-src/Python-3.12.8'

# install
make install
Creating directory $HOME/dbSQWare/SQWarePredict/python/3.12.8/bin
Creating directory $HOME/dbSQWare/SQWarePredict/python/3.12.8/lib
if test "no-framework" = "no-framework" ; then \
        /usr/bin/install -c python $HOME/dbSQWare/SQWarePredict/python/3.12.8/bin/python3.9; \
...
...
Installing collected packages: setuptools, pip
  WARNING: The scripts pip3 and pip3.9 are installed in '$HOME/dbSQWare/SQWarePredict/python/3.12.8/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-23.0.1 setuptools-58.1.0
# creation des liens python et pip
cd $HOME/dbSQWare/SQWarePredict/python/3.12.8/bin
ln -s python3 python
ln -s pip3 pip

Mise à jour de l'environnement

Dans le ~dbsqware/.bash_profile

# env Python 3.12.8 (pour SQWarePredict)
export PATH=$HOME/dbSQWare/SQWarePredict/python/3.12.8/bin:$PATH
export LD_LIBRARY_PATH=$HOME/dbSQWare/SQWarePredict/python/3.12.8/lib:$LD_LIBRARY_PATH
# on sourcve le .bash_profile
. $HOME/.bash_profile


# vérification du PATH

dbsqware@vmsqwarebox:$HOME $ type python
python is $HOME/dbSQWare/SQWarePredict/python/3.12.8/bin/python

dbsqware@vmsqwarebox:$HOME $ type pip
pip is $HOME/dbSQWare/SQWarePredict/python/3.12.8/bin/pip
# vérification des versions

dbsqware@vmsqwarebox:$HOME $ python --version
Python 3.12.8

dbsqware@vmsqwarebox:$HOME $ pip --version
pip 24.3.1 from $HOME/dbSQWare/SQWarePredict/python/3.12.8/lib/python3.12/site-packages/pip (python 3.12)
## Mise en place de l'env Python
python -m venv $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env-3.12.8
cd $HOME/dbSQWare/SQWarePredict/python
ll SQWarePredict-python-env-3.12.8
ln -s SQWarePredict-python-env-3.12.8 SQWarePredict-python-env
. $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env/bin/activate
dbsqware@vmsqwarebox:$HOME $ type python
python is $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env-3.12.8/bin/python

dbsqware@vmsqwarebox:$HOME $ type pip
pip is $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env-3.12.8/bin/pip

dbsqware@vmsqwarebox:$HOME $ python --version
Python 3.12.8

dbsqware@vmsqwarebox:$HOME $ pip --version
pip 24.3.1 from $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env-3.12.8/lib/python3.12/site-packages/pip (python 3.12)
(SQWarePredict-python-env-3.12.8) dbsqware@srvdbsqware04:$HOME $ pip list

Package Version
------- -------
pip     24.3.1

Installation des dépendances

Attention, il faut avoir activé l'environnement "SQWarePredict-python-env" !

# Activation de l'env (si pas déjà fait !)
. $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env/bin/activate

Installation des dépendances avec accès internet

# Dépendances pip
(SQWarePredict-python-env-3.12.8) dbsqware@srvdbsqware04:$HOME/dbSQWare/SQWarePredict/python $ pip install --upgrade pip setuptools wheel
Requirement already satisfied: pip in ./SQWarePredict-python-env-3.12.8/lib/python3.12/site-packages (24.3.1)
Collecting setuptools
  Downloading setuptools-75.8.0-py3-none-any.whl.metadata (6.7 kB)
Collecting wheel
  Downloading wheel-0.45.1-py3-none-any.whl.metadata (2.3 kB)
Downloading setuptools-75.8.0-py3-none-any.whl (1.2 MB)
   ???????????????????????????????????????? 1.2/1.2 MB 14.4 MB/s eta 0:00:00
Downloading wheel-0.45.1-py3-none-any.whl (72 kB)
Installing collected packages: wheel, setuptools, pip
  Attempting uninstall: pip
    Found existing installation: pip 24.3.1
    Uninstalling pip-24.3.1:
      Successfully uninstalled pip-24.3.1
Successfully installed pip-25.0.1 setuptools-75.8.0 wheel-0.45.1

# Install dependances
cd $HOME/dbSQWare/SQWarePredict/engine/
pip install .
Processing $HOME/dbSQWare/SQWarePredict/engine
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting contourpy==1.3.1 (from SQWarePredict==1.0)
....
....
  Stored in directory: /tmp/pip-ephem-wheel-cache-l9urxsek/wheels/fb/0f/e3/8209d088cd9c825dd311fd9cbf83a320192744186bdc99b5ec
Successfully built SQWarePredict
Installing collected packages: pytz, tzdata, toml, six, python-dotenv, pyparsing, pillow, packaging, numpy, mysql-connector-python, kiwisolver, fonttools, cycler, scipy, python-dateutil, patsy, contourpy, pandas, matplotlib, statsmodels, seaborn, SQWarePredict
Successfully installed SQWarePredict-1.0 contourpy-1.3.1 cycler-0.12.1 fonttools-4.55.3 kiwisolver-1.4.8 matplotlib-3.10.0 mysql-connector-python-9.1.0 numpy-2.2.1 packaging-24.2 pandas-2.2.3 patsy-1.0.1 pillow-11.1.0 pyparsing-3.2.1 python-dateutil-2.9.0.post0 python-dotenv-1.0.1 pytz-2024.2 scipy-1.15.0 seaborn-0.13.2 six-1.17.0 statsmodels-0.14.4 toml-0.10.2 tzdata-2024.2

Installation des dépendances sans accès internet

# Dépendances pip
(SQWarePredict-python-env-3.12.8) dbsqware@srvdbsqware04:$HOME/dbSQWare/SQWarePredict/python $ pip install --no-index --find-links=$HOME/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict --upgrade pip setuptools wheel
Looking in links: /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict
Requirement already satisfied: pip in ./SQWarePredict-python-env-3.12.8/lib/python3.12/site-packages (24.3.1)
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/pip-25.0.1-py3-none-any.whl
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/setuptools-75.8.0-py3-none-any.whl
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/wheel-0.45.1-py3-none-any.whl
Installing collected packages: wheel, setuptools, pip
  Attempting uninstall: pip
    Found existing installation: pip 24.3.1
    Uninstalling pip-24.3.1:
      Successfully uninstalled pip-24.3.1
Successfully installed pip-25.0.1 setuptools-75.8.0 wheel-0.45.1

# Install dependances
cd $HOME/dbSQWare/SQWarePredict/engine/
pip install --no-index --find-links=$HOME/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict -r $HOME/dbSQWare/SQWarePredict/python-src/requirements.txt
Looking in links: /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/contourpy-1.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 1))
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/cycler-0.12.1-py3-none-any.whl (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 2))
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/fonttools-4.55.3-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 3))
...
...
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/toml-0.10.2-py2.py3-none-any.whl (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 21))
Processing /home/dbsqware/dbSQWare/SQWarePredict/python-src/LocalPipPackages_SQWarePredict/tzdata-2024.2-py2.py3-none-any.whl (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 22))
Requirement already satisfied: wheel>=0.45.1 in ./SQWarePredict-python-env-3.12.8/lib/python3.12/site-packages (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 23)) (0.45.1)
Requirement already satisfied: pip>=24.3.1 in ./SQWarePredict-python-env-3.12.8/lib/python3.12/site-packages (from -r /home/dbsqware/dbSQWare/SQWarePredict/python-src/requirements.txt (line 24)) (25.0.1)
Installing collected packages: pytz, tzdata, toml, six, python-dotenv, pyparsing, pillow, packaging, numpy, mysql-connector-python, kiwisolver, fonttools, cycler, scipy, python-dateutil, patsy, contourpy, pandas, matplotlib, statsmodels, seaborn
Successfully installed contourpy-1.3.1 cycler-0.12.1 fonttools-4.55.3 kiwisolver-1.4.8 matplotlib-3.10.0 mysql-connector-python-9.1.0 numpy-2.2.1 packaging-24.2 pandas-2.2.3 patsy-1.0.1 pillow-11.1.0 pyparsing-3.2.1 python-dateutil-2.9.0.post0 python-dotenv-1.0.1 pytz-2024.2 scipy-1.15.0 seaborn-0.13.2 six-1.17.0 statsmodels-0.14.4 toml-0.10.2 tzdata-2024.2

Check des dépendances

# Check des dépendances
pip list
Package                Version
---------------------- -----------
contourpy              1.3.1
cycler                 0.12.1
fonttools              4.55.3
kiwisolver             1.4.8
matplotlib             3.10.0
mysql-connector-python 9.1.0
numpy                  2.2.1
packaging              24.2
pandas                 2.2.3
patsy                  1.0.1
pillow                 11.1.0
pip                    25.0.1
pyparsing              3.2.1
python-dateutil        2.9.0.post0
python-dotenv          1.0.1
pytz                   2024.2
scipy                  1.15.0
seaborn                0.13.2
setuptools             75.8.0
six                    1.17.0
statsmodels            0.14.4
toml                   0.10.2
tzdata                 2024.2
wheel                  0.45.1

Paramétrer et tester SQWarePredict

Paramétrage de SQWarePredict

# Paramétrage des accès à la db (vous pouvez créer un nouveau compte ou utiliser celui de SQWareCentral !)
cd $HOME/dbSQWare/SQWarePredict/engine
cat sqwarepredict.ini
# Credentials for SQWarePredict

[db]
MysqlHost="localhost"
MysqlUser="sqware_predict"
MysqlPass="SQWarePredict1234."
MysqlDb="dbsqware_db"
MysqlPort=3306

Test de fonctionnement

# Activation de l'env et test de 'Predict'
. $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env/bin/activate
cd $HOME/dbSQWare/SQWarePredict/engine
python -m bin.predict -i sql -f $HOME/dbSQWare/SQWarePredict/param/generic/InstanceGrowth_size.ini -l Instance=SQWareCentral NbMonth=24 -m 6

Activer/désactiver l'environnement Python

# Activation de l'environnement Python
. $HOME/dbSQWare/SQWarePredict/python/SQWarePredict-python-env/bin/activate
## Vous avez (SQWarePredict-python-env-3.12.8) qui s'affiche avant le prompt !

# Désactivation de l'environnement Python (deactivate se déclare lors du source de l'env)
deactivate
## Vous retrouvez votre prompt d'origine