Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cannot import matplotlib on Google App Engine dev appserver #1823

Closed
@mgiuca-google

Description

@mgiuca-google

Google App Engine is a restricted Python environment which now supports matplotlib on the production server (seeThird-party Libraries), due to extensive modifications which Google made to the codebase to get it working. However, thedevelopment server runs unmodified code for third-party libraries. The current version of Matplotlib (tested with9690232 as of 14-03-2013) crashes if "import matplotlib" is run on the dev appserver:

Traceback (most recent call last):  File "/path/to/matplotlib/__init__.py", line 846, in <module>    rcParams = rc_params()  File "/path/to/matplotlib/__init__.py", line 757, in rc_params    fname = matplotlib_fname()  File "/path/to/matplotlib/__init__.py", line 646, in matplotlib_fname    home = get_home()  File "/path/to/matplotlib/__init__.py", line 300, in wrapper    ret = func(*args, **kwargs)  File "/path/to/matplotlib/__init__.py", line 496, in _get_home    raise RuntimeError('please define environment variable $HOME')RuntimeError: please define environment variable $HOME

This is just one of the issues (fix that one, and more spring up). There are three major blockers:

  • Matplotlib expects the user to have a writable $HOME directory, so it will not work in any environment where the user does not have a home directory, or where there is a non-writable file system.
  • App Engine does provide asubprocess module, but it is empty. Therefore, any attempt to usesubprocess.Popen on App Engine results inAttributeError being raised.
  • Theps backend writes to a temporary file, then reads it back in, even when not using an external distiller. This will not work in any environment where there is a non-writable file system.

We (the Google App Engine Python team) have patched these three issues to get Matplotlib working in our production environment. We propose sending these patches upstream so that Matplotlib will work out-of-the-box on App Engine and other restricted environments which ban file writing and use of subprocess.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp