/usr/local/bin/python2: No module named pip (Raspberry Pi/Jessie) - python

Iv'e gotten lots of help from stackoverflow but I'm stumped and this is my first post. I'm trying to install OverGrive from a .deb file and keep hitting a wall with a "/usr/local/bin/python2: No module named pip" on the installation. I'm fairly certain I've met all of the dependencies and have uninstalled and reinstalled pip both directly and through my package manager several times. There is obviously some kind of path/registry type problem but I can't resolve it. Scale of 10, my experience is 4. Thanks!
pi#raspberrypi:~/Downloads $ sudo dpkg -i overgrive_3.2.3_all.deb
(Reading database ... 136303 files and directories currently installed.)
Preparing to unpack overgrive_3.2.3_all.deb ...
/var/lib/dpkg/info/overgrive.prerm: line 5: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Unpacking overgrive (3.2.3) over (3.2.3) ...
Setting up overgrive (3.2.3) ...
/usr/local/bin/python2: No module named pip
dpkg: error processing package overgrive (--install):
subprocess installed post-installation script returned error exit status 1
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Processing triggers for libglib2.0-0:armhf (2.42.1-1) ...
Errors were encountered while processing:
overgrive
pi#raspberrypi:~/Downloads $ pip -V
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg (python 2.7)

Related

can't install python dependency

└─$ sudo dpkg --install python-gobject-2_2.28.6-13+b1_arm64.deb
(Reading database ... 421153 files and directories currently installed.)
Preparing to unpack python-gobject-2_2.28.6-13+b1_arm64.deb ...
Unpacking python-gobject-2 (2.28.6-13+b1) over (2.28.6-13+b1) ...
dpkg: dependency problems prevent configuration of python-gobject-2:
python-gobject-2 depends on python (<< 2.8); however:
Package python is not installed.
python-gobject-2 depends on python (>= 2.7); however:
Package python is not installed.
python-gobject-2 depends on python:any (>= 2.6.6-7~).
python-gobject-2 depends on libffi6 (>= 3.2); however:
Package libffi6 is not installed.
dpkg: error processing package python-gobject-2 (--install):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.36-8) ...
Errors were encountered while processing:
python-gobject-2
I tried to install python dependencies to install zenmap, since I'm on a computer with arm64 architecture, I installed this particular package, but that didn't help either, tell me what to do

apt - dpkg python-rpi.gpio dependency problems

Every time i try to install something, upgrade or autoremove this error happens!
I've searched the web and tried some fixes but they don't seem to work, I don't have python2.7 installed only 3 and can't install python2 or anything because of this. I've tryed to sudo rm python-rpi.gpio_0.7.0-0.1~bpo10+4_armhf.deb but the file will keep comming. Pls I really need some help since I've got some work on my pi and don't want to get a new image
sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
python-rpi.gpio
The following packages will be upgraded:
python-rpi.gpio
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
18 not fully installed or removed.
Need to get 0 B/20.7 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Reading changelogs... Done
(Reading database ... 152893 files and directories currently installed.)
Preparing to unpack .../python-rpi.gpio_0.7.0-0.1~bpo10+4_armhf.deb ...
/var/lib/dpkg/info/python-rpi.gpio.prerm: 6: /var/lib/dpkg/info/python-rpi.gpio.prerm: pyclean: Too many levels of symbolic links
dpkg: warning: old python-rpi.gpio package pre-removal script subprocess returned error exit status 2
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: pyclean: Too many levels of symbolic links
dpkg: error processing archive /var/cache/apt/archives/python-rpi.gpio_0.7.0-0.1~bpo10+4_armhf.deb (--unpack):
new python-rpi.gpio package pre-removal script subprocess returned error exit status 2
/var/lib/dpkg/info/python-rpi.gpio.postinst: 6: /var/lib/dpkg/info/python-rpi.gpio.postinst: pycompile: Too many levels of symbolic links
dpkg: error while cleaning up:
installed python-rpi.gpio package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/python-rpi.gpio_0.7.0-0.1~bpo10+4_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Some notes: I really really don't want to change the SD Card and parcially lose what I have, second I've tried sudo apt-get install -f and sudo apt update --fix-missing when i followed this guide the sudo dpkg --remove --force-remove --reinstreq command was showing this error dpkg: error: unknown force/refuse option 'remove'
As it turns out I still had remainnings of Python2 and Python3 binaries and those were not linked properly by the OS, this means that Python3 was linked to Python2 and vice-versa.
To get it working I had to:
Uninstall the Python2 dependencies
Get the link working correctly
Reinstall Python2 with wget
Verify if all links are working correctly (for Raspbian this means):
python --version links to Python2
python2 --version links to Python2
python3 --version links to Python3
Use the following commands:
sudo dpkg -i --force-overwrite /var/cache/apt/archives//python-rpi.gpio_0.7.0-0.1~bpo10+4_armhf.deb
Still have the same problem, use:
sudo mv /var/lib/dpkg/info/python-rpi.gpio.* /tmp/
sudo dpkg --remove --force-remove-reinstreq python-rpi.gpio
A typo in your command sudo dpkg --remove --force-remove --reinstreq isn't valide. The correct option is --force-remove-reinstreq. See dpkg --force-help.

