February 26, 2019

Install Package From PIP Ignore Trusted Host

Connection is Power

Yah connection is power dan jangan berpikir problems can occur due to connection ketika kalian menemukan masalah yang berkaitan dengan internet. Disuatu waktu I’m siBunglon menemukan masalah pada saat akan melakukan installasi package dari python-pip, paketnya tidak bisa diinstall tapi diwaktu itu I’m siBunglon menggunakan koneksi yang dikelola oleh orang lain dan mencoba browsing eh ternyata lancar jaya, mencoba menggunakan Wi-Fi dari device yang lain dan masalah tersebut tidak muncul. Hmmm ada yang unik, I’m siBunglon menemukan errors message seperti berikut:

[root@airgreen siBunglon]# pip install sendgrid==2.2.1
Collecting sendgrid==2.2.1
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args)
File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 307, in run requirement_set.prepare_files(finder)
File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 370, in prepare_files ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 587, in _prepare_file session=self.session, hashes=hashes)
File "/usr/lib/python2.7/site-packages/pip/download.py", line 810, in unpack_url hashes=hashes File "/usr/lib/python2.7/site-packages/pip/download.py", line 649, in unpack_http_url hashes) File "/usr/lib/python2.7/site-packages/pip/download.py", line 842, in _download_http_url stream=True,
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 487, in get return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/site-packages/pip/download.py", line 378, in request return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 475, in request resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 585, in send r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 46, in send resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 477, in send raise SSLError(e, request=request) SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)

Jangan panik 😂 itu bukan masalah besar. Jika kalian mengalami hal yang sama ataupun mendapatkan error message yang sama seperti I’m siBunglon paparkan, cukup tambahkan –trusted-host pypi.org –trusted-host files.pythonhosted.org pada saat akan menginstall package dari python-pip.

Contoh, I’m siBunglon akan install sendgrid dari python-pip, karena command pip install sendgrid==2.2.1 mendapatkan errors message seperti diatas maka I’m siBunglon menggunakan command pip install--trusted-host pypi.org --trusted-host files.pythonhosted.orgsendgrid==2.2.1.