Python pip package RequestsDependencyWarning when installing elastic-search-curator - python

I installed elastic search curator via the following command.
sudo pip install -U elasticsearch-curator
It all installed 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?

So took a couple of things for me to get this working.
First I upgraded cyptography as per Mufeeds suggestion
sudo pip install --upgrade cryptography
This then gave me a new error everytime I did 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
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

This 1st step below will update cryptography, but break pyopenssl.
sudo pip install --upgrade cryptography
We can fix that by removing the pyopennssl library and use pip to reinstall.
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...
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.

Related

Python can not import pywifi

I have install pywifi module and it success, when I try to import pywifi,I got this error.
>>> import pywifi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/pywifi/__init__.py", line 15, in <module>
from .wifi import PyWiFi
File "/Library/Python/2.7/site-packages/pywifi/wifi.py", line 15, in <module>
from .iface import Interface
File "/Library/Python/2.7/site-packages/pywifi/iface.py", line 15, in <module>
raise NotImplementedError
NotImplementedError
someone can help me?
Which python version are you running? It might be because it is installed as a Python 3 package and you're running Python 2.7 or the opposite.
To specifically install the package for Python 3, try entering this command:
pip3 install pywifi
or
python3 -m pip install pywifi
To specifically install the package for Python 2, try entering this command:
pip2 install pywifi
or
python -m pip install pywifi
I got similar errors, from the error message, I tried to install those packages that pywifi seemed to depend on, i.e., I ran
pip install comtypes
pip install iface
then it worked.

Troubles installing mysqlclient with pip3

I'm trying to set up a python 3.6 environment with Django. The installation instructions say I should install mysqlclient to be able to connect to mySQL. I get this:
dennis#django:~$ sudo -H pip3 install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.10.tar.gz
Complete output from command python setup.py egg_info:
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-4jiw3hvk/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/tmp/pip-build-4jiw3hvk/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-build-4jiw3hvk/mysqlclient/setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-4jiw3hvk/mysqlclient/
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
mySQL is properly installed. What should be in the mysql_config file?
When I try to upgrade pip3 I get this:
dennis#django:~$ sudo -H pip3 install --upgrade pip3
Collecting pip3
Could not find a version that satisfies the requirement pip3 (from versions: )
No matching distribution found for pip3
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
After installing mysqlclient with pip3, I noticed that the module was installed in the python3.5 directory instead of in the python3.6 directory so when I tried to import the MySQLdb module running python3.6, it was not found
dennis#django:~/python_db$ python
Python 3.6.0+ (default, Feb 4 2017, 11:11:46)
[GCC 5.4.1 20161202] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'MySQLdb'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'MySQLdb'
>>>
I then reran using python 3.5 and it was found. How do I install modules using pip3 into the 3.6 directory?
If you're using Mac OS, try this:
brew install mysql
If you're using Ubuntu14/16, try this:
sudo apt install libmysqlclient-dev
and one more:
pip3 can be updated with sudo pip3 install -U pip
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient
In my case the issue was solved by doing the following:
sudo aptitude install libmysqlclient-dev
As I was using Python 3.x, the following was also necessary:
sudo aptitude install python3-dev
If you're running MAMP on OSX, do this:
export PATH=$PATH:/Applications/MAMP/Library/bin
In Debian Stretch the required package name seems to have changed to default-libmysqlclient-dev
https://packages.debian.org/stretch/default-libmysqlclient-dev
you can try this to install mysql to a particular python directory, for example w/ python 3.6
sudo python3.6 /usr/bin/pip3 install mysqlclient
Looking over this old question (while looking for something else), I observe that the problem could be that the directory containing mysql_config was not in the current $PATH. Apparently that's what the install script uses to try to find it. It's possible for "mysql to be installed," but not on the $PATH – or for the $PATH to refer to the wrong version.

Install the ipython ImportError: No module named pickleshare

