8000 Raise exception early if pyparsing and/or dateutil are not installed. · matplotlib/matplotlib@49bd70a · GitHub
[go: up one dir, main page]

Skip to content

Commit 49bd70a

Browse files
committed
Raise exception early if pyparsing and/or dateutil are not installed.
1 parent 7018842 commit 49bd70a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lib/matplotlib/__init__.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,27 @@
9999
"""
100100
from __future__ import print_function
101101

102+
import sys
103+
102104
__version__ = '1.3.x'
103105
__version__numpy__ = '1.4' # minimum required numpy version
104106

105-
import os, re, shutil, subprocess, sys, warnings
107+
try:
108+
import dateutil
109+
except ImportError:
110+
raise ImportError("matplotlib requires dateutil")
111+
112+
try:
113+
import pyparsing
114+
except ImportError:
115+
raise ImportError("matplotlib requires pyparsing")
116+
else:
117+
if sys.version_info[0] >= 3:
118+
if [int(x) for x in pyparsing.__version__.split('.')] <= (1, 5, 6):
119+
raise ImportError(
120+
"matplotlib requires pyparsing > 1.5.6 on Python 3.x")
121+
122+
import os, re, shutil, subprocess, warnings
106123
import distutils.sysconfig
107124
import distutils.version
108125

0 commit comments

Comments
 (0)
0