Skip to content

pkg_resources causes a slow import; any way to avoid? #291

Closed
@jason-s

Description

@jason-s

The use of pkg_resources.parse_version (see #162) causes the import time of numexpr to slow down significantly, from approx 0.4 seconds without pkg_resources.parse_version to 2.1 seconds with pkg_resources.parse_version.

(perhaps I should note that I am not a direct consumer of numexpr and have never used it, but pandas does and I use pandas)

Please consider alternate methods... if there are any.

The culprit is in expressions.py

import numpy
from pkg_resources import parse_version
_np_version = parse_version(numpy.__version__)

(my "speedup" was to comment out those last two lines referencing parse_version and substitute _np_version = '1.12.1' just to see how this impacts import time)


(see also pypa/setuptools#510)

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