Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why the node of result png is blank? #229

Open
lipingliang opened this issue Jul 12, 2020 · 17 comments
Open

Why the node of result png is blank? #229

lipingliang opened this issue Jul 12, 2020 · 17 comments

Comments

@lipingliang
Copy link

dear friends:
in my program, the node of result png is blank, why? help me, thanks!
event_processing

the code:

from diagrams import Cluster, Diagram
from diagrams.aws.compute import ECS, EKS, Lambda
from diagrams.aws.database import Redshift
from diagrams.aws.integration import SQS
from diagrams.aws.storage import S3

with Diagram("Event Processing", show=True):
source = EKS("k8s source")

with Cluster("Event Flows"):
    with Cluster("Event Workers"):
        workers = [ECS("worker1"),
                   ECS("worker2"),
                   ECS("worker3")]

    queue = SQS("event queue")

    with Cluster("Processing"):
        handlers = [Lambda("proc1"),
                    Lambda("proc2"),
                    Lambda("proc3")]

store = S3("events store")
dw = Redshift("analytics")

source >> workers >> queue >> handlers
handlers >> store
handlers >> dw
@gabriel-tessier
Copy link
Collaborator

@lipingliang
Do you have error in the console?
Which version do you use?

I tried with last version 0.15 your code and it generate this:
event_processing

Maybe try the example code and see if the icon display...

https://diagrams.mingrammer.com/docs/getting-started/examples

If icons don't display try to reinstall.

@lipingliang
Copy link
Author

lipingliang commented Jul 14, 2020

thanks! I have reinstall 3 times, the problem remains.

@lipingliang
Copy link
Author

lipingliang commented Jul 14, 2020

My diagrams version is 0.16.0. In console, the error: can't open clustered_web_services.

@leandrodamascena
Copy link
Contributor

@mingrammer I have some experience with bug reporting in an open source project and I believe I can create a decorator to detect errors in the project and facilitate the reporting of bugs and problems like this. I think in this case it could be useful.

What do you think of the idea? I can do a PR.

@gabriel-tessier
Copy link
Collaborator

@lipingliang
Can you prevent copy paste the previous message and only post your reply it will make more easy to follow. Thanks!

Can you put in gist again your code well formatted. (In your first post, there's indentations problems).
I expect that you may have some indentations errors that may raise the error you provided.
Let's go step by step and try to figure out what is wrong with your installation.

Can you provide more information about your environment (OS: Windows Mac Linux .... Python version etc...)
How did you install Diagrams? which version of graphiz do you have?
This may help us to reproduce the problem.

@lipingliang
Copy link
Author

lipingliang commented Jul 15, 2020

@gabriel-tessier
thank you very much!
My OS is Win7, Python version is 3.6. I use pycharm installing diagrams. The graphviz version is 0.13.2.
Now, I run below code, the error is: 'Global diagrams context not set up'.
from diagrams import Cluster, Diagram
from diagrams.aws.compute import ECS, EKS, Lambda
from diagrams.aws.database import Redshift
from diagrams.aws.integration import SQS
from diagrams.aws.storage import S3

with Diagram("Event Processing", show=True):
source = EKS("k8s source")

with Cluster("Event Flows"):
with Cluster("Event Workers"):
workers = [ECS("worker1"),
ECS("worker2"),
ECS("worker3")]

queue = SQS("event queue")

with Cluster("Processing"):
    handlers = [Lambda("proc1"),
                Lambda("proc2"),
                Lambda("proc3")]

store = S3("events store")
dw = Redshift("analytics")

source >> workers >> queue >> handlers
handlers >> store
handlers >> dw

the result is:
图片

the debug info is :
图片

the version is :
图片
图片

@mingrammer
Copy link
Owner

@leandrodamascena Could you please give me some more details? Pseudo code would be greatly helpful!

@gabriel-tessier
Copy link
Collaborator

@lipingliang

I'm sorry I can't reproduce your problem but it look like it's a problem with your system installation... and I don't have windows 7 to test.
Your initial problem with the pictures that don't display can be maybe related to this issue, if the resources folder can't be find:
#163

Maybe somebody else with Windows and similar environment can reproduce the error and solve your problem.

@gabriel-tessier
Copy link
Collaborator

@lipingliang

Actually you can build your diagrams using docker, for the installation follow the instruction here: https://github.com/mingrammer/diagrams/blob/master/DEVELOPMENT.md

Then you can put you file with the python code in the root of the source directory and run docker exec diagrams-1.0 python your_file.py and it will generate your diagrams file.

Hope it help.

@seqizz
Copy link

seqizz commented Apr 23, 2021

Hi there 👋

I have a similar issue, OS is Linux/NixOS, installed version 0.19.1.

Following code:

#!/usr/bin/env python3
from diagrams import Diagram
from diagrams.generic.os import LinuxGeneral
from diagrams.generic.os import Centos

with Diagram("Grouped Workers", show=False, direction="TB"):
    Centos("lb") >> [LinuxGeneral("worker1"), LinuxGeneral("w2")] >> LinuxGeneral("test")

Generates this:

grouped_workers

I suspect this is related with something missing, but I can't see any warnings/errors anywhere. Dependencies supplied are:

  • jinja2 "2.11.2"
  • graphviz "0.14.1"

Can I help debugging further?

@gabriel-tessier
Copy link
Collaborator

Hi @seqizz,

Is graphviz installed on your system? https://www.graphviz.org/download/#linux
If it's installed can you provide the version? Thanks

Can you consider using docker as described here:
https://github.com/mingrammer/diagrams/blob/master/DEVELOPMENT.md

Hope it help you debugging your problem.

@seqizz
Copy link

seqizz commented Apr 23, 2021

Hi,

Yes, graphviz version 2.42.2 is installed.

I was trying to solve this without Docker, since I was planning to package it for NixOS also. But apparently it's already packaged. Trying from that derivation, no issues anymore. 🎉

Sorry for the noise & thanks!

@agorgl
Copy link

agorgl commented Sep 23, 2021

Having the same issue, by using an Arch Linux package from the AUR:
web_service

No errors in the stdout/stderr, nothing at all.

@agorgl
Copy link

agorgl commented Sep 23, 2021

Package was missing resources. Sent instructions to the maintainer to fix this!

@lostinplace
Copy link

what were the instructions to make this work?

@tommycarstensen
Copy link

Was a solution to this ever provided? I also get this error message:

raise EnvironmentError("Global diagrams context not set up")      

OSError: Global diagrams context not set up

@yuri-scaranni
Copy link

I was having the same error here, running the code in pycharm. I just change to run in command line
'python mycode.py'

And the image was generated in the correct way. I believe something is missing in my venv in pycharm, but command line works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants