Error in installing Python 3.7 - E: Sub-process /usr/bin/dpkg returned an error code (1) - python-3.7

I was trying to install python 3.7 in my Ubuntu virtualbox using 'sudo apt-get install python3.7'.
However, I got the below output: -
Building dependency tree
Reading state information... Done
python3.7 is already the newest version (3.7.4-2~16.04.york1).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libpython3.7 : Depends: libpython3.7-stdlib (= 3.7.4-2~16.04.york1) but 3.7.4-1+xenial2 is to be installed
libpython3.7-dev : Depends: libpython3.7-stdlib (= 3.7.4-2~16.04.york1) but 3.7.4-1+xenial2 is to be installed
libpython3.7-stdlib : Depends: libpython3.7-minimal (= 3.7.4-1+xenial2) but 3.7.4-2~16.04.york1 is to be installed
python3.7 : Depends: libpython3.7-stdlib (= 3.7.4-2~16.04.york1) but 3.7.4-1+xenial2 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
Afterwards, I tried executing 'apt-get -f install' as recommended in the above output, but then I got the below: -
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libpython3.7-stdlib
The following packages will be upgraded:
libpython3.7-stdlib
1 upgraded, 0 newly installed, 0 to remove and 209 not upgraded.
4 not fully installed or removed.
Need to get 0 B/1,756 kB of archives.
After this operation, 66.6 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 189831 files and directories currently installed.)
Preparing to unpack .../libpython3.7-stdlib_3.7.4-2~16.04.york1_amd64.deb ...
Unpacking libpython3.7-stdlib:amd64 (3.7.4-2~16.04.york1) over (3.7.4-1+xenial2) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.7-stdlib_3.7.4-2~16.04.york1_amd64.deb (--unpack):
trying to overwrite '/usr/lib/python3.7/distutils/__init__.py', which is also in package python3.7-distutils 3.7.4-1+xenial2
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libpython3.7-stdlib_3.7.4-2~16.04.york1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Update:
Even though the error says that python3.7 is already there, when I execute python, I get the below:
Python 2.7.12 (default, Oct 8 2019, 14:14:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And below when I run 'python3': -
Python 3.5.2 (default, Oct 8 2019, 13:06:37)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
All I want to do is to install python 3.7.
Can anyone kindly help me with this error?

I see following in your logs
python3.7 is already the newest version (3.7.4-2~16.04.york1).
It says python3.7 is already install.
can you just try
python or python3 on command line, see what it says?
if you see something like below, it has successfully installed
Python 3.7.3 (v3.7.3 Oct 3 2017, 00:32:08)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on XXX
Type "help", "copyright", "credits" or "license" for more information.

Related

/usr/bin/python is needed by rpm

I am trying to install a rpm with a python script and I see this following error
error: Failed dependencies:
/usr/bin/python is needed by smartnav-3.24-1.0.002.noarch
libnsl.so.1()(64bit) is needed by smartnav-3.24-1.0.002.noarch
but i can find python3.7 in /usr/bin
/usr/bin/python
Python 3.7.1 (default, Feb 6 2023, 06:40:16)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
it is a RHEL Linux environment
I tried symbolic linking but didnt help
I could install with --nodeps, but I dont want to use this flag

MYSQLConnection call to #database.setter incorrectly routes to the _mysql_connector c-extenstion

Running on Mac Big Sur 11.6.2
Using Python 3.8
Mysql 8.0.29 Homebrew
MYSQLConnection call to #database.setter, i.e. db_conn.database = my_db_name, incorrectly routes to the _mysql_connector c-extenstion, but I don not have the c extension installed, so the call raises an exception. After pip install mysql-connector-python the file WHEEL contains Root-Is-Purelibe: true and top_level.txt is missing _mysql_connector. I expect calling db_conn.database = my_db_name to execute the MySQLConnection class’ database(value) method in connection.py, not route the call to a non-existent _mysql_connector I have been unable to get pip to install the mysql-connector-python with c extension despite trying various suggestions in stackoverflow.
Sorry, I don't a reputation yet to reply in comment to Nuno-Mariz, so posting the following.
I work on the same team as #needpythonhelp, and we have nearly identical macbook pro laptops, they are not M1. We use the the same Pipfile to create a project-specific .venv. His does not get the _mysql_connector, and my .venv does (I don't remember how I got my python 3.8 version a year ago). See difference below. Could his lack of _mysql_connector have anything to do with missing CPPFLAGS or LDFLAGS when his Python version was installed (presumably built from source e.g. pyenv or annaconda)?
My system
clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ python3
Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
cat .venv/lib/python3.8/site-packages/mysql_connector_python-8.0.23.dist-info/WHEEL
Wheel-Version: 1.0
Generator: bdist_wheel (0.35.1)
Root-Is-Purelib: false
Tag: cp38-cp38-macosx_10_14_x86_64
cat .venv/lib/python3.8/site-packages/mysql_connector_python-8.0.23.dist-info/top_level.txt
_mysql_connector
_mysqlxpb
mysql
mysqlx
ls -la .venv/lib/python3.8/site-packages/_mysql*
-rwxr-xr-x 1 brian staff 7876288 May 25 18:53 .venv/lib/python3.8/site-packages/_mysql_connector.cpython-38-darwin.so
-rwxr-xr-x 1 brian staff 3190548 May 25 18:53 .venv/lib/python3.8/site-packages/_mysqlxpb.cpython-38-darwin.so
needpythonhelp's system
$ clang --version
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ python3
Python 3.8.3 (default, Jul 2 2020, 11:26:31)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
his WHEEL file has
Root-Is-Purelib: true
Tag: py2-none-any
Tag: py3-none-any
top_level.txt
mysql
mysqlx
he does not have either of these in .venv/lib/python3.8/site-packages
_mysqlxpb.cpython-38-darwin.so
_mysql_connector.cpython-38-darwin.so
Edit/Update to the above info
I did a test later today where I used pyenv to install the latest CPython 3.8.13, and built a new .venv from the same Pipfile as noted above. This .venv is like #needpythonhelp's .venv. So now I have one .venv (CPython 3.8.13) that does NOT have _mysql_connector and Root-Is-Purelib: false, etc., and another .venv (from my original CPython 3.8.5 installed a year ago) that does have it.
This is what my Pyenv install today looked like:
❯ pyenv install 3.8:latest
python-build: use openssl#1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.13.tar.xz...
-> https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tar.xz
Installing Python-3.8.13...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.8.13 to /Users/brian/.pyenv/versions/3.8.13
Any ideas on how to consistently get the c-ext when I use pyenv to install new Python versions?

emacs27 : Depends: emacs27-common but it is not going to be installed

I has Emacs 25.3
emacs -version
GNU Emacs 25.3.2
Copyright (C) 2017 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
I want to install on my Linux Mint 19.6 the Git. So I try this:
sudo apt install git
But I get error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
emacs27 : Depends: emacs27-common but it is not going to be installed
git : Depends: git-man (> 1:2.29.2) but 1:2.27.0-1~ppa0~ubuntu18.04.1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
I always get this error if I want to install any package.
E.g.
sudo apt-get install libcurl4-openssl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
emacs27 : Depends: emacs27-common but it is not going to be installed
libcurl4-openssl-dev : Depends: libcurl4 (= 7.58.0-2ubuntu3.12) but 7.58.0-2ubuntu3.9 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

Visual Studio Code and pylint not finding module issues

First, I may have more of an issue with correct environment selection. I did a fresh install of Linux Mint 19 and apt dist-upgrade... etc... and then used apt-get and pip to install pymysql, pil.intertk and pylint for both python and python3 from the cli...
All is good from cli:
~$ python3 --version
Python 3.6.5
~$ pylint3 --version
No config file found, using default configuration
pylint3 1.8.3,
astroid 1.6.0
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0]
python3
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymysql
>>> import PIL
>>>
After installing VSC.... the only two selection of python environments are 2.7.12 and 3.5.2 ?
I then modified VSC settings with: "python.pythonPath": "/usr/bin/python3"
Which still shows as Python 3.5.2 64-bit within VSC
But here comes my issue that I have tried many suggestions I have found from searching with no luck...
pylint is not finding any module I install. I assume its due to the mix match of version ? But not sure how to resolve that?
When I try to specify the pylint path : "python.linting.pylintPath": "/usr/bin/pylint3"
I get an invalid path error in VSC.. but its a valid path
~$ which pylint3
/usr/bin/pylint3
Any help would be greatly appreciated....
So after some frustrating trail and error I have fixed the issue by uninstalling the Flatpak version of Visual Studio Code listed in the Linux Mint's Software Center... and installing the deb package from the official site.
After installing the deb package... the proper version of python are showing and pylint is working correctly.

