Skip to content

BUG? import name collision in vb_suite/parser #5777

Closed
@TomAugspurger

Description

@TomAugspurger

This is a bit of an odd one, but when I run python test_perf.py, I get this traceback:

(pandas-dev) ~/E/p/l/p/s/p/vb_suite (to-frame-multi=) python test_perf.py -h
Traceback (most recent call last):
  File "test_perf.py", line 55, in <module>
    import pandas as pd
  File "/Users/tom/Envs/pandas-dev/lib/python2.7/site-packages/pandas-0.13.0rc1_130_g0657e63-py2.7-macosx-10.8-x86_64.egg/pandas/__init__.py", line 37, in <module>
    import pandas.core.config_init
  File "/Users/tom/Envs/pandas-dev/lib/python2.7/site-packages/pandas-0.13.0rc1_130_g0657e63-py2.7-macosx-10.8-x86_64.egg/pandas/core/config_init.py", line 17, in <module>
    from pandas.core.format import detect_console_encoding
  File "/Users/tom/Envs/pandas-dev/lib/python2.7/site-packages/pandas-0.13.0rc1_130_g0657e63-py2.7-macosx-10.8-x86_64.egg/pandas/core/format.py", line 9, in <module>
    from pandas.core.index import Index, MultiIndex, _ensure_index
  File "/Users/tom/Envs/pandas-dev/lib/python2.7/site-packages/pandas-0.13.0rc1_130_g0657e63-py2.7-macosx-10.8-x86_64.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:14961)
  File "/Users/tom/Envs/pandas-dev/lib/python2.7/site-packages/pytz/__init__.py", line 35, in <module>
    from pkg_resources import resource_stream
  File "/Users/tom/Envs/pandas-dev/lib/python2.7/site-packages/pkg_resources.py", line 74, in <module>
    import parser
  File "/Users/tom/Envs/pandas-dev/lib/python2.7/site-packages/pandas/vb_suite/parser.py", line 1, in <module>
    from vbench.api import Benchmark
  File "/Users/tom/Envs/pandas-dev/lib/python2.7/site-packages/vbench/__init__.py", line 2, in <module>
    import vbench.log
  File "/Users/tom/Envs/pandas-dev/lib/python2.7/site-packages/vbench/vbench/__init__.py", line 2, in <module>
    import vbench.log
  File "/Users/tom/Envs/pandas-dev/lib/python2.7/site-packages/vbench/log.py", line 34, in <module>
    from vbench.config import is_interactive
  File "/Users/tom/Envs/pandas-dev/lib/python2.7/site-packages/vbench/vbench/config.py", line 3, in <module>
    TIME_ZONE = pytz.timezone('US/Eastern')
AttributeError: 'module' object has no attribute 'timezone'

I followed a lot of red herrings all over the place, but the actual problem seems to be some sort of namespace collision with the parser module in /Users/tom/Envs/pandas-dev/lib/python2.7/site-packages/pkg_resources.py, which I'm assuming is the standard library parser.

My reason for suspecting that it's some kind of namespace collision is that renaming pandas/vb_suite/parser.py to pandas/vb_suite/parser_.py (and changing parser to parser_ in pandas/vb_suite/suite.py) fixes the problem.

I'm doing some reading on python's import machinery to figure out if this is a bug here and what a better solution would be.

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