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

bz2 mistakenly made a hard requirement of matplotlib 2.2.2 #10866

Closed
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Milestone
@jmd-dk

Description

@jmd-dk

Bug report

Bug summary

The_bz2 module is made a dependency in matplotlib 2.2.2. At least up until matplotlib 2.1.1, this was not the case. I believe this is a mistake. Previously, the import ofbz2 (inmatplotlib/cbook/__init__.py) was made only when needed, inside theto_filehandle() function. In 2.2.2, this import is moved up to at the top of the file, meaning that it always try to importbz2 and by extension_bz2, regardless of whether it will be used or not.

This is a problem as_bz2 is not always installed, and not listed as a required dependency of matplotlib. I am able to fix the issue easily by moving the import ofbz2 back down inside of theto_filehandle() function, or alternatively placing it inside atry/except block.

Actual outcome

>>> import matplotlibTraceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/home/jeppe/Desktop/Desktop/concept_update_test/python/lib/python3.6/site-packages/matplotlib/__init__.py", line 127, in <module>    from . import cbook  File "/home/jeppe/Desktop/Desktop/concept_update_test/python/lib/python3.6/site-packages/matplotlib/cbook/__init__.py", line 13, in <module>    import bz2  File "/home/jeppe/Desktop/Desktop/concept_update_test/python/lib/python3.6/bz2.py", line 23, in <module>    from _bz2 import BZ2Compressor, BZ2DecompressorModuleNotFoundError: No module named '_bz2

Matplotlib version

  • Operating system: Linux Mint 17.3
  • Matplotlib version: 2.2.2
  • Python version: 3.6

I have installed both Python and matplotlib from source.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp