pipx
pipx copied to clipboard
installed script lacks "-E" in their shebang
trafficstars
I installed pyflakes through pipx, but using the tool in another context fails, because that other context set a PYTHONPATH that interfer with pyflakes import.
How to reproduce
pyflakes installed with Python 3.12, somehow a script added an element to PYTHONPATH that contains a re module compile for Python 3.11. pyflakes wrongly pick up the PYTHON PATH instead of sticking within its venv.
$ pyflakes --version
+ Traceback (most recent call last):
+ File "HOME/.local/bin//pyflakes", line 3, in <module>
+ import re
+ File "OTHER/re/__init__.py", line 125, in <module>
+ from . import _compiler, _parser
+ File "OTHER/_compiler.py", line 18, in <module>
+ assert _sre.MAGIC == MAGIC, "SRE module mismatch"
+ ^^^^^^^^^^^^^^^^^^^
+ AssertionError: SRE module mismatch
+ [1]
Expected behavior
I would expect pipx to install standalone, isolated environment that are not affected by external factor. This expectation fails here.
Possible fixes ?
Install tools with -E in their shebang for appropriate isolation. I fixed my install that way.