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

Running MPCPy with plots in docker without display #141

Open
tsnouidui opened this issue Jun 13, 2018 · 2 comments
Open

Running MPCPy with plots in docker without display #141

tsnouidui opened this issue Jun 13, 2018 · 2 comments
Assignees

Comments

@tsnouidui
Copy link
Member

This issue is to address an issue which appears when running MPCPy in a docker container.
When MPCPy tries to validate some parameter estimation runs, it uses matplotlib to create plots.
This step requires a display which is by default not enabled in docker. A solution is to switch the backend of matplotlib so it doesn't need a display.

@dhblum
Copy link
Collaborator

dhblum commented Jun 13, 2018

As proposed in #142, plt.switch_backend('agg') can be used to keep any plotting in the background and not interactive, which will work in Docker. However, this is not a solution to code in MPCPy since it will affect the user's environment without knowledge.

@dhblum
Copy link
Collaborator

dhblum commented Jan 8, 2019

A solution to this is to change the backend of matplotlib in the script running inside of a docker before importing MPCPy classes. For example:

import matplotlib
matplotlib.use('Agg')
from mpcpy import models
# continue code ...

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

Successfully merging a pull request may close this issue.

2 participants