Reinstall pip after upgrade to Ubuntu 14.x? - pip

I'm on Ubuntu 14.x. I'm trying to re-install pip. The package appears to be in an inconsistent state. (Possibly a result of some manual file-deletions I did earlier.) Reinstall does not work, and I'm hesitant to force a package-removal through apt-get. How to proceed?
If I try to remove the pip package, I get this error:
$ sudo apt-get remove python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
python-chardet-whl python-colorama python-colorama-whl python-distlib
python-distlib-whl python-html5lib python-html5lib-whl python-pip-whl
python-requests-whl python-setuptools-whl python-six-whl python-urllib3-whl
python-wheel
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
python-pip
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 477 kB disk space will be freed.
Do you want to continue? [Y/n] Y
dpkg: error processing package python-pip (--remove):
package is in a very bad inconsistent state; you should
reinstall it before attempting a removal
Errors were encountered while processing:
python-pip
E: Sub-process /usr/bin/dpkg returned an error code (1)
If I then try to clean up the installed version of pip, I get this error:
$ sudo apt-get install --reinstall python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/97.3 kB of archives.
After this operation, 0 B of additional disk space will be used.
Selecting previously unselected package python-pip.
(Reading database ... 71400 files and directories currently installed.)
Preparing to unpack .../python-pip_1.5.4-1ubuntu4_all.deb ...
File "/usr/bin/pyclean", line 63
except (IOError, OSError), e:
^
SyntaxError: invalid syntax
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
File "/usr/bin/pyclean", line 63
except (IOError, OSError), e:
^
SyntaxError: invalid syntax
dpkg: error processing archive /var/cache/apt/archives/python-pip_1.5.4-1ubuntu4_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/python-pip_1.5.4-1ubuntu4_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Thanks!

Related

How can I install Canon scanner/libpango

