Ladybug

Tout ce qui concerne la programmation.
Répondre
Avatar de l’utilisateur
debianjam
Membre
Membre
Messages : 388
Inscription : 27 août 2017, 14:18
Status : Hors-ligne

Bonjour,

(Je viens d'installer Debian 13, avant j'utilisais Debian 11).

Je voudrais pouvoir utiliser le programme Ladybug qui est une bibliothèque Python permettant d'analyser, modifier et visualiser des informations de EnergyPlus Wheather files (epw).

Voici un lien vers Ladybug Tools : https://www.ladybug.tools/ladybug.html
Voici le lien sur Github : https://github.com/ladybug-tools/ladybug
Dans le forum Ladybug voici une réponse en bas de page d'un développeur mostapha en 2021 : https://discourse.ladybug.tools/t/ladyb ... inux/14115 qui propose d'accéder à cette page https://github.com/ladybug-tools/lbt-recipes
Ayant un peu manipulé toutes ces informations mais je n'arrive à rien, quelqu'un peut il m'aider si c'est possible ?
Gnome ; mémoire : 3,7Gio; i5 3450 @3.10Ghz x4; c.g. (NV106 (intégrée Intel Ivybridge Desktop)) ou asus gt730 2Gio
Avatar de l’utilisateur
piratebab
Site Admin
Site Admin
Messages : 6061
Inscription : 24 avr. 2016, 18:41
Localisation : sud ouest
Status : Hors-ligne

Bonjour,
est ce que tu as réussi à l'installer via pip ?
Est ce que tu as réussi à faire fonctionner l'exmple de la doc?

Code : Tout sélectionner

# load epw weather data
from ladybug.epw import EPW
epw_data = EPW('path_to_epw_file')
dry_bulb_temp = epw_data.dry_bulb_temperature

# Get altitude and longitude
from ladybug.location import Location
from ladybug.sunpath import Sunpath

# Create location. You can also extract location data from an epw file.
sydney = Location('Sydney', 'AUS', latitude=-33.87, longitude=151.22, time_zone=10)

# Initiate sunpath
sp = Sunpath.from_location(sydney)
sun = sp.calculate_sun(month=11, day=15, hour=11.0)

print('altitude: {}, azimuth: {}'.format(sun.altitude, sun.azimuth))
Je déplace se sujet dans le forum dédié au codage.
Avatar de l’utilisateur
debianjam
Membre
Membre
Messages : 388
Inscription : 27 août 2017, 14:18
Status : Hors-ligne

Bonjour.

Selon cette page : https://github.com/ladybug-tools/lbt-re ... stallation
Voici la traduction dans le terminal, la réponse est qu'il s'agit d'un environnement extérieur. Ensuite je ne sais plus quoi faire.

Code : Tout sélectionner

utilisateur1@debian:~$ pip install -U lbt-recipes
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.13/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
utilisateur1@debian:~$ ^C
utilisateur1@debian:~$ python3 -m venv path/to/venv
utilisateur1@debian:~$ ^C
utilisateur1@debian:~$ path/to/venv/bin/python
Python 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help
Welcome to Python 3.13's help utility! If this is your first time using
Python, you should definitely check out the tutorial at
https://docs.python.org/3.13/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To get a list of available
modules, keywords, symbols, or topics, enter "modules", "keywords",
"symbols", or "topics".

Each module also comes with a one-line summary of what it does; to list
the modules whose name or summary contain a given string such as "spam",
enter "modules spam".

To quit this help utility and return to the interpreter,
enter "q", "quit" or "exit".

help> q

You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)".  Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
>>> q
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    q
NameError: name 'q' is not defined
>>> quit
utilisateur1@debian:~$ ^C
utilisateur1@debian:~$ 
Gnome ; mémoire : 3,7Gio; i5 3450 @3.10Ghz x4; c.g. (NV106 (intégrée Intel Ivybridge Desktop)) ou asus gt730 2Gio
Avatar de l’utilisateur
piratebab
Site Admin
Site Admin
Messages : 6061
Inscription : 24 avr. 2016, 18:41
Localisation : sud ouest
Status : Hors-ligne