why i failed to download source code of chrome?

just want to know what happened...
why gyp_chromium returned non-zero exit status? what i should do to deal with this issue?
i have tried to run sync for the second time, get the same error...
linux_x86: updated to version 9870.
Updating /home/thinke365/fun/src/native_client/toolchain/.tars/naclsdk_linux_x86.tgz
from https://commondatastorage.googleapis.com/nativeclient-
archive2/toolchain/9870/naclsdk_linux_x86.tgz.
......................................
|------------------------------------------------|
..................................................
linux_x86_newlib: updated to version 9870.
Updating /home/thinke365/fun/src/native_client/toolchain/.tars/naclsdk_pnacl_linux_x86.tgz
from https://commondatastorage.googleapis.com/nativeclient-archive2/toolchain/9854/naclsdk_pnacl_linux_x86.tgz.
.............................................................
|------------------------------------------------|
..................................................
pnacl_linux_x86: updated to version 9854.
Updating /home/thinke365/fun/src/native_client/toolchain/.tars/naclsdk_pnacl_translator.tgz
from https://commondatastorage.googleapis.com/nativeclient-archive2/toolchain/9854/naclsdk_pnacl_translator.tgz.
...................
|------------------------------------------------|
..................................................
pnacl_translator: updated to version 9854.
________ running '/usr/bin/python src/tools/clang/scripts/update.py --mac-only' in '/home/thinke365/fun'
________ running '/usr/bin/python src/build/win/setup_cygwin_mount.py --win-only' in '/home/thinke365/fun'
________ running '/usr/bin/python src/build/util/lastchange.py -o src/build/util/LASTCHANGE' in '/home/thinke365/fun'
________ running '/usr/bin/python src/build/gyp_chromium' in '/home/thinke365/fun'
Updating projects from gyp files...
Package nss was not found in the pkg-config search path.
Perhaps you should add the directory containing `nss.pc'
to the PKG_CONFIG_PATH environment variable
No package 'nss' found
gyp: Call to 'pkg-config --cflags nss' returned exit status 1. while loading dependencies of /home/thinke365/fun/src/base/base.gyp while loading dependencies of /home/thinke365/fun/src/build/all.gyp while trying to load /home/thinke365/fun/src/build/all.gyp
Error: Command /usr/bin/python src/build/gyp_chromium returned non-zero exit status 1 in /home/thinke365/fun
thinke365#lab:~/fun$
thinke365#lab:~/fun$
thinke365#lab:~/fun$ n
bash: n: command not found
thinke365#lab:~/fun$ echo $?
127
Edit 1:
failed to run install-build-deps.sh even after make comment to some packages which cannot be installed to system.
Note, selecting 'libjpeg62-dev' instead of 'libjpeg-dev'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libkrb5-dev : Depends: krb5-multidev (= 1.8.3+dfsg-4squeeze6) but it is not going to be installed
libnspr4-dev : Depends: libnspr4-0d (>= 4.8.6) but it is not going to be installed
Depends: libnspr4-0d (<= 4.8.6-1.1~) but it is not going to be installed
libnss3-dev : Depends: libnss3-1d (= 3.12.8-1+squeeze5) but it is not going to be installed
libpcre3-dbg : Depends: libpcre3 (= 8.02-1.1) but 1:8.30-5 is to be installed
rpm : Depends: libnss3-1d (>= 3.12.0~1.9b1) but it is not going to be installed
Depends: librpm1 (>= 4.8.0) but it is not going to be installed
Depends: librpmbuild1 (>= 4.8.0) but it is not going to be installed
Depends: librpmio1 (>= 4.8.0) but it is not going to be installed
Depends: rpm2cpio but it is not going to be installed
E: Broken packages
As outlined on http://dev.chromium.org/developers/how-tos/get-the-code you will need to run build/install-build-deps.sh before you can run gyp