After I began installing BLFS packages (in systemd development), I
found that executing pip, pip2 or pip3 gave a long error message
something like this:

#############################
(lfs chroot) root:/usr/bin$ ./pip3.8 install sphinx
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-
packages/pip/_internal/cli/base_command.py", line 188, in main
    status = self.run(options, args)
  File "/usr/lib/python3.8/site-
packages/pip/_internal/commands/install.py", line 286, in run
    with self._build_session(options) as session:
  File "/usr/lib/python3.8/site-
packages/pip/_internal/cli/base_command.py", line 101, in
_build_session
    session = PipSession(
  File "/usr/lib/python3.8/site-packages/pip/_internal/download.py",
line 559, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/usr/lib/python3.8/site-packages/pip/_internal/download.py",
line 144, in user_agent
    zip(["name", "version", "id"], distro.linux_distribution()),
  File "/usr/lib/python3.8/site-packages/pip/_vendor/distro.py", line
122, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/usr/lib/python3.8/site-packages/pip/_vendor/distro.py", line
676, in linux_distribution
    self.name() if full_distribution_name else self.id(),
  File "/usr/lib/python3.8/site-packages/pip/_vendor/distro.py", line
715, in name
    or self.lsb_release_attr('distributor_id') \
  File "/usr/lib/python3.8/site-packages/pip/_vendor/distro.py", line
899, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/usr/lib/python3.8/site-packages/pip/_vendor/distro.py", line
552, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/usr/lib/python3.8/site-packages/pip/_vendor/distro.py", line
1012, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned
non-zero exit status 1.
Traceback (most recent call last):
  File "./pip3.8", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/pip/_internal/__init__.py",
line 77, in main
    return command.main(cmd_args)
  File "/usr/lib/python3.8/site-
packages/pip/_internal/cli/base_command.py", line 234, in main
    session = self._build_session(
  File "/usr/lib/python3.8/site-
packages/pip/_internal/cli/base_command.py", line 101, in
_build_session
    session = PipSession(
  File "/usr/lib/python3.8/site-packages/pip/_internal/download.py",
line 559, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/usr/lib/python3.8/site-packages/pip/_internal/download.py",
line 144, in user_agent
    zip(["name", "version", "id"], distro.linux_distribution()),
  File "/usr/lib/python3.8/site-packages/pip/_vendor/distro.py", line
122, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/usr/lib/python3.8/site-packages/pip/_vendor/distro.py", line
676, in linux_distribution
    self.name() if full_distribution_name else self.id(),
  File "/usr/lib/python3.8/site-packages/pip/_vendor/distro.py", line
715, in name
    or self.lsb_release_attr('distributor_id') \
  File "/usr/lib/python3.8/site-packages/pip/_vendor/distro.py", line
899, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/usr/lib/python3.8/site-packages/pip/_vendor/distro.py", line
552, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/usr/lib/python3.8/site-packages/pip/_vendor/distro.py", line
1012, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned
non-zero exit status 1.
#############################

So I tried to rebuild Python 3 and Python 2 according to BLFS book
instructions. But when I executed "make install" I got essentially the
same error message as above. After looking on the Net for some
guidance, and trying a variety of things to figure out what the error
is, I tried going back to the LFS tool chain with the following, as
nonprivileged user alan, using ideas I recently learned from Bruce:

#############################
su - root
mount -v -t ext4 /dev/mapper/lfslvm2-root $LFS
mount -v -t ext4 /dev/mapper/lfslvm2-boot $LFS/boot
mount -v -t vfat /dev/sdc1 $LFS/boot/efi
mount -v -t ext4 /dev/mapper/lfslvm2-opt $LFS/opt
mount -v -t ext4 /dev/mapper/lfslvm2-home $LFS/home
exit

bash ~/mount-virt.sh

sudo chroot /mnt/lfs /tools/bin/env -i   \
    HOME=/root TERM="$TERM"            \
    PS1='(lfs chroot) \u:\w\$ '        \
    PATH=/tools/bin:/bin:/usr/bin:/sbin:/usr/sbin \
    /tools/bin/bash --login +h

export LFS=/mnt/lfs
alias ll='ls -l'
cd /sources
#############################

In this chroot environment I went back to the LFS book,
section "6.51. Python-3.8.1" and built that again. But I got an error
similar to the above after executing "make install". After a lot of
apparently successful installation messages, the following was output:

#############################
. . .
if test "xupgrade" != "xno"  ; then \
        case upgrade in \
                upgrade) ensurepip="--upgrade" ;; \
                install|*) ensurepip="" ;; \
        esac; \
        LD_LIBRARY_PATH=/sources/Python-3.8.1 ./python -E -m ensurepip
\
                $ensurepip --root=/ ; \
fi
ERROR: Exception:
Traceback (most recent call last):
  File "/tmp/tmpy32zqdgy/pip-19.2.3-py2.py3-none-
any.whl/pip/_internal/cli/base_command.py", line 188, in main
    status = self.run(options, args)
  File "/tmp/tmpy32zqdgy/pip-19.2.3-py2.py3-none-
any.whl/pip/_internal/commands/install.py", line 286, in run
    with self._build_session(options) as session:
  File "/tmp/tmpy32zqdgy/pip-19.2.3-py2.py3-none-
any.whl/pip/_internal/cli/base_command.py", line 101, in _build_session
    session = PipSession(
  File "/tmp/tmpy32zqdgy/pip-19.2.3-py2.py3-none-
any.whl/pip/_internal/download.py", line 559, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/tmp/tmpy32zqdgy/pip-19.2.3-py2.py3-none-
any.whl/pip/_internal/download.py", line 144, in user_agent
    zip(["name", "version", "id"], distro.linux_distribution()),
  File "/tmp/tmpy32zqdgy/pip-19.2.3-py2.py3-none-
any.whl/pip/_vendor/distro.py", line 122, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/tmp/tmpy32zqdgy/pip-19.2.3-py2.py3-none-
any.whl/pip/_vendor/distro.py", line 676, in linux_distribution
    self.name() if full_distribution_name else self.id(),
  File "/tmp/tmpy32zqdgy/pip-19.2.3-py2.py3-none-
any.whl/pip/_vendor/distro.py", line 715, in name
    or self.lsb_release_attr('distributor_id') \
  File "/tmp/tmpy32zqdgy/pip-19.2.3-py2.py3-none-
any.whl/pip/_vendor/distro.py", line 899, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/tmp/tmpy32zqdgy/pip-19.2.3-py2.py3-none-
any.whl/pip/_vendor/distro.py", line 552, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/tmp/tmpy32zqdgy/pip-19.2.3-py2.py3-none-
any.whl/pip/_vendor/distro.py", line 1012, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/sources/Python-3.8.1/Lib/subprocess.py", line 411, in
check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/sources/Python-3.8.1/Lib/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned
non-zero exit status 1.
make: *** [Makefile:1186: install] Error 2
#############################

Clearly, there is a problem with making pip. Clearly, I have no idea
what's happening here.

It's entirely possible that I did something wrong in building the
stuff in the LFS book. But I don't know how to check that.

At worst I could go back and start from scratch with LFS yet again on
another fresh hard drive, but I really don't want to do that, since it
requires about 30 hours to get to the point of building Python-2.7.17.

I'd appreciate any help on this.

Alan


-- 
http://lists.linuxfromscratch.org/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to