PEP668 / pipx and "--editable" installs

c.buhtz at posteo.jp c.buhtz at posteo.jp
Fri Sep 15 10:15:23 EDT 2023


Hello,
I wonder that today was the first day I stumbled over PEP668 / pipx and 
the "externally-managed-environment" problem. I migrated from Debian 11 
to 12.

I'm developing some Python packages; applications and libraries. I never 
used virtual environments and wouldn't like to start with it.
But I do use "--editable" for my packages. I wonder how I should go on 
with using "pipx" and "--editable" mode because I had some problems with 
it I couldn't fix following PEP668 but only with using 
"--break-system-packages". And PEP668 do not mention editable-mode.

The two example packages I use here are public available and clonable 
(is this a word?) via git.

Let's start with a command line application named "hyperorg" 
(https://codeberg.org/buhtz/hyperorg).
I tried to install it via "pipx install -e .[develop]". It's 
pyproject.toml has a bug: A missing dependency "dateutil". But 
"dateutil" is not available from PyPi for Python 3.11 (the default in 
Debian 12). But thanks to great Debian they have a "python3-dateutil" 
package. I installed it.
But "hyperorg" do ignore it and can't import it. Of course I 
re-installed hyperorg via pipx.
Installing it via "pip" and "--break-system-packages" it works well and 
do see the "python3-dateutil" package.

The second example is a "library" named "buhtzology" 
(https://codeberg.org/buhtz/buhtzology).
Here it seems that "pipx" do refuse to install it in the first place 
("pipx install -e .[develop]") and gave me this message.

"No apps associated with package buhtzology. Try again with 
'--include-deps' to include apps of dependent packages, which are listed 
above. If you are attempting to install a library, pipx should not be 
used. Consider using pip or a similar tool instead."

What is the difference between an "app" (it is a google/apple marketing 
term used for software with user interaction. Just name it application.) 
and a "library" in context of pip(x)? Why does it count?
I tried again with "pipx install --include-deps -e .[develop]" and got 
an output I'm not sure if this is an error or a success message. I 
assume it is an error because I'm not able to "import buhtzology". It 
seems like that the package was not installed.

⚠️  Note: normalizer was already on your PATH at /usr/bin/normalizer
⚠️  Note: f2py was already on your PATH at /usr/bin/f2py
⚠️  Note: f2py3 was already on your PATH at /usr/bin/f2py3
⚠️  Note: f2py3.11 was already on your PATH at /usr/bin/f2py3.11
⚠️  Note: py.test was already on your PATH at /usr/bin/py.test
⚠️  Note: pytest was already on your PATH at /usr/bin/pytest
⚠️  File exists at /home/user/.local/bin/pycodestyle and points to 
/home/user/.local/bin/pycodestyle, not 
/home/user/.local/pipx/venvs/buhtzology/bin/pycodestyle. Not modifying.
⚠️  File exists at /home/user/.local/bin/ruff and points to 
/home/user/.local/bin/ruff, not 
/home/user/.local/pipx/venvs/buhtzology/bin/ruff. Not modifying.
   installed package buhtzology 0.2.0.dev0, installed using Python 3.11.2
   These apps are now globally available
     - f2py
     - f2py3
     - f2py3.11
     - fonttools
     - normalizer
     - py.test
     - pyftmerge
     - pyftsubset
     - pytest
     - tabulate
     - ttx
     - pycodestyle (symlink missing or pointing to unexpected location)
     - ruff (symlink missing or pointing to unexpected location)
done! ✨ 🌟 ✨

BUT!

$ python3 -c "import buhtzology"
Traceback (most recent call last):
   File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'buhtzology'


More information about the Python-list mailing list