Hi Christian (2022.02.19_17:52:34_-0400) This feels related to de-vendoring pip's dependencies, because it's happening inside a zip import, but it's not *just* that.
I think it's a race importing html5lib.treebuilders.etree as multiple threads try to parse HTML at the same time. Before one thread has evaluated the line to set the getETreeModule local variable, another thread sees that html5lib.treebuilders.etree is in sys.modules and tries to access getETreeModule. Maybe there's a potential race while zipimporting modules, that one doesn't see with regular imports? Or I'd assume upstream would have run into this bug by now. I marked the fixed version based on the zipimport hunch. Upstream replaced their homegrown map_multithread with Python 3.7+ map() in https://github.com/pypa/pip/commit/0252c04a16cd93fe422cebf0b48453b559a2e404 (in 22.0) and if I apply that patch I can't reproduce the race any more. So, let's apply that. SR -- Stefano Rivera http://tumbleweed.org.za/ +1 415 683 3272