env python3.5: no such file or directory

The dependency conflicts may require a lot of time to resolve. On the contrary, uninstalling old software is easy, but it might lead to multiple broken programs and strange errors. Here is one of them, after removing the old python 3.4 and 3.5 (or whatever version it prints in your case) under Gentoo despite the rebuilding all dependencies as required by the emerge command for the new python 3.6 an error occurred trying to emerge the “app-misc/geoclue-2.5.3-r2

[20/75] /usr/lib/python-exec/python3.6/meson --internal exe --unpickle /var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3-build/meson-private/meson_exe_glib-mkenums_af4feac41c42ec7289410f8b20070c0528a3a7c0.dat
FAILED: public-api/gclue-enum-types.c 
/usr/lib/python-exec/python3.6/meson --internal exe --unpickle /var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3-build/meson-private/meson_exe_glib-mkenums_af4feac41c42ec7289410f8b20070c0528a3a7c0.dat
/usr/bin/env: âpython3.5â: No such file or directory
ninja: build stopped: subcommand failed.
 * ERROR: app-misc/geoclue-2.5.3-r2::gentoo failed (compile phase):
 *   ninja -v -j15 -l14 -C /var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3-build failed
 * 
 * Call stack:
 *     ebuild.sh, line  125:  Called src_compile
 *   environment, line 2847:  Called meson_src_compile
 *   environment, line 1904:  Called eninja '-C' '/var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3-build'
 *   environment, line 1274:  Called die
 * The specific snippet of code:
 *       "$@" || die "${nonfatal_args[@]}" "${*} failed"
 * 

Despite the lines starting with “/usr/lib/python-exec/python3.6/meson”, there is an error for missing “python 3.5“.

Here is another example, just trying to execute the distcc-config and it immediately throws the error for missing “python 3.5“.

root@srv ~ # distcc-config 
/usr/bin/env: ‘python3.5’: No such file or directory

The python script distcc-config starts with:

root@srv ~ $ head /usr/bin/distcc-config
#!/usr/bin/env python3.5
# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

import os, re, signal, subprocess, sys

