安装elastic-search-curator时Python pip包RequestsDependencyWarning

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51283708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 19:48:21  来源:igfitidea点击:

Python pip package RequestsDependencyWarning when installing elastic-search-curator

pythonelasticsearchpipelasticsearch-curator

提问by Robbo_UK

I installed elastic search curator via the following command.

我通过以下命令安装了弹性搜索策展人。

sudo pip install -U elasticsearch-curator

It all installed OK.

一切安装OK。

However now when I do the following

但是现在当我执行以下操作时

curator_cli --version

I get the following dependency warning.

我收到以下依赖警告。

 /usr/local/lib/python2.7/dist-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
curator_cli, version 5.5.4

How do I either fix the warning or hide it?

如何修复警告或隐藏它?

回答by Robbo_UK

So took a couple of things for me to get this working.

所以我做了一些事情来让这个工作。

First I upgraded cyptography as per Mufeeds suggestion

首先,我按照 Mufeeds 的建议升级了密码学

sudo pip install --upgrade cryptography

This then gave me a new error everytime I did pip <any command>

然后每次我这样做时都会给我一个新错误 pip <any command>

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 7, in <module>
    from pip._internal import main
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 15, in <module>
    from pip._vendor import html5lib, requests, six
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 86, in <module>
    from pip._vendor.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in <module>
    SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

Resolved this by resintalling PyOpenSSL

通过重新安装 PyOpenSSL 解决了这个问题

sudo python -m easy_install --upgrade pyOpenSSL

Curator is now working as expected without the warnings

策展人现在按预期工作,没有警告

curator_cli --version
> curator_cli, version 5.5.4

回答by openCivilisation

This 1st step below will update cryptography, but break pyopenssl.

下面的第一步将更新密码学,但会破坏 pyopenssl。

sudo pip install --upgrade cryptography

We can fix that by removing the pyopennssl library and use pip to reinstall.

我们可以通过删除 pyopennssl 库并使用 pip 重新安装来解决这个问题。

sudo rm -rf /usr/lib/python2.7/dist-packages/OpenSSL
sudo rm -rf /usr/lib/python2.7/dist-packages/pyOpenSSL-0.15.1.egg-info
sudo pip install pyopenssl --upgrade
sudo pip install cryptography --upgrade

The last line will produce an error if the open sll library were to still be broken, so this validates all should be well...

如果打开的 sll 库仍然被破坏,最后一行将产生错误,因此这验证一切都应该很好......

My preference is to avoid another package manage like easy install in the mix, so sharing this in case that is anyone else's preference as well.

我的偏好是避免另一个包管理,比如在混合中轻松安装,所以分享这个以防其他人也喜欢。