Il faut utiliser pipx au lieu de pip sur debian. pipx va gérer automatiquement les environnement virtuel.
Un environnement virtuel sert à isoler les script python qui ne sont pas d'origine debian de ton systeme principal. Ca évite de casser ton systeme si le script a un problème.
Avatar de l’utilisateur
debianjam
Membre
Membre
Messages : 388
Inscription : 27 août 2017, 14:18
Status : Hors-ligne

Effectivement ça marche. Il faut attendre environ 5 minutes avant que le résultat apparaisse, il y a un petit sablier tournant à gauche de la ligne d'installation.
Pour préciser j'ai supprimé le -U :

Code : Tout sélectionner

pipx install lbt-recipes
Gnome ; mémoire : 3,7Gio; i5 3450 @3.10Ghz x4; c.g. (NV106 (intégrée Intel Ivybridge Desktop)) ou asus gt730 2Gio
Avatar de l’utilisateur
debianjam
Membre
Membre
Messages : 388
Inscription : 27 août 2017, 14:18
Status : Hors-ligne

Bonjour, merci beaucoup pour votre aide.
Après cette page https://discourse.ladybug.tools/t/ladyb ... ux/14115/3 on arrive sur la page https://github.com/ladybug-tools/lbt-re ... evelopment.
Après avoir installé GIT avec synaptic, voici ce que donne le terminal sur la seconde formule de la page (la première formule mène à une erreur).
Après cette commande, j'installe les dépendances prévues (en supprimant le -r de la commande) utilisateur1@debian:~/lbt-recipes$ pipx install dev-requirements.txt et j'ai cette erreur :

Code : Tout sélectionner

utilisateur1@debian:~$ git clone https://github.com/ladybug-tools/lbt-recipes
Clonage dans 'lbt-recipes'...
remote: Enumerating objects: 7021, done.
remote: Counting objects: 100% (116/116), done.
remote: Compressing objects: 100% (74/74), done.
remote: Total 7021 (delta 63), reused 67 (delta 41), pack-reused 6905 (from 2)
Réception d'objets: 100% (7021/7021), 2.26 Mio | 3.97 Mio/s, fait.
Résolution des deltas: 100% (4694/4694), fait.
utilisateur1@debian:~$ cd lbt-recipes
utilisateur1@debian:~/lbt-recipes$ pip install -r dev-requirements.txt
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.13/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
utilisateur1@debian:~/lbt-recipes$ pipx install -r dev-requirements.txt
usage: pipx [-h] [--quiet] [--verbose] [--global] [--version]
            {install,install-all,uninject,inject,pin,unpin,upgrade,upgrade-all,upgrade-shared,uninstall,uninstall-all,reinstall,reinstall-all,list,interpreter,run,runpip,ensurepath,environment,completions} ...
pipx: error: unrecognized arguments: -r
utilisateur1@debian:~/lbt-recipes$ pipx install dev-requirements.txt
Fatal error from pip prevented installation. Full pip output in file:
    /home/utilisateur1/.local/state/pipx/log/cmd_2025-09-07_11.18.38_pip_errors.log

Some possibly relevant errors from pip install:
    ERROR: Could not find a version that satisfies the requirement dev-requirements-txt (from versions: none)
    ERROR: No matching distribution found for dev-requirements-txt

Error installing dev-requirements-txt.
Gnome ; mémoire : 3,7Gio; i5 3450 @3.10Ghz x4; c.g. (NV106 (intégrée Intel Ivybridge Desktop)) ou asus gt730 2Gio
Avatar de l’utilisateur
piratebab
Site Admin
Site Admin
Messages : 6061
Inscription : 24 avr. 2016, 18:41
Localisation : sud ouest
Status : Hors-ligne