options=[
        '--get-hosts',
        '--set-hosts',
        '--get-verbose',

Apparently, multiple programs use this technic to explicitly put a specific version of python in the header of the python script to be used. Thus grantees the version in the header will be used even you change the system or user-preferred Python interpreter.

But uninstalling this python version all these programs will stop working till you rebuild them with emerge.

Find all programs, which require python versions not available in the system.

First, check which python versions are available with:

root@srv ~ $ eselect python list
Available Python interpreters, in order of preference:
  [1]   python3.6
  [2]   python3.5 (uninstalled)
  [3]   python2.7
  [4]   python3.4 (uninstalled)
  [5]   pypy
  [6]   python3.7 (fallback)
  [7]   jython2.7 (fallback)

Four versions are available – python 3.6, python 2.7, pypy and jython 2.7.
Second, grep the whole system directories for files with headers including python 3.4 and python 3.5:

for v in 4 5
do
    for d in usr bin sbin lib lib64 opt
    do 
        grep -iar "\/usr\/bin\/env\ python3\.${v}" "/${d}/"|awk 'BEGIN {FS=":"} {print $1}'|while read file
        do 
            echo "${file}"
            equery b "${file}"
        done
    done
done
/usr/lib/python-exec/python3.4/quicktest.py
 * Searching for /usr/lib/python-exec/python3.4/quicktest.py ... 
dev-python/docutils-0.14 (/usr/lib/python-exec/python3.4/quicktest.py)
/usr/lib/python-exec/python3.4/buildhtml.py
 * Searching for /usr/lib/python-exec/python3.4/buildhtml.py ... 
dev-python/docutils-0.14 (/usr/lib/python-exec/python3.4/buildhtml.py)
/usr/share/doc/python-docs-3.6.4/html/library/zipapp.html
 * Searching for /usr/share/doc/python-docs-3.6.4/html/library/zipapp.html ... 
dev-python/python-docs-3.6.4 (/usr/share/doc/python-docs-3.6.4/html/library/zipapp.html)
/usr/share/doc/python-docs-3.7.0/html/library/zipapp.html
 * Searching for /usr/share/doc/python-docs-3.7.0/html/library/zipapp.html ... 
dev-python/python-docs-3.7.0 (/usr/share/doc/python-docs-3.7.0/html/library/zipapp.html)
/usr/share/doc/python-docs-3.4.6/html/tutorial/appendix.html
 * Searching for /usr/share/doc/python-docs-3.4.6/html/tutorial/appendix.html ... 
dev-python/python-docs-3.4.6 (/usr/share/doc/python-docs-3.4.6/html/tutorial/appendix.html)
/usr/share/doc/python-docs-3.5.4/html/library/zipapp.html
 * Searching for /usr/share/doc/python-docs-3.5.4/html/library/zipapp.html ... 
dev-python/python-docs-3.5.4 (/usr/share/doc/python-docs-3.5.4/html/library/zipapp.html)
/usr/lib/python-exec/python3.5/quicktest.py
 * Searching for /usr/lib/python-exec/python3.5/quicktest.py ... 
dev-python/docutils-0.14 (/usr/lib/python-exec/python3.5/quicktest.py)
/usr/lib/python-exec/python3.5/buildhtml.py
 * Searching for /usr/lib/python-exec/python3.5/buildhtml.py ... 
dev-python/docutils-0.14 (/usr/lib/python-exec/python3.5/buildhtml.py)
/usr/sbin/update-distcc-symlinks
 * Searching for /usr/sbin/update-distcc-symlinks ... 
sys-devel/distcc-3.3.2-r4 (/usr/sbin/update-distcc-symlinks)
/usr/bin/blueman-report
 * Searching for /usr/bin/blueman-report ... 
net-wireless/blueman-2.1_alpha2 (/usr/bin/blueman-report)
/usr/bin/blueman-services
 * Searching for /usr/bin/blueman-services ... 
net-wireless/blueman-2.1_alpha2 (/usr/bin/blueman-services)
/usr/bin/blueman-applet
 * Searching for /usr/bin/blueman-applet ... 
net-wireless/blueman-2.1_alpha2 (/usr/bin/blueman-applet)
/usr/bin/blueman-sendto
 * Searching for /usr/bin/blueman-sendto ... 
net-wireless/blueman-2.1_alpha2 (/usr/bin/blueman-sendto)
/usr/bin/gupnp-binding-tool
 * Searching for /usr/bin/gupnp-binding-tool ... 
net-libs/gupnp-1.0.3 (/usr/bin/gupnp-binding-tool)
/usr/bin/blueman-adapters
 * Searching for /usr/bin/blueman-adapters ... 
net-wireless/blueman-2.1_alpha2 (/usr/bin/blueman-adapters)
/usr/bin/unoconv
 * Searching for /usr/bin/unoconv ... 
app-office/unoconv-0.8.2 (/usr/bin/unoconv)
/usr/bin/blueman-manager
 * Searching for /usr/bin/blueman-manager ... 
net-wireless/blueman-2.1_alpha2 (/usr/bin/blueman-manager)
/usr/bin/blueman-assistant
 * Searching for /usr/bin/blueman-assistant ... 
net-wireless/blueman-2.1_alpha2 (/usr/bin/blueman-assistant)
/usr/bin/lsusb.py
 * Searching for /usr/bin/lsusb.py ... 
sys-apps/usbutils-010-r1 (/usr/bin/lsusb.py)
/usr/bin/blueman-tray
 * Searching for /usr/bin/blueman-tray ... 
net-wireless/blueman-2.1_alpha2 (/usr/bin/blueman-tray)
/usr/bin/distcc-config
 * Searching for /usr/bin/distcc-config ... 
sys-devel/distcc-3.3.2-r4 (/usr/bin/distcc-config)
/usr/bin/cdemu
 * Searching for /usr/bin/cdemu ... 
app-cdr/cdemu-3.2.0 (/usr/bin/cdemu)
/usr/bin/glib-mkenums
 * Searching for /usr/bin/glib-mkenums ... 
dev-util/glib-utils-2.60.7 (/usr/bin/glib-mkenums)
/usr/bin/glib-genmarshal
 * Searching for /usr/bin/glib-genmarshal ... 
dev-util/glib-utils-2.60.7 (/usr/bin/glib-genmarshal)
/usr/bin/gtester-report
 * Searching for /usr/bin/gtester-report ... 
dev-util/glib-utils-2.60.7 (/usr/bin/gtester-report)
/usr/share/doc/python-docs-3.6.4/html/tutorial/appendix.html
 * Searching for /usr/share/doc/python-docs-3.6.4/html/tutorial/appendix.html ... 
dev-python/python-docs-3.6.4 (/usr/share/doc/python-docs-3.6.4/html/tutorial/appendix.html)
/usr/share/doc/python-docs-3.7.0/html/tutorial/appendix.html
 * Searching for /usr/share/doc/python-docs-3.7.0/html/tutorial/appendix.html ... 
dev-python/python-docs-3.7.0 (/usr/share/doc/python-docs-3.7.0/html/tutorial/appendix.html)
/usr/share/doc/python-docs-3.5.4/html/tutorial/appendix.html
 * Searching for /usr/share/doc/python-docs-3.5.4/html/tutorial/appendix.html ... 
dev-python/python-docs-3.5.4 (/usr/share/doc/python-docs-3.5.4/html/tutorial/appendix.html)
/usr/libexec/blueman-rfcomm-watcher
 * Searching for /usr/libexec/blueman-rfcomm-watcher ... 
net-wireless/blueman-2.1_alpha2 (/usr/libexec/blueman-rfcomm-watcher)
/usr/libexec/blueman-mechanism
 * Searching for /usr/libexec/blueman-mechanism ... 
net-wireless/blueman-2.1_alpha2 (/usr/libexec/blueman-mechanism)

Then re-emerge the packages to fix the issue.

Debugging not so obvious similar errors

Our first example of emerge error does not report the name of the program, which requires the python 3.5, because it is executed by a configuration program meson.
The full emerge error of emerge app-misc/geoclue-2.5.3-r2:

[20/75] /usr/lib/python-exec/python3.6/meson --internal exe --unpickle /var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3-build/meson-private/meson_exe_glib-mkenums_af4feac41c42ec7289410f8b20070c0528a3a7c0.dat
FAILED: public-api/gclue-enum-types.c 
/usr/lib/python-exec/python3.6/meson --internal exe --unpickle /var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3-build/meson-private/meson_exe_glib-mkenums_af4feac41c42ec7289410f8b20070c0528a3a7c0.dat
/usr/bin/env: âpython3.5â: No such file or directory
ninja: build stopped: subcommand failed.
 * ERROR: app-misc/geoclue-2.5.3-r2::gentoo failed (compile phase):
 *   ninja -v -j15 -l14 -C /var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3-build failed
 * 
 * Call stack:
 *     ebuild.sh, line  125:  Called src_compile
 *   environment, line 2847:  Called meson_src_compile
 *   environment, line 1904:  Called eninja '-C' '/var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3-build'
 *   environment, line 1274:  Called die
 * The specific snippet of code:
 *       "$@" || die "${nonfatal_args[@]}" "${*} failed"
 * 
 * If you need support, post the output of `emerge --info '=app-misc/geoclue-2.5.3-r2::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=app-misc/geoclue-2.5.3-r2::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/app-misc/geoclue-2.5.3-r2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-misc/geoclue-2.5.3-r2/temp/environment'.
 * Working directory: '/var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3'
 * S: '/var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3'

>>> Failed to emerge app-misc/geoclue-2.5.3-r2, Log file:

>>>  '/var/tmp/portage/app-misc/geoclue-2.5.3-r2/temp/build.log'

 * Messages for package app-misc/geoclue-2.5.3-r2:

 * ERROR: app-misc/geoclue-2.5.3-r2::gentoo failed (compile phase):
 *   ninja -v -j15 -l14 -C /var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3-build failed
 * 
 * Call stack:
 *     ebuild.sh, line  125:  Called src_compile
 *   environment, line 2847:  Called meson_src_compile
 *   environment, line 1904:  Called eninja '-C' '/var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3-build'
 *   environment, line 1274:  Called die
 * The specific snippet of code:
 *       "$@" || die "${nonfatal_args[@]}" "${*} failed"
 * 
 * If you need support, post the output of `emerge --info '=app-misc/geoclue-2.5.3-r2::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=app-misc/geoclue-2.5.3-r2::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/app-misc/geoclue-2.5.3-r2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-misc/geoclue-2.5.3-r2/temp/environment'.
 * Working directory: '/var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3'
 * S: '/var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3'

The easies way is to just strace the executed line, which prints the error and look for the exec call like execve, in the case:

srv ~ # strace -f /usr/lib/python-exec/python3.6/meson --internal exe --unpickle /var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3-build/meson-private/meson_exe_glib-mkenums_af4feac41c42ec7289410f8b20070c0528a3a7c0.dat
.....
.....
[pid 29461] chdir("/var/tmp/portage/app-misc/geoclue-2.5.3-r2/work/geoclue-2.5.3-build") = 0
[pid 29461] rt_sigaction(SIGPIPE, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f8e80fdd890}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f8e80fdd890}, 8) = 0
[pid 29461] rt_sigaction(SIGXFSZ, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f8e80fdd890}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f8e80fdd890}, 8) = 0
[pid 29461] execve("/usr/bin/glib-mkenums", ["/usr/bin/glib-mkenums", "--fhead", "#include \"gclue-enum-types.h\"\n#i"..., "--fprod", "\n/* enumerations from \"@basename"..., "--vhead", "\nGType\n@enum_name@_get_type (voi"..., "--vprod", "    { C_@TYPE@(@VALUENAME@), \"@V"..., "--vtail", "    { 0, NULL, NULL }\n  };\n  if "..., "/var/tmp/portage/app-misc/geoclu"...], 0x5618420f6110 /* 71 vars */ <unfinished ...>
[pid 29457] <... read resumed> "", 50000) = 0
.....
.....

And the /usr/bin/glib-mkenums is responsible for the above emerge error. Just verify the python 3.5 is set in the header and find the package to rebuild with “equery” command (part of app-portage/gentoolkit package, install it if you miss “equery“).

srv ~ # head /usr/bin/glib-mkenums
#!/usr/bin/env python3.5

# If the code below looks horrible and unpythonic, do not panic.
#
# It is.
#
# This is a manual conversion from the original Perl script to
# Python. Improvements are welcome.
#
from __future__ import print_function, unicode_literals
srv ~ # /usr/bin/glib-mkenums
/usr/bin/env: 'python3.5': No such file or directory
srv ~ # equery b /usr/bin/glib-mkenums
 * Searching for /usr/bin/glib-mkenums ...
dev-util/glib-utils-2.56.2 (/usr/bin/glib-mkenums)

Leave a Reply

Your email address will not be published.