OSeMOSYS / otoole

OSeMOSYS Tools for Energy
https://otoole.readthedocs.io
MIT License
23 stars 17 forks source link

Update graphviz install instructions #205

Closed trevorb1 closed 10 months ago

trevorb1 commented 10 months ago

Description

In this PR I have updated the documentation site with instructions on what to do if you run into a graphviz dependency error. Specifially, this warning has been added to the RES example.

image

Issue Ticket Number

Closes #204

Documentation

Added to examples.rst

trevorb1 commented 10 months ago

Actually, thinking about this again, it may just be simpler to add graphviz to the requirements. I guess my only hesitancy to this is that (based on Stack Overflow threads), Windows users can sometimes run into issues with it not being installed correctly through this method.

I have added graphviz to the package dependencies and will try installing everything on a fresh copy of Windows soon. If everything works, I will remove the warning message in the docs.

trevorb1 commented 10 months ago

This is a little odd. Graphviz gets installed, yet the dot command is still not recognized.

(otoole-test) C:\Users\trevo\Documents\repos\otoole>pip show graphviz
Name: graphviz
Version: 0.20.1
Summary: Simple Python interface for Graphviz
Home-page: https://github.com/xflr6/graphviz
Author: Sebastian Bank
Author-email: sebastian.bank@uni-leipzig.de
License: MIT
Location: C:\Users\trevo\miniconda3\envs\otoole-test\Lib\site-packages
Requires: 
Required-by: otoole

(otoole-test) C:\Users\trevo\Documents\repos\otoole>dot -V                
'dot' is not recognized as an internal or external command,
operable program or batch file.
trevorb1 commented 10 months ago

Okay, so it seems you have to install it on the system, but don't actually need the dependency in the venv.

(otoole-test) C:\Users\trevo\Documents\repos\simplicity>dot -V
dot - graphviz version 9.0.0 (20230911.1827)

(otoole-test) C:\Users\trevo\Documents\repos\simplicity>pip show graphviz
WARNING: Package(s) not found: graphviz

(otoole-test) C:\Users\trevo\Documents\repos\simplicity>otoole viz res csv data res.png config.yaml

# writes out res.png correctly
trevorb1 commented 10 months ago

Okay. So my solution was to remove my proposed solution of adding graphviz to otoole's requirements, and instead provide instructions to the user on how to install graphviz to their system. This seems to be the generally accepted solution (see here).