Python Elasticsearch urllib3 exception

I have to use python-elasticsearch library on a machine where I could only execute programs. I am trying to use elasticsearch module by appending sys.path as mentioned below. I am facing below issue. It looks like the problem related to what is mentioned here . But how do I resolve this when I dont have sudo access or any sort of upgrade access.

	import sys
	from elasticsearch import Elasticsearch
	Traceback (most recent call last):
	  File "<stdin>", line 1, in <module>
	  File "/tmp/elasticpy/elasticsearch-2.3.0/elasticsearch/", line 17, in <module>
		from .client import Elasticsearch
	  File "/tmp/elasticpy/elasticsearch-2.3.0/elasticsearch/client/", line 5, in <module>
		from ..transport import Transport
	  File "/tmp/elasticpy/elasticsearch-2.3.0/elasticsearch/", line 4, in <module>
		from .connection import Urllib3HttpConnection
	  File "/tmp/elasticpy/elasticsearch-2.3.0/elasticsearch/connection/", line 3, in <module>
		from .http_urllib3 import Urllib3HttpConnection
	  File "/tmp/elasticpy/elasticsearch-2.3.0/elasticsearch/connection/", line 2, in <module>
		import urllib3
	ImportError: No module named urllib3

Don't modify sys.path like that. Use virtualenv to create a sandboxed Python environment where you can install any packages (including elasticsearch-py). Something like this should work:

virtualenv .python
source .python/bin/activate
pip install elasticsearch

(If the system doesn't have virtualenv you obviously have to install it first, but that's totally doable even without root access.)

Thank @magnusbaeck . PIP was not installed in this machine hence I could not install vevn and elasticsearch directly.

I was able to resolve this be using easy_install to install pip to a directory where I had permission and then later vevn and then elasticsearch. Please find the steps I followed to resolve it.

	export PYTHONPATH="${PYTHONPATH}:/tmp/pytest/"
	easy_install  --install-dir /tmp/pytest/  pip       
	pip install virtualenv --prefix /tmp/pytest/
	export PATH="${PATH}:/tmp/pytest:/tmp/pytest/bin"
	export PYTHONPATH="${PYTHONPATH}:/tmp/pytest/lib/python2.7/site-packages"
	cd /tmp/
	virtualenv venv
	source venv/bin/activate
	pip install elasticsearch