Installation using setup.py is now impossible on macOS Big Sur

I have 2 of my projects that install perfectly fine on ubuntu, both require python3.8, both are installable using python setup.py install and I occasionally uninstall / install them from / to virtual environments as well as globally for testing purposes. Recently, all kinds of troubles and error messages started to occur not following any special event, I just woke up one day, and tried to install one of them, I got an error, then I tried the other and got another error. I will include both setup.py scripts and show the steps I follow on macOS Big Sur 11.0 to reproduce the results, given that both install perfectly fine on Ubuntu with the same list of respective dependencies.
Versions:
python: 3.8.6
pip: 20.3.1
macOS: 11.0.1
Project 1:
requirements.txt
imagesize==1.2.0
numpy==1.18.5
pandas==1.1.4
seaborn==0.11.0
tensorflow==2.3.1
matplotlib==3.3.3
lxml==4.6.2
imgaug==0.4.0
tensorflow-addons==0.11.2
opencv-python-headless==4.4.0.46
imagecorruptions==1.1.2
configparser~=5.0.1
scipy==1.5.4
PyQt5==5.15.2
tabulate==0.8.7
ipykernel==5.3.4
setup.py
from setuptools import setup, find_packages
install_requires = [dep.strip() for dep in open('requirements.txt')]
setup(
name='project1',
version='1.0',
packages=find_packages(),
url='url',
license='MIT',
author='author',
author_email='email#domain',
description='description goes here',
install_requires=install_requires,
python_requires='>=3.8',
entry_points={
'console_scripts': [
'some_entry_point',
],
},
)
Notes:
I will truncate logs for character limits.
The attempts below are done within a virtualenv
All kinds of problems do not occur if I just use pip install -r requirements
Installation works perfectly fine on Ubuntu and used to work perfectly fine on macOS even after I upgraded to Big Sur, it just suddenly decided to never work again.
python is installed using brew install python#3.8
Attempt 1:
virtualenv proj1
source proj1/bin/activate
python setup.py install
Result:
Searching for PyQt5==5.15.2
Reading https://pypi.org/simple/PyQt5/
Downloading https://files.pythonhosted.org/packages/28/6c/640e3f5c734c296a7193079a86842a789edb7988dca39eab44579088a1d1/PyQt5-5.15.2.tar.gz#sha256=372b08dc9321d1201e4690182697c5e7ffb2e0770e6b4a45519025134b12e4fc
Best match: PyQt5 5.15.2
Processing PyQt5-5.15.2.tar.gz
error: Couldn't find a setup script in /var/folders/hr/61r_7jcx2r3cnklwrr2zwbqw0000gn/T/easy_install-sl9y34mj/PyQt5-5.15.2.tar.gz
Attempt 2: (I install pyqt using pip)
pip install pyqt5==5.15.2 # success
python setup.py install # fail
Result:
No module named numpy.
Attempt 3: (add setup_requires=['numpy==1.18.5'] to setup())
python setup.py install
Result:
numpy.distutils.system_info.NotFoundError: No lapack/blas resources found. Note: Accelerate is no longer supported.
During handling of the above exception, another exception occurred:
# Traceback goes here
RuntimeError: implement_array_function method already has a docstring
Attempt 4:
I checked this issue and there is nothing helpful yet so I manually install numpy and scipy:
pip install numpy==1.18.5 scipy # success
python setup.py install # fail
Result:
ModuleNotFoundError: No module named 'skbuild'
Attempt 5:
pip install scikit-build==0.11.1 # success
python setup.py install # fail
Result:
error: Setup script exited with Problem with the CMake installation, aborting build. CMake executable is cmake
Attempt 6:
I checked the issue here and accordingly:
pip install cmake # success
python setup.py install
Opencv is being built, I'm not sure why or what triggered the build so I aborted and manually installed opencv using pip:
pip install opencv-python-headless==4.4.0.46 # success
python setup.py install # fail
Result:
Could not find suitable distribution for Requirement.parse('tensorflow-addons==0.11.2')
Attempt 7:
pip install tensorflow-addons==0.11.2 # success
python setup.py install
Again lxml is being built, I don't know how or why, so I manually install it and:
pip install lxml==4.6.2 # success
python setup.py install # fail
Result:
Running matplotlib-3.3.3/setup.py -q bdist_egg --dist-dir /var/folders/hr/61r_7jcx2r3cnklwrr2zwbqw0000gn/T/easy_install-q32mufo3/matplotlib-3.3.3/egg-dist-tmp-_js7sem9
UPDATING build/lib.macosx-11.0-x86_64-3.8/matplotlib/_version.py
set build/lib.macosx-11.0-x86_64-3.8/matplotlib/_version.py to '3.3.3'
error: Setup script exited with error: Failed to download FreeType. Please download one of ['https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz', 'https://download.savannah.gnu.org/releases/freetype/freetype-2.6.1.tar.gz'] and extract it into build/freetype-2.6.1 at the top-level of the source repository.
Attempt 8:
pip install matplotlib==3.3.3 # success
python setup.py install # fail
Result:
Could not find suitable distribution for Requirement.parse('tensorflow==2.3.1')
Attempt 9:(already more than 75% of the requirements were already installed manually using pip in the previous attempts)
pip install tensorflow==2.3.1 # success
python setup.py install # fail
Result:(pandas fails to install)
RuntimeError: Cannot cythonize without Cython installed.
Attempt 10: (I manually install cython)
pip install cython # success
python setup.py install
Again pandas for some reason is being built, so I manually install it and the list goes on ...
I think after this simple demonstration, I don't even need to replicate the steps of the second project however here are its requirements and I pretty much get a variation of the same problems shown above.
requirements.txt for project2
oauth2client==4.1.3
gcloud==0.18.3
pyarrow==2.0.0
requests==2.24.0
pandas==1.1.4
httplib2==0.15.0
TA-Lib==0.4.19
matplotlib==3.3.2
matplotlib fails first, followed by ta-lib (given that I run brew install ta-lib before then) and the list goes on ...
Instead of python setup.py install do python -m pip install ..
Instead of python setup.py develop do python -m pip install --editable ..

Can't install packages like simpleHTTPServer with pip2.7

I'm trying to install a module called simpleHTTPServer but can't do so as described below:
root#kali:~# pip install simpleHTTPServer
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement simpleHTTPServer (from versions: none)
ERROR: No matching distribution found for simpleHTTPServer
root#kali:~#
I've screwed up my python2.7 a few hours ago by accidentally removing (rm) the python2.7 file in /usr/bin instead of renaming it with mv because i didn't pay attention to what i was doing. So I removed everything that had to do with python2.7. I've then managed to download python 2.7.18 from the official site and executed these commands below AS ROOT:
cd /home/johnmap007/Downloads/Python-2.7.18
./configure
make
make install
python setup.py clean
python setup.py build
python setup.py install
Then I got back up and running. pip started to work ok and python gives me the interpreter when i execute it in the cmd line. I am running Kali Linux by the way. I tried installing other packages like scapy and they worked. I don't know why i can't install this specific package. Any help would be greatly appreciated. Thanks in advance!
EDIT: For some reason, as i was running apt upgrade, i got errors about python2.7 not being configured the right way:
Setting up python2.7 (2.7.18-1) ...
/var/lib/dpkg/info/python2.7.postinst: 9: /usr/bin/python2.7: not found
dpkg: error processing package python2.7 (--configure):
installed python2.7 package post-installation script subprocess returned error exit status 127
Setting up sqlmap (1.4.11-1) ...
Installing new version of config file /etc/sqlmap/sqlmap.conf ...
Setting up libgstreamer-plugins-base1.0-0:amd64 (1.18.1-1) ...
Setting up libgstreamer-plugins-base1.0-0:i386 (1.18.1-1) ...
dpkg: dependency problems prevent configuration of python2:
python2 depends on python2.7 (>= 2.7.18~); however:
Package python2.7 is not configured yet.
dpkg: error processing package python2 (--configure):
dependency problems - leaving unconfigured
Setting up seclists (2020.4-0kali1) ...
Setting up libgstreamer-gl1.0-0:amd64 (1.18.1-1) ...
Setting up gstreamer1.0-plugins-base:amd64 (1.18.1-1) ...
Setting up gstreamer1.0-plugins-base:i386 (1.18.1-1) ...
Setting up python3-cryptography (3.2.1-1) ...
Setting up libsvn1:amd64 (1.14.0-3) ...
dpkg: dependency problems prevent configuration of python2.7-dev:
python2.7-dev depends on python2.7 (= 2.7.18-1); however:
Package python2.7 is not configured yet.
dpkg: error processing package python2.7-dev (--configure):
dependency problems - leaving unconfigured
Setting up gstreamer1.0-gl:amd64 (1.18.1-1) ...
Setting up gstreamer1.0-x:amd64 (1.18.1-1) ...
Setting up gstreamer1.0-x:i386 (1.18.1-1) ...
Setting up gstreamer1.0-alsa:amd64 (1.18.1-1) ...
dpkg: dependency problems prevent configuration of python2-dev:
python2-dev depends on python2 (= 2.7.18-2); however:
Package python2 is not configured yet.
python2-dev depends on python2.7-dev (>= 2.7.18~); however:
Package python2.7-dev is not configured yet.
dpkg: error processing package python2-dev (--configure):
dependency problems - leaving unconfigured
Setting up gir1.2-gst-plugins-base-1.0:amd64 (1.18.1-1) ...
Setting up subversion (1.14.0-3) ...
Processing triggers for kali-menu (2020.4.0) ...
Processing triggers for libc-bin (2.31-4) ...
Processing triggers for man-db (2.9.3-2) ...
Errors were encountered while processing:
python2.7
python2
python2.7-dev
python2-dev
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
I have no idea what happened and i tried running dpkg --configure -a already. Can someone help me please?
That's in the standard library, so you don't need to install anything
https://docs.python.org/2/library/simplehttpserver.html
You can start it with
python -m SimpleHTTPServer
But you should use Python3, anyway, where it's renamed
python3 -m http.server
I removed everything that had to do with python2.7
You're modifying operating system files at that point, and Kali Linux uses Python for more than your own scripting purposes. But based on /usr/bin/python2.7: not found, you could start symlink-ing files around to fix at least that error

Remove mercurial-common from Ubuntu 15.04

I'm having Python 2.x problems on Ubuntu 15.04. I wanted to completely uninstall and reinstall Python. I can't uninstall Python because mercurial-common depends on it. I try to remove that and I get an error:
➜ ~ sudo apt-get remove --purge mercurial-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
gnome-control-center-data gnome-icon-theme gnome-icon-theme-symbolic gnome-settings-daemon libcolord-gtk1 libexpat1-dev libgoa-backend-1.0-1 libjs-excanvas libpython3-dev
libpython3.4-dev python3-colorama python3-dev python3-distlib python3-wheel python3.4-dev
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
mercurial-common*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 8,610 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 206144 files and directories currently installed.)
Removing mercurial-common (3.1.2-2+deb8u1build0.15.04.2) ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error processing package mercurial-common (--purge):
subprocess installed pre-removal script returned error exit status 1
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
mercurial-common
E: Sub-process /usr/bin/dpkg returned an error code (1)
The mercurial-common removal scripts use python
/var/lib/dpkg/info/mercurial-common.prerm
If you type which pyclean I assume it exists.
However I suspect you python problems prevent it working. (you could try running it manually to verify this)
Unfortunately pyclean is in package python-minimal so you prolly can't uninstall this before mercurial-common.
you could try just removing it manually by:
sudo mv /usr/bin/pyclean /usr/bin/pyclean.backup
(Just remember to put it back).
Alternatively rather than completely removing python you could try just reinstalling python package .deb over the top of the existing install using dpkg --install

Categories