Skip to content

vb_suite parser.py can shadow builtin parser module #5972

Closed
@dsm054

Description

@dsm054

This is identical to Tom Augspurger's issue here.

Under some circumstances, you can't run the performance tests:

~/sys/pandas$ ./test_perf.sh 
Traceback (most recent call last):
  File "/home/mcneil/sys/pandas/vb_suite/test_perf.py", line 55, in <module>
    import pandas as pd
  File "/usr/local/lib/python2.7/dist-packages/pandas-0.13.0_75_g7d9e9fa-py2.7-linux-i686.egg/pandas/__init__.py", line 37, in <module>
    import pandas.core.config_init
  File "/usr/local/lib/python2.7/dist-packages/pandas-0.13.0_75_g7d9e9fa-py2.7-linux-i686.egg/pandas/core/config_init.py", line 17, in <module>
    from pandas.core.format import detect_console_encoding
  File "/usr/local/lib/python2.7/dist-packages/pandas-0.13.0_75_g7d9e9fa-py2.7-linux-i686.egg/pandas/core/format.py", line 9, in <module>
    from pandas.core.index import Index, MultiIndex, _ensure_index
  File "/usr/local/lib/python2.7/dist-packages/pandas-0.13.0_75_g7d9e9fa-py2.7-linux-i686.egg/pandas/core/index.py", line 11, in <module>
    import pandas.index as _index
  File "index.pyx", line 34, in init pandas.index (pandas/index.c:16227)
  File "/usr/local/lib/python2.7/dist-packages/pytz/__init__.py", line 29, in <module>
    from pkg_resources import resource_stream
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 76, in <module>
    import parser
  File "/home/mcneil/sys/pandas/vb_suite/parser.py", line 1, in <module>
    from vbench.api import Benchmark
  File "/usr/local/lib/python2.7/dist-packages/vbench/__init__.py", line 2, in <module>
    import vbench.log
  File "/usr/local/lib/python2.7/dist-packages/vbench/log.py", line 34, in <module>
    from vbench.config import is_interactive
  File "/usr/local/lib/python2.7/dist-packages/vbench/config.py", line 4, in <module>
    TIME_ZONE = pytz.timezone('US/Eastern')
AttributeError: 'module' object has no attribute 'timezone'

This happens because pytz does

from pkg_resources import resource_stream

which itself calls

import parser

which is picking up pandas/vb_suite/parser.py instead of the builtin parser module. Net result: the pytz import never manages to get to the point where timezone is defined.

As expected, renaming parser.py solves the problem (and restoring the original name creates it again).

Metadata

Metadata

Assignees

No one assigned

    Labels

    PerformanceMemory or execution speed performanceTestingpandas testing functions or related to the test suite

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions