Getting error with pip search and pip install
Solution 1:
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:
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:
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.