Today,I have installed the ipython by the follow steps:
cd
sudo apt-get install git
git clone https://github.com/ipython/ipython.git
cd ipython
sudo python setup.py install
But I meet a error when I open the ipython:
~$ ipython
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 4, in <module>
from IPython import start_ipython
File "/usr/local/lib/python2.7/dist-packages/IPython/__init__.py", line 48, in <module>
from .terminal.embed import embed
File "/usr/local/lib/python2.7/dist-packages/IPython/terminal/embed.py", line 16, in <module>
from IPython.core.interactiveshell import DummyMod
File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 31, in <module>
from pickleshare import PickleShareDB
ImportError: No module named pickleshare
How to deal with the error?
I solved the problem with sudo easy_install pickleshare
(https://pypi.python.org/pypi/pickleshare/0.3)
It looks that pickleshare is in package IPython.utils.
Use this pip install -I path.py==7.7.1
Updating the package to version 8.1 should fix the problem as well now:
pip install -I path.py==8.1

Can't get Theano to work on ubuntu 14.04

I'm trying to use Theano on ubuntu 14.04, I've followed the guide for an easy install located here http://deeplearning.net/software/theano/install_ubuntu.html#install-ubuntu
Everything says it's installed fine, if I run:
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
Then I get in return
Reading package lists... Done
Building dependency tree
Reading state information... Done
g++ is already the newest version.
git is already the newest version.
python-dev is already the newest version.
python-nose is already the newest version.
python-numpy is already the newest version.
libopenblas-dev is already the newest version.
python-pip is already the newest version.
python-scipy is already the newest version.
0 to upgrade, 0 to newly install, 0 to remove and 18 not to upgrade.
And when running
sudo pip install Theano
I get
Requirement already satisfied (use --upgrade to upgrade): Theano in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.5.0 in ./.local/lib/python2.7/site-packages (from Theano)
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.7.2 in /usr/lib/python2.7/dist-packages (from Theano)
Cleaning up...
But when I go to run the tests they just don't work.
python -c "import numpy; numpy.test()"
gives me
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/josh/.local/lib/python2.7/site-packages/numpy/__init__.py", line 153, in <module>
from . import add_newdocs
File "/home/josh/.local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/home/josh/.local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/home/josh/.local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/home/josh/.local/lib/python2.7/site-packages/numpy/core/__init__.py", line 6, in <module>
from . import multiarray
ImportError: /home/josh/.local/lib/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS4_AsUnicodeEscapeString
and
python -c "import scipy; scipy.test()"
gives me
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named scipy
The last test gives very similar results
josh#josh-GA-78LMT-S2P:~$ python -c "import theano; theano.test()"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named theano
I'm a complete linux newbie so I'm completely baffled by what could be the problem.
If you can, I would simply use a "scientific" Python - either Anaconda (my preference) or Enthought Python. In addition to avoiding systemwide installation of packages, it is easy to install things with pip and numpy and scipy come preinstalled. For updating numpy and scipy you can also use the built-in conda package manager - it does an excellent job of handling the nasty work behind installing a new numpy or scipy.

pip install pygtk not working

Any ideas as to what this means? I don't know if this helps, but it seems like most things I try to pip install don't install correctly and I get errors.
BenjaminsMacBook:~ OwlFace$ pip install pygtk
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: pip==1.4.1
BenjaminsMacBook:~ OwlFace$
pygtk install script can't find pip 1.4.1
you have to install pip 1.4.1
You can check my answer here. Basically, to fix it, run:
easy_install --upgrade pip
There's a Dependency of pip required version = 1.4.1,
$ which pip
/usr/local/bin/pip
if no output here probably you dont have pip installed
$ pip --version
pip 1.4.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
if your version is not 1.4.1, update pip
Your error shows that you have pip installed, so check the version
BenjaminsMacBook:~ OwlFace$ pip install pygtk
Traceback (most recent call last):
===> File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
For pip1.4.1 visit: https://pypi.python.org/pypi/pip/

Categories

Resources