I am installing Canon MG3650S printer/scanner on Ubuntu 22.04. It looks like something is wrong with installing libpango. I discovered that it was missing from the dependency list. However, after installing it, something is still missing. I noticed that "libpango-1.0-0 set to manually installed", but could not figure out what does it mean. Below you find the screen log.
~/Downloads/scangearmp2-3.20-1-deb$ sudo apt-get install libpango-1.0-0
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libpango-1.0-0 is already the newest version (1.50.6+ds-2).
libpango-1.0-0 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 150 not upgraded.
~/Downloads/scangearmp2-3.20-1-deb$ sudo ./install.sh
==================================================
ScanGear MP
Version 3.20
Copyright CANON INC. 2007-2015
==================================================
Command executed = sudo dpkg -iG ./packages/scangearmp2_3.20-1_amd64.deb
Selecting previously unselected package scangearmp2.
(Reading database ... 272630 files and directories currently installed.)
Preparing to unpack .../scangearmp2_3.20-1_amd64.deb ...
Unpacking scangearmp2 (3.20-1) ...
dpkg: dependency problems prevent configuration of scangearmp2:
scangearmp2 depends on libpango1.0-0 (>= 1.14.0); however:
Package libpango1.0-0 is not installed.
dpkg: error processing package scangearmp2 (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
scangearmp2
Command executed = sudo dpkg -P scangearmp2
(Reading database ... 272652 files and directories currently installed.)
Removing scangearmp2 (3.20-1) ...
Purging configuration files for scangearmp2 (3.20-1) ...
BTW: On another copy of the same Ubuntu, I did not notice this issue. What could be the cause?
You need the Package libpango1.0-0 - which can be install with Synaptic. That was my problem too. After that everything OK.
dpkg -L libpango1.0-0
dpkg -L libpango-1.0-0

Unable to install google-cloud-sdk on Ubuntu 14.04LTS for python3

I am unable to install "google-cloud-sdk" and seeing this error
and I followed instructions from https://cloud.google.com/sdk/docs/install#deb
ubuntu#ubuntu:~$ cat /etc/issue
Ubuntu 14.04.5 LTS
ubuntu#ubuntu:~$ sudo apt-get install google-cloud-sdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
google-cloud-sdk is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 172 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up google-cloud-sdk (356.0.0-0) ...
ERROR: gcloud failed to load: No module named 'typing'
gcloud_main = _import_gcloud_main()
import googlecloudsdk.gcloud_main
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import display
from googlecloudsdk.calliope import display_taps
from googlecloudsdk.core.resource import resource_printer_base
from googlecloudsdk.core.resource import resource_projector
import proto # pylint: disable=g-import-not-at-top
from .enums import Enum
from proto.marshal.rules.enums import EnumRule
from typing import Type
This usually indicates corruption in your gcloud installation or problems with your Python interpreter.
Please verify that the following is the path to a working Python 2.7 or 3.5+ executable:
/usr/bin/python3
If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 or 3.5+ executable.
If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here:
https://cloud.google.com/sdk/
dpkg: error processing package google-cloud-sdk (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
google-cloud-sdk
E: Sub-process /usr/bin/dpkg returned an error code (1)
"typing" module is present as shown below:
ubuntu#ubuntu:~$ python3
Python 3.4.3 (default, Nov 12 2018, 22:25:49)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
> import typing
> >>> from typing import Type
> >>> print(typing.__file__)
> /usr/local/lib/python3.4/dist-packages/typing.py
> >>>
Why it is not working?
Setting up "CLOUDSDK_PYTHON_SITEPACKAGES=1" environment variable worked
ubuntu#ubuntu:~$ export CLOUDSDK_PYTHON_SITEPACKAGES=1
ubuntu#ubuntu:~$ sudo -E apt-get install google-cloud-sdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
google-cloud-sdk is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 172 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up google-cloud-sdk (356.0.0-0) ...
components post-process --force-recompile
WARNING: Python 3.4.x is no longer officially supported by the Google Cloud SDK
and may not function correctly. Please use Python version 2.7.x or 3.5 and up.
If you have a compatible Python interpreter installed, you can use it by setting
the CLOUDSDK_PYTHON environment variable to point to it.
ubuntu#ubuntu:~$ which gcloud
/usr/bin/gcloud

libboost1.74-dev is not installing on Ubuntu 16.04

My current boost package is libboost-all-dev(default version 1.58.0.1) which is very old for my current need. So I tried -
sudo apt-get install libboost1.74 libboost1.74-dev
It showed me error of somekind -
libboost1.74 is already the newest version (1.74-0~16~ubuntu16.04.1).
The following NEW packages will be installed:
libboost1.74-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/9,325 kB of archives.
After this operation, 139 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 393826 files and directories currently installed.)
Preparing to unpack .../libboost1.74-dev_1.74-0~16~ubuntu16.04.1_amd64.deb ...
Unpacking libboost1.74-dev (1.74-0~16~ubuntu16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/libboost1.74-dev_1.74-0~16~ubuntu16.04.1_amd64.deb (--unpack):
trying to overwrite '/usr/include/boost/exception_ptr.hpp', which is also in package libboost1.58-dev:amd64 1.58.0+dfsg-5ubuntu3.1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libboost1.74-dev_1.74-0~16~ubuntu16.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
However I tried several times before to manually install boost libraries. They does not seem to work though so I deleted them manually. Is this problem related to my manual deletion process? Or maybe I am doing something wrong?
The message makes it clear that you need to uninstall 1.58 first:
trying to overwrite '/usr/include/boost/exception_ptr.hpp', which is also in package libboost1.58-dev

Bash on Ubuntu on Windows can't use `sudo apt-get install <packagename>`

I was excited to use bash on windows but quickly ran into an issue. I am trying to install build-essential, but I get a dependency issue. Upon trying to resolve with sudo apt-get install -f, I run into another error that doesn't make much sense. I've tried update and upgrade, but that didn't work either. F
barzevp#UK-LT-8356:~$ sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies.
libc6-dev : Depends: linux-libc-dev but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
barzevp#UK-LT-8356:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libfreetype6 os-prober
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
linux-libc-dev
The following NEW packages will be installed
linux-libc-dev
0 to upgrade, 1 to newly install, 0 to remove and 43 not to upgrade.
5 not fully installed or removed.
Need to get 0 B/767 kB of archives.
After this operation, 3,946 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 28660 files and directories currently installed.)
Preparing to unpack .../linux-libc-dev_3.13.0-123.172_amd64.deb ...
Unpacking linux-libc-dev:amd64 (3.13.0-123.172) ...
dpkg: error processing archive /var/cache/apt/archives/linux-libc-dev_3.13.0-123.172_amd64.deb (--unpack):
unable to install new version of /usr/include/linux/netfilter_ipv6/ip6t_hl.h': File exists
E: Sub-process /usr/bin/dpkg returned an error code (1)
Full log of what led to the error in Bash on Ubuntu on Windows terminal is here:
https://pastebin.com/dq2D2Gtz
I don't have a solution, but I see the root of the problem. It seems to have to do with case sensitivity on the filesystem. The package for linux-libc-dev puts two copies of a file in /usr/include/linux/netfilter_ipv6 with only a difference in case; ip6t_HL.h, and ip6t_hl.h. After placing ip6t_HL.h, it attempts to rename ip6t_hl.h.dpkg-new to ip6t_hl.h. The system call to rename the file fails, claiming that ip6t_hl.h already exists
On a "real" linux system, ip6t_HL.h and ip6t_hl.h would clearly be different files. Under WSL they probably had some strange incompatibilities to work out between NTFS's default case insensitive FS and unix's default case sensitivity.
You can duplicate the problem by hand e.g., with
echo hi > foo.H
echo hi > foo.h-new
mv foo.h-new foo.h
mv: cannot move 'foo.h-new' to 'foo.h': File exists
strace output:
rename("/usr/include/linux/netfilter_ipv6/ip6t_HL.h.dpkg-new", "/usr/include/linux/netfilter_ipv6/ip6t_HL.h") = 0
open("/usr/include/linux/netfilter_ipv6/ip6t_hl.h.dpkg-new", O_WRONLY) = 10
fsync(10) = 0
close(10) = 0
rename("/usr/include/linux/netfilter_ipv6/ip6t_hl.h.dpkg-new", "/usr/include/linux/netfilter_ipv6/ip6t_hl.h") = -1 EEXIST (File exists)
write(2, "dpkg: error processing archive /"..., 199dpkg: error processing archive /var/cache/apt/archives/linux-libc-dev_4.4.0-98.121_amd64.deb (--install):
unable to install new version of '/usr/include/linux/netfilter_ipv6/ip6t_hl.h': File exists
) = 199
I had the same problem. Like #dmattp I found that it this is because, unfortunately, the package contains some (header) files with names that are distinct only by letter case, and that the wonderful WSL file system has an inconsistency regarding case sensitiveness.
Here is a workaround, assuming that the package has name linux-libc-dev_3.13.0-123.172_amd64.deb:
cd any-temp-dir
apt-get download linux-libc-dev
ar x linux-libc-dev_3.13.0-123.172_amd64.deb
tar xJf data.tar.xz # ignore all erors like ./usr/include/linux/netfilter_ipv4/ipt_ttl.h: Cannot open: Input/output error
tar cJf data.tar.xz ./usr
ar rcs linux-libc-dev_3.13.0-123.172_amd64-patched.deb debian-binary control.tar.gz data.tar.xz
sudo dpkg -i linux-libc-dev_3.13.0-123.172_amd64-patched.deb
It says dependencies aren't being installed, so try:
sudo apt-get install linux-libc-dev
If that doesn't work try:
sudo apt-get install --reinstall build-essential
This will reinstall build-essential. Hope this helps, cheers!

Dpkg: warning: files list file for package 'x'missing; assuming package has no files currently installed in Ubuntu 16.04

I am using Ubuntu 16.04 with lubunut desktop environment. I had the following problem for more than 3 days when I do apt-get upgrade. I don't know what is problem means and how to solve.
Note: 3 days before I try upgrade Linux-header-4.4.66, but it showed an error. I deleted it. Now, I'm back to Linux-header-4.4.64, which worked fine before.
Error on sudo apt-get dist-upgrade (only last 15 line of 500+ line error):
dpkg: warning: files list file for package 'libxcb-xkb1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libvorbis-dev:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libavahi-core7:amd64' missing; assuming package has no files currently installed
(Reading database ... 37151 files and directories currently installed.)
Preparing to unpack .../libgtk-3-bin_3.18.9-1ubuntu3.2_amd64.deb ...
Adding 'diversion of /usr/sbin/update-icon-caches to /usr/sbin/update-icon-caches.gtk2 by libgtk-3-bin'
dpkg-divert: error: rename involves overwriting '/usr/sbin/update-icon-caches.gtk2' with
different file '/usr/sbin/update-icon-caches', not allowed
dpkg: error processing archive /var/cache/apt/archives/libgtk-3-bin_3.18.9-1ubuntu3.2_amd64.deb (--unpack):
subprocess new pre-installation script returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/libgtk-3-bin_3.18.9-1ubuntu3.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I solved this problem at last night. If you know Chinese, you can read this solution on my blog. I'll detail it here with my poor English.
Create three files in you desktop or anywhere you want.
fix.sh
txt
fixit.py
Add contents in these files
fix.sh: Just an Empty file.
txt: Copy your log into this file with '\n' to separate each line. Just like this:
dpkg: warning: files list file for package 'libxcb-xkb1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libvorbis-dev:amd64' missing; assuming package has no files currently installed
fixit.py: fill the file with the following contents.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Fitzeng'
import re
def main():
fix = open('fix.sh', 'w+')
for line in open("txt"):
pkg = re.match(re.compile('''dpkg: warning: files list file for package '(.+)' '''), line)
if pkg:
cmd = "sudo apt-get install --reinstall " + pkg.group(1)
fix.write(cmd + '\n')
if __name__ == "__main__":
main()
Execute these file.
chmod 777 *
python fixit.py
./fix.sh
OK, problem solved. Actually, you'll find you could alternately just reinstall these packages. So, you can fix it in many ways.

Resources