C'est pipx, pas pip qu'il faut utiliser.
Essaie pipx en mettant sur la même ligne les 2 scripts python à installer si tu as des problemes d'environnement virtuel?
Avatar de l’utilisateur
debianjam
Membre
Membre
Messages : 388
Inscription : 27 août 2017, 14:18
Status : Hors-ligne

Oui c'est pipx que j'ai utilisé en dernier dans le code en retirant le -r après install
Gnome ; mémoire : 3,7Gio; i5 3450 @3.10Ghz x4; c.g. (NV106 (intégrée Intel Ivybridge Desktop)) ou asus gt730 2Gio
Avatar de l’utilisateur
debianjam
Membre
Membre
Messages : 388
Inscription : 27 août 2017, 14:18
Status : Hors-ligne

voici le code

Code : Tout sélectionner

utilisateur1@debian:~$ pipx install -r dev-requirements.txt pipx install -r requirements.txt
usage: pipx [-h] [--quiet] [--verbose] [--global] [--version]
            {install,install-all,uninject,inject,pin,unpin,upgrade,upgrade-all,upgrade-shared,uninstall,uninstall-all,reinstall,reinstall-all,list,interpreter,run,runpip,ensurepath,environment,completions} ...
pipx: error: unrecognized arguments: -r -r requirements.txt
utilisateur1@debian:~$ pipx install  dev-requirements.txt pipx install  requirements.txt
Fatal error from pip prevented installation. Full pip output in file:
    /home/utilisateur1/.local/state/pipx/log/cmd_2025-09-08_16.59.26_pip_errors.log

Some possibly relevant errors from pip install:
    ERROR: Could not find a version that satisfies the requirement dev-requirements-txt (from versions: none)
    ERROR: No matching distribution found for dev-requirements-txt

Error installing dev-requirements-txt.
voyant les indications j'ai ajouté au hasard -h après pipx et toujours enlevé le -r, il semblerait que ce -h donne juste une aide (help) :

Code : Tout sélectionner

utilisateur1@debian:~$ pipx -h install  dev-requirements.txt pipx -h install  requirements.txt
usage: pipx [-h] [--quiet] [--verbose] [--global] [--version]
            {install,install-all,uninject,inject,pin,unpin,upgrade,upgrade-all,upgrade-shared,uninstall,uninstall-all,reinstall,reinstall-all,list,interpreter,run,runpip,ensurepath,environment,completions} ...

Install and execute apps from Python packages.

Binaries can either be installed globally into isolated Virtual Environments
or run directly in a temporary Virtual Environment.

Virtual Environment location is /home/utilisateur1/.local/share/pipx/venvs.
Symlinks to apps are placed in /home/utilisateur1/.local/bin.
Symlinks to manual pages are placed in /home/utilisateur1/.local/share/man.

optional environment variables:
  PIPX_HOME              Overrides default pipx location. Virtual Environments
                        will be installed to $PIPX_HOME/venvs.
  PIPX_GLOBAL_HOME       Used instead of PIPX_HOME when the `--global` option
                        is given.
  PIPX_BIN_DIR           Overrides location of app installations. Apps are
                        symlinked or copied here.
  PIPX_GLOBAL_BIN_DIR    Used instead of PIPX_BIN_DIR when the `--global`
                        option is given.
  PIPX_MAN_DIR           Overrides location of manual pages installations.
                        Manual pages are symlinked or copied here.
  PIPX_GLOBAL_MAN_DIR    Used instead of PIPX_MAN_DIR when the `--global`
                        option is given.
  PIPX_DEFAULT_PYTHON    Overrides default python used for commands.
  USE_EMOJI              Overrides emoji behavior. Default value varies based
                        on platform.
  PIPX_HOME_ALLOW_SPACE  Overrides default warning on spaces in the home path

options:
  -h, --help            show this help message and exit
  --quiet, -q           Give less output. May be used multiple times
                        corresponding to the ERROR and CRITICAL logging
                        levels. The count maxes out at 2.
  --verbose, -v         Give more output. May be used multiple times
                        corresponding to the INFO, DEBUG and NOTSET logging
                        levels. The count maxes out at 3.
  --global              Perform action globally for all users.
  --version             Print version and exit

