Problème
Lors de l’exécution d’un modèle PySB, vous voyez un message d’erreur tel que
error-output.txt
Exception: The program BioNetGen was not found in the default search path(s) for your operating system:
/usr/local/share/BioNetGen
/usr/bin
/home/user/.local/bin
/home/user/.pyenv/shims
/home/user/.pyenv/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/sbin
/bin
/usr/games
/usr/local/games
/snap/bin
Either install it to one of those paths, or set a custom path using the environment variable BNGPATH or by calling the function pysb.pathfinder.set_path()
Conda users can install BioNetGen using the following command:
conda install -c alubbock bionetgenSolution
D’abord, clonez BioNetGen depuis le dépôt officiel vers un dossier de votre choix. Dans cet exemple, nous utiliserons ~/bionetgen :
clone-bionetgen.sh
git clone --depth 1 -b BioNetGen-2.9.2 https://github.com/RuleWorld/bionetgen.gitEnsuite, avant d’exécuter tout code pysb, définissez la variable d’environnement BNGPATH sur le chemin où vous avez cloné BioNetGen en insérant le code Python suivant :
set-bngpath.py
import os
import os.path
os.environ['BNGPATH'] = os.path.expanduser('~/bionetgen/bng2')Notez que BNGPATH doit être défini sur le sous-dossier bng2 du dépôt BioNetGen cloné !
Relancez tout votre programme - maintenant, l’erreur devrait avoir disparu.
Consultez les articles similaires par catégorie :
Python
Si cet article vous a aidé, pensez à m'offrir un café ou à faire un don via PayPal pour soutenir la recherche et la publication de nouveaux articles sur TechOverflow