Getting error with pip search and pip install

Python 3.xPip

Python 3.x Problem Overview


hi it is about two days I am getting this error:

ERROR: XMLRPC request failed [code:-32500] RuntimeError: PyPI's XMLRPC API is currently disabled due to unmanageable load and will be deprecated in the near future. See https://status.python.org/ for more information.

I asked from some people and searched a lot but I din't kbow what is the problem and how to fix it I tryed apt update and python3 pip install --upgrade pip recommended by pip itself I am in android using Termux pip was working for some days ago...

Python 3.x Solutions


Solution 1 - Python 3.x

Sadly pip search is now permanently banned by python.org.
They said that they are experiencing "hundreds of thousands of search calls per hour" for 100 days(since Nov 14, 2020), and the XMLRPC API, via which the search calls are taking, had already been determined to be deprecated before this happened.
So maybe we need to search for packages directly on pypi.org, or turn to packages like pypi-simple-search or pipsearch.

Solution 2 - Python 3.x

For search base on package name pattern, I share this script below, hope you find it useful.

#!/bin/bash
# pypi-search.sh 
# This script fetch data from https://pypi.org/simple/ 
# process the output for simple package name output with perl
# and then apply a regex pattern to the result

pypiurl=https://pypi.org/simple/
currentdate=$(date +%y%m%d)

cachedir=~/.cache/simple-pypi
[[ -d $cachedir ]] || mkdir -p $cachedir

cachefile=$(ls -1 $cachedir/*_simple-pypi.html 2>/dev/null | sort | head -n1)
[[ $cachefile = "" ]] && cachefile=$cachedir/"${currentdate}_simple-pypi.html"

searchpattern="$1"
cmd="$2"

if [[ -f $cachefile ]] ; then
    dbdate=$(echo $cachefile | grep -Po "[0-9]{6,6}")
    # if db is older than 3 days or second parameter is 'update'
    ( (( ($currentdate - $dbdate) > 3 )) || [[ "x$cmd"  = 'xupdate' ]] ) && {
        echo "last update was on : $dbdate"
        cachefile=$cachedir/"${currentdate}_simple-pypi.html"
        wget -q --show-progress -O - $pypiurl > $cachefile
    }
else
    wget -q --show-progress -O - $pypiurl > $cachefile
fi

[[ x$searchpattern = "x" ]] && read -p "Enter pypi name pattern : " searchpattern
perl -pe 's/.*([\/"]{1,1}\>){1,1}([^>]+(.*)[^<])+\<\/a\>/\2/g' $cachefile | grep -P "$searchpattern"

Usage: pypi-search.sh ^pip$

Solution 3 - Python 3.x

If you follow the link, in the last update they stated that the XMLRPC API is disabled (due to outrageous traffic). This means pip search is currently disabled. The last update was posted one month ago, I can't see any change.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionM-A voidView Question on Stackoverflow
Solution 1 - Python 3.xLightyearsView Answer on Stackoverflow
Solution 2 - Python 3.xDorianView Answer on Stackoverflow
Solution 3 - Python 3.xDóra SzendreiView Answer on Stackoverflow