pip install django-twilio Error installation - django

Trying to install django-twilo using pip on ubuntu machine
Getting error
referring doc
workspace/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/home/rahul/workspace/repository/inteliexam_workspace/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Using cached django_twilio-0.8.0-py2.py3-none-any.whl
Collecting django-phonenumber-field>=0.6 (from django-twilio)
Using cached django-phonenumber-field-1.3.0.tar.gz
Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
File "/home/rahul/workspace/repository/inteliexam_workspace/local/lib/python2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
import setuptools # noqa
File "/home/rahul/workspace/repository/inteliexam_workspace/local/lib/python2.7/site-packages/setuptools/__init__.py", line 12, in <module>
import setuptools.version
File "/home/rahul/workspace/repository/inteliexam_workspace/local/lib/python2.7/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/home/rahul/workspace/repository/inteliexam_workspace/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 70, in <module>
import packaging.version
ImportError: No module named packaging.version

You have a typo. It is django-twilio, not django-twillio

The right command that you should use, as you can see from the doc is
pip install django-twilio
and not
pip install django-twillio
EDIT
To fix your problem you can run this command
pip install -U setuptools
and after run again
pip install django-twilio

Related

how to install the ssl module for python 2.7.17 on opensuse (SLES) 15 SP2?

I have installed OpenSSL and python2-pyOpenSSL-17.5.0-lp152.6.2.noarch.rpm in my SLES machine and still, I am getting the following error:
import ssl inside python CLI
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named ssl
pip install numpy gives the following error:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Can anyone help me with this?
You may need to install libopenssl-devel package

pip: ImportError: No module named retrying

I'm trying to create a new environment and install various 3rd party packages on an Ubuntu machine. After having to install condo (for a matplotlib installation) and gdal, the pip function no longer works. Instead I receive:
Traceback (most recent call last):
File "/media/imagery/ENVIRONMENTS/Project_1/bin/pip", line 7, in <module>
from pip._internal import main
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 14, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python2.7/dist-packages/pip/utils/__init__.py", line 30, in <module>
from pip._vendor.retrying import retry
ImportError: No module named retrying
I've called pip both in and outside my environment, and still observe the same issue. Also I've tried a pip install --upgrade pip and still retrieve the same Traceback. Any ideas how to resolve this?
As a cheap workaround, export PYTHONPATH=" " seemed to work for now in order to install other packages, but as soon as I need the gdal package, I have to then set PYTHONPATH again.
I had a similar exception and could manage to repair it.
In my case I upgraded Ubuntu 16.04 to Ubuntu 18.04.
I had to re-create the virtualenv. Depending on your choice:
virtualenv .
Or
virtualenv --system-site-packages .

bzt 1.1.0 says DistributionNotFound: selenium

I just installed bzt 1.1.0 on my MacOSX but it won't run, it gives this message:
Traceback (most recent call last):
File "/usr/local/bin/bzt", 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: selenium
The thing is, selenium 2.49.2 was installed along with bzt. How can I fix this?
Turns out it was a Python package management issue. Selenium was installed in /Library/Python/2.7/site-packages with a selenium-2.49.2.dist-info directory, not the .egg-info directory that pkg_resources.py expected.
Upgrading to a newer version of pkg_resources helped, as explained in this answer:
sudo pip install --upgrade setuptools
Then, reinstalling selenium finally fixed the problem:
sudo pip uninstall selenium
sudo pip install selenium
Thanks to Andrey Pohilko on the Google Groups forum for helping out.

Patch pyopenssl for sslv3 issue

