I stupidly removed the subprocess.py module from /usr/lib/python3.2 so I tried to fix this by executing the following command:
sudo apt-get install python3
But I got this error:
Traceback (most recent call last):
File "/usr/bin/py3compile", line 33, in <module>
from subprocess import PIPE, Popen ImportError:
No module named subprocess dpkg:
error processing python3 (--configure):
subprocess installed post-installation script returned error exit status 1 dpkg:
dependency problems prevent configuration of python3-gobject:
python3-gobject depends on python3 (>= 3.2); however:
Package python3 is not configured yet. python3-gobject depends on python3 (<<
3.3); however:
Package python3 is not configured yet. dpkg: error processing python3-gobject (--configure):
dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
python3 python3-gobject E: Sub-process /usr/bin/dpkg returned an error code (1)
How can I fix this?
Have you tried uninstalling Python 3 and then installing it again?
sudo apt-get remove python3
sudo apt-get install python3
or maybe
sudo apt-get --reinstall install python3
If this does not work, just grab subprocess.py from the python repository and copy it to the right directory. For example, for Python 3.2.2, navigate with your browser to:
http://hg.python.org/cpython/file/137e45f15c0b/Lib/subprocess.py
and the click in "raw" (left column) to download the file.
For other versions, just go to:
http://hg.python.org/cpython/tags
Pick your version, then click on browse (left column), then Lib (from the folders list), then "subprocess.py" and then "raw" (left column) to download the file.
Related
I want to install odoo 14 on ubuntu 20.04.2, everytime I want to install odoo's dependencies this error comes up:
chown: cannot access '/var/lib/odoo': No such file or directory
dpkg: error processing package odoo (--configure):
installed odoo package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
odoo
E: Sub-process /usr/bin/dpkg returned an error code (1)
I was following the installation instruction on https://www.candidroot.com/blog/our-candidroot-blog-1/post/how-to-install-odoo-14-on-ubuntu-20-04-lts-67 and the error comes up when I run step5.
I tried other solutions but the error is still there.
Just create the folder /var/lib/odoo and your problem should be solved.
sudo mkdir /var/lib/odoo
I'm trying to install pgadmin on ubuntu 18.04, but i'm getting following error. I also tried to rm and reinstall but it's getting same error.
$ sudo apt-get install pgadmin4 pgadmin4-apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
pgadmin4-apache2 is already the newest version (4.25-1.pgdg18.04+1).
pgadmin4 is already the newest version (4.29).
0 upgraded, 0 newly installed, 0 to remove and 13 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 pgadmin4-apache2 (4.25-1.pgdg18.04+1) ...
apache2_invoke pgadmin4: already enabled
Traceback (most recent call last):
File "setup.py", line 18, in <module>
from pgadmin.model import db, User, Version, ServerGroup, Server, \
File "/usr/share/pgadmin4/web/pgadmin/__init__.py", line 19, in <module>
from flask import Flask, abort, request, current_app, session, url_for
ModuleNotFoundError: No module named 'flask'
dpkg: error processing package pgadmin4-apache2 (--configure):
installed pgadmin4-apache2 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
pgadmin4-apache2
E: Sub-process /usr/bin/dpkg returned an error code (1)
I tried,
sudo apt update --fix-missing
sudo apt install -f
sudo dpkg --configure -a
but its not working
plz anyone help me with this
I'm using Ubuntu 16.04 LTS, I recently accidentaly deleted some files and folders
( /urs/lib/pyhon3.x ), after this Python3 is not working.
python3 gives the following error message.
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Current thread 0x00007f7e77307700 (most recent call first):
Aborted (core dumped)
I have tried re-installing python3 by
sudo apt-get install python3
Still, the problem persists, I have tried unset PYTHONHOME and unset PYTHONPATH.
But nothing is working, how can we make this work?
Update(1) pip is not working as python is not working.
pip install encodings returns the following error,
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Current thread 0x00007f76e2667700 (most recent call first):
Aborted (core dumped
Update (2) :
I have tried
sudo apt-get --purge autoremove python3 then rebooot then, sudo apt install python3,
it gives the following error,
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3 is already the newest version (3.5.1-3).
0 upgraded, 0 newly installed, 0 to remove and 54 not upgraded.
2 not fully installed or removed.
Need to get 0 B/8 710 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
[master ccedc09] saving uncommitted changes in /etc prior to apt run
Author: rajgourav <rajgourav#euclide.ipcms1.ipcms.unistra.fr>
8 files changed, 4 insertions(+), 4 deletions(-)
Setting up python3.5 (3.5.2-2ubuntu0~16.04.12) ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Current thread 0x00007efddc85f700 (most recent call first):
Aborted (core dumped)
dpkg: error processing package python3.5 (--configure):
subprocess installed post-installation script returned error exit status 134
dpkg: dependency problems prevent configuration of python3:
python3 depends on python3.5 (>= 3.5.1-2~); however:
Package python3.5 is not configured yet.
dpkg: error processing package python3 (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup erro
r from a previous failure.
Errors were encountered while processing:
python3.5
python3
I removed python3 from my ubuntu(18.0.4.5) to see if i can reproduce
the same problem.
It seems that removing python and configuration files by
sudo apt-get --purge autoremove python3
sudo reboot
then
sudo apt install python3
works
Have you tried to install the module encodings with pip install encodings ?
Else, try to reconfigure Python3 with dpkg using the command sudo dpkg-reconfigure python3
I am trying to install virtual environment on my Ubuntu and my python is 3.5. My command is:
python3 -m venv my-env/
It reminds me to install python3-venv first, but then got the following error.
apt-get install python3-venv
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-venv is already the newest version (3.5.1-3).
0 upgraded, 0 newly installed, 0 to remove and 95 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
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Setting up cython3 (0.23.4-0ubuntu5) ...
Traceback (most recent call last):
File "/usr/bin/py3compile", line 34, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
ImportError: No module named 'debpython'
dpkg: error processing package cython3 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
cython3
E: Sub-process /usr/bin/dpkg returned an error code (1)
Is this because Python3.5 doesn't work with python3 -m venv? If I can't upgrade python3.5, what can I do?
You can't use apt-get install without root/sudo. Yeah you can jump through hoops but ignoring that.
You can use anaconda-python without root. That would be a separate python from the system one with likely a different version. And that's a subject for another question
Your locales are messed up
Yeah the error mesg could be better
Added later
Why venv is absent from builtin-python I'm not clear; it's supposed to be there 3.3 onwards
Pip is alternative to apt and by default works for user — sudo not required.
You can get pip by hand but it's fiddly and ill-advised
However the pip module should work even if the command is not available ie use
python3 -m pip where you were using just pip
I am working on a raspberry pi 3B+. I want to upgrade the python from 2.7 to 3.6.
I downloaded the python 3.6 extracted and made it, However it got installed in the /usr/local/bin.
I tried to make it again this time by specifying ./configure --prefix=/usr prefix however the make gave a traceback error.
I also tried update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2 which helps in changing versions of python.
However, after doing so, my pip is not working now.
I have the following files in /usr/local/bin:pip,pip2.7,pip3,pip3.5,pip3.6.
I tried removing pip so that i can reinstall it using sudo apt-get remove python-pip but it gives the following error:
pi#raspberrypi:/usr/local/bin $ 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:
libpython-all-dev python-all python-all-dev python-keyring
python-keyrings.alt python-secretstorage python-wheel
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
python-pip
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
1 not fully installed or removed.
After this operation, 671 kB disk space will be freed.
Do you want to continue? [Y/n] y
Traceback (most recent call last):
File "/usr/bin/apt-listchanges", line 29, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
(Reading database ... 138007 files and directories currently installed.)
Removing python-pip (9.0.1-2+rpt2) ...
File "/usr/bin/pyclean", line 63
except (IOError, OSError), e:
^
SyntaxError: invalid syntax
dpkg: error processing package python-pip (--remove):
subprocess installed 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
ModuleNotFoundError: No module named 'ConfigParser'
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
python-pip
E: Sub-process /usr/bin/dpkg returned an error code (1)
which suggests that apt_pkg (or some problem with apt-get).
when i do pip --version , i get:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
ModuleNotFoundError: No module named 'pkg_resources'
I just want to have python 3.6 and 2.7(since i have already installed libraries on 2.7) with functional pip.
Why don't you install miniconda for ARM and get Python and all important packages at once ?
wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh
sudo md5sum Miniconda3-latest-Linux-armv7l.sh
sudo /bin/bash Miniconda3-latest-Linux-armv7l.sh
sudo reboot -h now
I think you aren't aware that most linux distros come shipped with python2 AND python3. By typing python and pip you will use your operating systems python2 and pip2 version.
What you probably want is using python3 and pip3 instead.
Something like "upgrading" from python2 to python3 is not possible because it's a fundamental difference and they are incompatible. This is why you have both installed.
Uninstalling or upgrading your systems python interpreter is a terrible bad idea, because your system needs them. For professional usage you should think about version control again, but for your first (and second) steps in python it's totally fine to use the preinstalled python interpreter of your OS.
Solutions like pyenv or virtualenv are very powerfull tools, but you probably don't want to start with it.