subcommands:
  Get help for commands with pipx COMMAND --help

  {install,install-all,uninject,inject,pin,unpin,upgrade,upgrade-all,upgrade-shared,uninstall,uninstall-all,reinstall,reinstall-all,list,interpreter,run,runpip,ensurepath,environment,completions}
    install             Install a package
    install-all         Install all packages
    uninject            Uninstall injected packages from an existing Virtual
                        Environment
    inject              Install packages into an existing Virtual Environment
    pin                 Pin the specified package to prevent it from being
                        upgraded
    unpin               Unpin the specified package
    upgrade             Upgrade a package
    upgrade-all         Upgrade all packages. Runs `pip install -U <pkgname>`
                        for each package.
    upgrade-shared      Upgrade shared libraries.
    uninstall           Uninstall a package
    uninstall-all       Uninstall all packages
    reinstall           Reinstall a package
    reinstall-all       Reinstall all packages
    list                List installed packages
    interpreter         Interact with interpreters managed by pipx
    run                 Download the latest version of a package to a
                        temporary virtual environment, then run an app from
                        it. Also compatible with local `__pypackages__`
                        directory (experimental).
    runpip              Run pip in an existing pipx-managed Virtual
                        Environment
    ensurepath          Ensure directories necessary for pipx operation are in
                        your PATH environment variable.
    environment         Print a list of environment variables and paths used
                        by pipx.
    completions         Print instructions on enabling shell completions for
                        pipx

ensuite j'ai esayé de faire le test avec python qui ne marche pas, j'ai tenté avec python3 et dû installer pytest avec synaptic, voici le code :

Code : Tout sélectionner

utilisateur1@debian:~$ python -m pytest ./tests
bash: python : commande introuvable
utilisateur1@debian:~$ python3 -m pytest ./tests
/usr/bin/python3: No module named pytest
utilisateur1@debian:~$ python3 -m pytest ./tests
============================= test session starts ==============================
platform linux -- Python 3.13.5, pytest-8.3.5, pluggy-1.5.0
benchmark: 5.1.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/utilisateur1
plugins: typeguard-4.4.2, anyio-4.8.0, benchmark-5.1.0
collected 0 items                                                              

============================ no tests ran in 0.01s =============================
ERROR: file or directory not found: ./tests
comme je le disais sur une réponse précédente on se trouve dans le paragraphe LOCAL DEVELOPEMENT, je n''ai pas forcément besoin de ce dévelopement local ? Qu'est ce que ça signifie ?
Après cette page https://discourse.ladybug.tools/t/ladyb ... ux/14115/3 on arrive sur la page https://github.com/ladybug-tools/lbt-re ... evelopment.
Dans ta première réponse tu demandes si j'ai réalisé l'exemple de la doc, non. Je n'arrive à rien écrire de cet exemple.
Gnome ; mémoire : 3,7Gio; i5 3450 @3.10Ghz x4; c.g. (NV106 (intégrée Intel Ivybridge Desktop)) ou asus gt730 2Gio
Avatar de l’utilisateur
piratebab
Site Admin
Site Admin
Messages : 6061
Inscription : 24 avr. 2016, 18:41
Localisation : sud ouest
Status : Hors-ligne

Pourquoi mets tu 2 fois pipx sur la même ligne ?
utilisateur1@debian:~$ pipx install -r dev-requirements.txt pipx install -r requirements.txt
Tu ne devrais avoir besoin que du requirement
L'option -h se contente d'afficher l'aide, elle ne fait rien d'autres.
Dans le manuel de pip, ou pipx, je ne trouve pas l'option -r, je ne sais pas pourquoi elle t'est indiquée.
Si tu veux avoir plus de détails sur la sortie, c'est l'option -v (verbeux)
Répondre