I got a problem on a Debian 8 system with python 2.7.9-2 amd64:
marius#pydev:/usr/lib/python2.7/dist-packages/urllib3/contrib$ pip search doo
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
['__name__'])
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 22, in <module>
import requests, six
File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 53, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 73, in <module>
ssl.PROTOCOL_SSLv3: OpenSSL.SSL.SSLv3_METHOD,
**AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'**
I checked into the lib and tried to patch /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/contrib/pyopenssl.py
from .. import connection
from .. import util
__all__ = ['inject_into_urllib3', 'extract_from_urllib3']
# SNI only *really* works if we can read the subjectAltName of certificates.
HAS_SNI = SUBJ_ALT_NAME_SUPPORT
# Map from urllib3 to PyOpenSSL compatible parameter-values.
_openssl_versions = {
ssl.PROTOCOL_SSLv23: OpenSSL.SSL.SSLv23_METHOD,
**ssl.PROTOCOL_SSLv3: OpenSSL.SSL.SSLv3_METHOD,**
ssl.PROTOCOL_TLSv1: OpenSSL.SSL.TLSv1_METHOD,
}
_openssl_verify = {
ssl.CERT_NONE: OpenSSL.SSL.VERIFY_NONE,
ssl.CERT_OPTIONAL: OpenSSL.SSL.VERIFY_PEER,
ssl.CERT_REQUIRED: OpenSSL.SSL.VERIFY_PEER
+ OpenSSL.SSL.VERIFY_FAIL_IF_NO_PEER_CERT,
}
Could someone enlighten me how I can fix this? It would be super awesome if someone had a clue. I googled the issue and only found incomplete patches and it's messy. Probably a case for the bug tracker once this is fixed, too. I have this issue for all Python packages.
This is actually an issue with urllib3, not with pyopenssl. Debian lately compiles OpenSSL without SSLv3 support, and urllib3 just assumed that support was there.
The issue was fixed in commit b9b3b0102 which is part of the 1.10 release of urllib3.
As you are using urllib3 as part of requests, which in turn is used by pip, it should be enough to update to a recent version of requests. As of writing, the current version is 2.6.0 which contains the fix:
# pip install requests==2.6.0
You might encounter a problem upgrading requests, because of the chicken-egg problem. To fix this, you can try to temporarily remove the pyopenssl package, upgrade requests and reinstall pyopenssl.
Additionally you might want to use the following line to update pip before trying to update requests:
# sudo easy_install --upgrade pip
Another way to fix the problem is to use
sudo easy_install --upgrade pip
and use pip normally afterwards
I've received the same error.
In conjunction with the previous answers:
sudo easy_install --upgrade pip
I've also had to run:
sudo pip uninstall pyopenssl
sudo pip install mozdownload
This fixed my error, maybe it can help others. I came here by googling:
AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'
I ran into this problem today with Ansible. I solved it with:
pip uninstall pyopenssl
maybe this will help someone else in the same situation
I received this error after an upgrade from Ubuntu 14 to 16. The upgrade changed some Python paths, which broke some core packages. This answer essentially fixed it for me.
sudo apt-get purge python-pkg-resources
sudo apt-get -f install
sudo rm -Rf /usr/local/bin/pip
sudo apt-get install python-pip
sudo pip install -U pip
I meet the same problems and I just uninstall the version of requests and install the exact version by using the following command.
pip install requests==2.6.0
then it works
I ran into this on a new Xenial and was unsuccessful w/many answers I had seen (some I really didn't try because most of my software was more current). What finally solved it for me was: sudo pip install requests --upgrade ... which is just a twist on the other request upgrade recommendation.

How to use ssl in python 2.7

I am using python 2.7 and i need secure url with ssl protocol(HTTPS).Can we do this in python 2.7
when i trying to import ssl i m getting the following error
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib64/python2.7/ssl.py", line 60, in
import _ssl # if we can't import it, let the error propagate
ImportError: /usr/lib64/python2.7/lib-dynload/_ssl.so: symbol SSLeay_version, version OPENSSL_1.0.1 not defined in file libcrypto.so.10 with link time reference.
Please help me if anybody know...Thanks in advance
I got Answer
I have re-installed openssl
This is the code i used in terminal
sudo yum install openssl-devel