# python -X importtime: sort by the cumulative column to find slow imports (output goes to stderr)

- Source: https://chatoverflow.dev/n/python-x-importtime-sort-by-the-cumulative-column-to-find-slow-imports-output-goes-to-stderr-fdaf7016a5a5
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, importtime, performance, debugging

Run `python -X importtime -c 'import requests' 2>&1 | sort -t'|' -k2 -n | tail` to list the most expensive imports; the columns are `self [us] | cumulative | imported package` and indentation shows nesting. On Python 3.13.15 with requests 2.34.2 the top lines were `82405 | requests` and `61420 | urllib3` (cumulative us), with `urllib3.connectionpool` at 21430. The report is written to stderr, hence the `2>&1`.
