Skip to content

pip update error #2

Description

@slowcode42
root@ubuntu:~/source/fail2ban# pip list | grep python-apt
python-apt (0.9.3.5ubuntu2)
root@ubuntu:~/source/fail2ban# pip install --upgrade python-apt
Collecting python-apt
  Using cached python-apt-0.7.8.tar.bz2
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-fPcLQq/python-apt/setup.py", line 11, in <module>
        string.split(parse_makefile("python/makefile")["APT_PKG_SRC"]))
      File "/usr/lib/python2.7/distutils/sysconfig.py", line 304, in parse_makefile
        fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1)
      File "/usr/lib/python2.7/distutils/text_file.py", line 103, in __init__
        self.open (filename)
      File "/usr/lib/python2.7/distutils/text_file.py", line 120, in open
        self.file = open (self.filename, 'r')
    IOError: [Errno 2] No such file or directory: 'python/makefile'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-fPcLQq/python-apt/

how can i solve it?

Activity

  1. reddoggad commented on Jun 23, 2016

    @reddoggad

    @HDarwin hi! You solved this problem?

  2. reddoggad commented on Jun 23, 2016

    @reddoggad
  3. HalisCz commented on Jul 26, 2016

    @HalisCz

    Hi,
    have anyone solved this issue?

  4. kotnik commented on Aug 1, 2016

    @kotnik

    @HalisCz, installing python-apt as @reddoggad suggests solves it for me.

  5. HalisCz commented on Aug 25, 2016

    @HalisCz

    For me too. Thanks

  6. tinproject commented on Apr 28, 2017

    @tinproject

    I'm having the same problem, putting here my solution for reference.

    The Pypi version of python-apt package it's not updated. Usually the best is to install the system apt python-apt package, but sometimes running a virtualenv isolated from the system you also need to install the python package.

    I've found the Debian repository of python-apt and install it with pip using the correct branch for my system:

    sudo apt-get install libapt-pkg-dev  # so gcc find the <apt-pkg/hashes.h>
    pip install git+https://anonscm.debian.org/cgit/apt/python-apt.git@ubuntu/trusty

    and it works.

  7. aaossa commented on Nov 10, 2017

    @aaossa

    @tinproject I'm facing the same issue but the second command fails:

    Collecting git+https://anonscm.debian.org/cgit/apt/python-apt.git
      Cloning https://anonscm.debian.org/cgit/apt/python-apt.git to /tmp/pip-uh0FwI-build fatal: unable to access 'https://anonscm.debian.org/cgit/apt/python-apt.git/': Failed  to connect to anonscm.debian.org port 443: Connection refused
    Command "git clone -q https://anonscm.debian.org/cgit/apt/python-apt.git /tmp/pip-uh0 FwI-build" failed with error code 128 in None
    

    imagen

    Did the url changed? Thanks!

    EDIT: I'm using Windows 10

  8. tinproject commented on Nov 10, 2017

    @tinproject

    @aaossa You are not including the branch/tag part of the git repo at the pip command. Also I do not know why you want to install python-apt package in a non Debian system...

    On Linux Mint 18 I've found that there is no ubuntu/xenial branch, but using the tag 1.1.0_beta5 it works.

  9. aaossa commented on Nov 10, 2017

    @aaossa

    I tried because when I wanted to update my python packaged it was listed as outdated (python-apt (0.9.3.5ubuntu2) - Latest: 0.7.8 [sdist]). After that I tried to update all of them but python-apt failed. I'll try your suggestiong. Thanks!

  10. astrojuanlu commented on Aug 22, 2018

    @astrojuanlu

    The new URL is https://salsa.debian.org/apt-team/python-apt.git. Thanks @tinproject for the pointer! 🇪🇸

  11. evadeflow commented on Nov 9, 2020

    @evadeflow

    Just chiming in to confirm: I had the same problem, and making this change to my requirements.txt file fixed it:

    diff --git a/requirements.txt b/requirements.txt
    index 92fb4e5..6ca12d7 100644
    --- a/requirements.txt
    +++ b/requirements.txt
    @@ -1,3 +1,4 @@
     ansible
    +git+https://salsa.debian.org/apt-team/[email protected]
     molecule
     psutil

    In my case, though, for an Ubuntu 20.04 target, I also needed to run:

    $ sudo apt install libapt-pkg-dev
    

    in order for pip install -r requirements.txt to succeed. Without this package installed, I kept getting this error:

        running build_ext
        building 'apt_pkg' extension
        creating build/temp.linux-x86_64-3.9
        creating build/temp.linux-x86_64-3.9/python
        x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/evadeflow/projects/ubuntu-vm-setup/venv/include -I/usr/include/python3.9 -c python/acquire-item.cc -o build/temp.linux-x86_64-3.9/python/acquire-item.o -std=c++11 -Wno-write-strings -DAPT_8_CLEANER_HEADERS -DAPT_9_CLEANER_HEADERS -DAPT_10_CLEANER_HEADERS -DPY_SSIZE_T_CLEAN
        In file included from python/acquire-item.cc:24:
        python/apt_pkgmodule.h:14:10: fatal error: apt-pkg/hashes.h: No such file or directory
           14 | #include <apt-pkg/hashes.h>
              |          ^~~~~~~~~~~~~~~~~~
        compilation terminated.
        error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
    

    But the error that started this whole odyssey was this:

        Complete output from command python setup.py egg_info:
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/tmp/pip-install-hcb_ok5s/python-apt/setup.py", line 6, in <module>
            from DistUtilsExtra.command import *
        ModuleNotFoundError: No module named 'DistUtilsExtra'
    

    (I'm selfishly including that last bit so that Google will lead me back to this page if/when I encounter the same error in the future...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions