error using pip search (pip search stopped working)

血红的双手。 提交于 2021-01-21 06:51:42

问题


Error image

I am getting this error in pip search while studying python. The picture is an error when I pip search. Can you tell me how to fix it?

$ pip search pdbx
ERROR: Exception:
Traceback (most recent call last):                                                                                                                                                  
  File "*/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 224, in _main                                                
    status = self.run(options, args)                                                                                                                                                
  File "*/lib/python3.7/site-packages/pip/_internal/commands/search.py", line 62, in run                                                    
    pypi_hits = self.search(query, options)                                                                                                                                         
  File "*/lib/python3.7/site-packages/pip/_internal/commands/search.py", line 82, in search                                                 
    hits = pypi.search({'name': query, 'summary': query}, 'or')                                                                                                                     
  File "/usr/lib/python3.7/xmlrpc/client.py", line 1112, in __call__                                                                                                                
    return self.__send(self.__name, args)                                                                                                                                           
  File "/usr/lib/python3.7/xmlrpc/client.py", line 1452, in __request                                                                                                               
    verbose=self.__verbose                                                                                                                                                          
  File "*/lib/python3.7/site-packages/pip/_internal/network/xmlrpc.py", line 46, in request                                                 
    return self.parse_response(response.raw)                                                                                                                                        
  File "/usr/lib/python3.7/xmlrpc/client.py", line 1342, in parse_response                                                                                                          
    return u.close()                                                                                                                                                                
  File "/usr/lib/python3.7/xmlrpc/client.py", line 656, in close                                                                                                                    
    raise Fault(**self._stack[0])                                                                                                                                                   
xmlrpc.client.Fault: <Fault -32500: 'RuntimeError: This API has been temporarily disabled due to unmanageable load and will be deprecated in the near future. Please use the Simple or JSON API instead.'>              

回答1:


Follow the suggestion from JRK at the discussion at github (last comment) the search command is temporarily disabled, use your browser to search for packages meanwhile: Check the thread on github and give him a thumb up ;)




回答2:


The pip search command queries PyPI's servers, and PyPI's maintainers have explained that the API endpoint that the pip search command queries is very resource intensive and too expensive for them to always keep open to the public. Consequently they sometimes throttle access and are actually planning to remove it completely soon.

See this GitHub issues thread ...

The solution I am using for now is to pip install pip-search (a utility created by GitHub user @victorgarric).

So, instead of 'pip search', I use pip_search. Definitely beats searching PyPI via a web browser




回答3:


The error says

Please use the Simple or JSON API instead

You can try pypi-simple to query the pip repository

https://pypi.org/project/pypi-simple/

It gives an example too, I tried to use it here:

pypi-simple version 0.8.0 DistributionPackage' object has no attribute 'get_digest'



来源:https://stackoverflow.com/questions/65307988/error-using-pip-search-pip-search-stopped-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!