# pylint: disable-msg=W0614,W0401,W0611,W0622


__docformat__ = 'restructuredtext'

try:
    from . import hashtable, tslib, lib
except Exception:  # pragma: no cover
    import sys
    e = sys.exc_info()[1]  # Py25 and Py3 current exception syntax conflict
    print(e)
    if 'No module named lib' in str(e):
        raise ImportError('C extensions not built: if you installed already '
                          'verify that you are not importing from the source '
                          'directory')
    else:
        raise

from datetime import datetime
import numpy as np


# XXX: HACK for NumPy 1.5.1 to suppress warnings
try:
    np.seterr(all='ignore')
except Exception:  # pragma: no cover
    pass

# numpy versioning
from distutils.version import LooseVersion
_np_version = np.version.short_version
_np_version_under1p8 = LooseVersion(_np_version) < '1.8'
_np_version_under1p9 = LooseVersion(_np_version) < '1.9'


from pandas.version import version as __version__
from pandas.info import __doc__


if LooseVersion(_np_version) < '1.7.0':
    raise ImportError('pandas {0} is incompatible with numpy < 1.7.0, '
                      'your numpy version is {1}. Please upgrade numpy to'
                      ' >= 1.7.0 to use pandas version {0}'.format(__version__,
                                                                   _np_version))

# let init-time option registration happen
import pandas.core.config_init

from pandas.core.api import *
from pandas.sparse.api import *
from pandas.stats.api import *
from pandas.tseries.api import *
from pandas.io.api import *
from pandas.computation.api import *

from pandas.tools.merge import merge, concat, ordered_merge
from pandas.tools.pivot import pivot_table, crosstab
from pandas.tools.plotting import scatter_matrix, plot_params
from pandas.tools.tile import cut, qcut
from pandas.core.reshape import melt
from pandas.util.print_versions import show_versions
import pandas.util.testing



@@ -91,17 +91,22 @@
    from 
-.
+pandas
  import 
@@ -130,33 +130,40 @@
  lib%0Aexcept 
-Exception
+ImportError as e
 :  # pragma:
@@ -180,152 +180,85 @@
     
-import sys%0A    e = sys.exc_info()%5B1%5D  # Py25 and Py3 current exception syntax conflict%0A    print(e)%0A    if 'No module named lib' in str(e):%0A    
+module = str(e).lstrip('cannot import name ')  # hack but overkill to use re%0A
     
@@ -275,17 +275,17 @@
 rtError(
-'
+%22
 C extens
@@ -287,17 +287,21 @@
 xtension
-s
+: %7B0%7D
  not bui
@@ -306,36 +306,33 @@
 uilt
-: i
+. I
 f you 
-installed already '
+want to import %22
 %0A   
@@ -354,127 +354,200 @@
     
-    'verify that you are not importing from the source '%0A                          'directory')%0A    else:%0A        raise
+%22pandas from the source directory, you may need to run %22%0A                      %22'python setup.py build_ext --inplace' to build the C %22%0A                      %22extensions first.%22.format(module))
 %0A%0Afr

improve error message when importing pandas from source directory