pip install breaks due to SSL certs - flask

When I try to do a pip install Flask I get some ssl errors. If I try to add exceptions there is no difference. I googled around and see some discussion on this from a year ago but nothing else (see https://github.com/pypa/pip/issues/5063)
(venv) pip install -U flask --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org
Collecting flask
Could not fetch URL https://pypi.python.org/simple/flask/: There was a problem confirming
the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
Could not find a version that satisfies the requirement flask (from versions: )
No matching distribution found for flask

NOTE : THIS MIGHT ALREADY SOMETHING THAT YOU HAVE TRIED
This is probably due to the fact that you are using --trusted-host=pypi.python.org .
This has happened since sometime during April 2018, the Python Package Index was migrated from pypi.python.org to pypi.org. This means "trusted-host" commands using the old domain no longer work.
So the command you are looking for would be pip install -U flask --trusted-host pypi.org --trusted-host=files.pythonhosted.org.
For furthur details , have a look at this this.

Related

appcfg.py request_logs certificate verify failed (_ssl.c:661)

We've been using appcfg.py request_logs to download GAE logs, every once in a while it throws the error:
httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)
But after a few times trying it works out, sometimes also it works after updating gcloud using gcloud components update. We thought it might be some network throttling issue of some kind and didn't give it enough thought. Lately though, we're trying to figure out what is causing this.
The full command we use is:
appcfg.py request_logs -A testapp --version=20180321t073239 --severity=0 all_logs.log --append --no_cookies
It seems the error is related to httplib2 library, but since it is part of the appcfg.py calls we're not sure we should tamper with something within its calls
Versions:
Python 2.7.13
Google Cloud SDK 196.0.0
app-engine-python 1.9.67
This has become more persistent now and I couldn't download logs for a few days now no matter how many times I try.
Looking at the download logs command I tried the same command again but without the --no_cookies flag to see what would happen.
appcfg.py request_logs -A testapp --version=20180321t073239 --severity=0 all_logs.log --append
I got the error:
Error 403: --- begin server output ---
You do not have permission to modify this app (app_id=u'e~testapp').
--- end server output ---
Which lead me to the answer provided here https://stackoverflow.com/a/34694577/1394228 by #ninjahoahong. This worked for me and logs where downloaded from first trial in case someone faces the same issue
There's also this Google Group post which I didn't try but seems like it does the same thing.
Not sure if removing the file ~/.appcfg_oauth2_tokens would have other effects, yet to find out.
Update:
I also found out that my httplib2 located at /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/httplib2 was version = "0.7.5", I upgraded it to version = '0.11.3' using target location(directory) upgrade command:
sudo pip2 install --upgrade httplib2 -t /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/httplib2/

Certbot throws TypeError

I'm a little stumped here. I've never seen an error from inspect.py before, but here I am trying to install some SSL certificates with certbot and an error occurs. The certbot log including the stack trace is here, but the error is:
File "/usr/lib64/python2.7/inspect.py", line 815, in getargspec
raise TypeError('{!r} is not a Python function'.format(func))
TypeError: <method-wrapper '__ne__' of type object at 0x1eeab80> is not a Python function
And occurs when running certbot certonly. Other commands, such as retrieving the version, are fine.
I've tried a few things (uninstalling/reinstalling, etc) but to no avail. I'm trying to avoid installing from git or some other source (trying to stick with yum). Some more details
Centos # 7.1.1503 (Core)
certbot # 0.8.1
What's strange is this error seems to indicate an error in implementation, but I find this strange, since I'm using certbot on another CentOS 7 machine without issue.
Any help is greatly appreciated. I will open an issue on GitHub if appropriate, but figured I would ask here first.
You need update cryptography with:
pip2 install -U cryptography
and maybe pyOpenSSL:
pip2 install -U pyOpenSSL
You can use one command to check all requirements:
pip2 install -U certbot

Buildozer - requirement pysftp

I'm able to use pysftp on kivy, but I can't package my app using this requirement. Using buildozer, in the message says I'm using pip 8.1.1 and there is another version, 8.1.2. But I checked my version and my one already is 8.1.2. And, of course, I can install pysftp using pip install pysftp. My log file is this:
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Programa de gerenciamento de pacotes Debian 'dpkg' versão 1.17.5 (amd64).
Isto é software livre; veja a GNU General Public License versão 2 ou
posterior para condições de cópia. Não existe NENHUMA garantia.
# Search for Git (git)
# -> found at /usr/bin/git
# Search for Cython (cython)
# -> found at /usr/local/bin/cython
# Search for Java compiler (javac)
# -> found at /usr/lib/jvm/java-7-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
# -> found at /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/keytool
# Install platform
# Apache ANT found at /home/awulll/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/awulll/.buildozer/android/platform/android-sdk-20
# Android NDK found at /home/awulll/.buildozer/android/platform/android-ndk-r9c
# Check application requirements
# Run './distribute.sh -l'
# Cwd /home/awulll/dapapp/.buildozer/android/platform/python-for-android
Available modules: android apsw audiostream bidi boost cherrypy c_igraph click cprotobuf cymunk django docutils ecdsa enum34 evdev ffmpeg ffmpeg2 ffpyplayer ffpyplayer_tito flask freetype gevent greenlet harfbuzz hostpython igraph itsdangerous jinja2 jpeg kivent_core kivent_cymunk kivy leveldb libevent libpq libsodium libswift libtorrent libxml2 libxslt libyaml lxml m2crypto markupsafe midistream msgpack mysql_connector netifaces numpy opencv openssl paramiko pil plyer plyvel png polygon protobuf psutil psycopg2 pyasn1 pycrypto pygame pyjnius pylibpd pyopenssl pyparsing pyqrcode python pyyaml sdl setuptools six sqlalchemy sqlite3 storm swift thrift twisted txws werkzeug wokkel zeroconf zope
# Remove directory and subdirectory /home/awulll/dapapp/.buildozer/applibs
# Create directory /home/awulll/dapapp/.buildozer/applibs
# Run 'bash -c "source venv/bin/activate && env"'
# Cwd /home/awulll/dapapp/.buildozer
XDG_VTNR=8
XDG_SESSION_ID=c1
SSH_AGENT_PID=2191
GPG_AGENT_INFO=/run/user/1000/keyring-JXgOZD/gpg:0:1
VTE_VERSION=3409
SHELL=/bin/bash
TERM=xterm
XDG_SESSION_COOKIE=9cf5cdba17a429f4e3205d8a54ac9c66-1463226321.499664-1491359051
GJS_DEBUG_OUTPUT=stderr
WINDOWID=39845895
GNOME_KEYRING_CONTROL=/run/user/1000/keyring-JXgOZD
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
USER=awulll
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
SSH_AUTH_SOCK=/run/user/1000/keyring-JXgOZD/ssh
SESSION_MANAGER=local/awulll-mint:#/tmp/.ICE-unix/2054,unix/awulll-mint:/tmp/.ICE-unix/2054
USERNAME=awulll
DEFAULTS_PATH=/usr/share/gconf/default.default.path
VIRTUAL_ENV=/home/awulll/dapapp/.buildozer/venv
XDG_CONFIG_DIRS=/etc/xdg/xdg-default:/etc/xdg
PATH=/home/awulll/dapapp/.buildozer/venv/bin:/home/awulll/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/awulll/bin:/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin://usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
DESKTOP_SESSION=default
ANDROIDAPI=19
GDM_XSERVER_LOCATION=local
PWD=/home/awulll/dapapp/.buildozer
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
LANG=pt_BR.UTF-8
GNOME_KEYRING_PID=1978
MANDATORY_PATH=/usr/share/gconf/default.mandatory.path
ANDROIDNDK=/home/awulll/.buildozer/android/platform/android-ndk-r9c
PS1=(venv)
MDM_XSERVER_LOCATION=local
GDMSESSION=default
PACKAGES_PATH=/home/awulll/.buildozer/android/packages
CINNAMON_VERSION=2.4.8
HOME=/home/awulll
SHLVL=2
XDG_SEAT=seat0
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
XDG_SESSION_DESKTOP=default
ANDROIDSDK=/home/awulll/.buildozer/android/platform/android-sdk-20
LOGNAME=awulll
XDG_DATA_DIRS=/usr/share/default:/usr/share/gnome:/usr/local/share/:/usr/share/:/usr/share/mdm/
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-fdxlKZ9y2o,guid=226dcf0498f8da9740aa1f9157370fd2
MDMSESSION=default
ANDROIDNDKVER=r9c
WINDOWPATH=8
TEXTDOMAIN=im-config
DISPLAY=:0
XDG_RUNTIME_DIR=/run/user/1000
MDM_LANG=pt_BR.UTF-8
XDG_CURRENT_DESKTOP=X-Cinnamon
TEXTDOMAINDIR=/usr/share/locale/
XAUTHORITY=/home/awulll/.Xauthority
COLORTERM=gnome-terminal
_=/usr/bin/env
# Install distribute
# Run 'curl http://python-distribute.org/distribute_setup.py | venv/bin/python'
# Cwd /home/awulll/dapapp/.buildozer
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
# Install requirement datetime in virtualenv
# Run 'pip install --target=/home/awulll/dapapp/.buildozer/applibs datetime'
# Cwd /home/awulll/dapapp/.buildozer
Collecting datetime
/home/awulll/dapapp/.buildozer/venv/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: 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. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/home/awulll/dapapp/.buildozer/venv/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting zope.interface (from datetime)
Collecting pytz (from datetime)
Using cached pytz-2016.4-py2.py3-none-any.whl
Collecting setuptools (from zope.interface->datetime)
Using cached setuptools-21.0.0-py2.py3-none-any.whl
Installing collected packages: setuptools, zope.interface, pytz, datetime
Successfully installed datetime pytz setuptools-20.9.0 zope.interface
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
# Install distribute
# Run 'curl http://python-distribute.org/distribute_setup.py | venv/bin/python'
# Cwd /home/awulll/dapapp/.buildozer
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
# Install requirement pysftp in virtualenv
# Run 'pip install --target=/home/awulll/dapapp/.buildozer/applibs pysftp'
# Cwd /home/awulll/dapapp/.buildozer
Collecting pysftp
/home/awulll/dapapp/.buildozer/venv/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: 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. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/home/awulll/dapapp/.buildozer/venv/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Using cached pysftp-0.2.8.tar.gz
Collecting paramiko>=1.7.7 (from pysftp)
Using cached paramiko-2.0.0-py2.py3-none-any.whl
Collecting pyasn1>=0.1.7 (from paramiko>=1.7.7->pysftp)
Using cached pyasn1-0.1.9-py2.py3-none-any.whl
Collecting cryptography>=1.1 (from paramiko>=1.7.7->pysftp)
Using cached cryptography-1.3.2.tar.gz
Collecting idna>=2.0 (from cryptography>=1.1->paramiko>=1.7.7->pysftp)
Using cached idna-2.1-py2.py3-none-any.whl
Collecting six>=1.4.1 (from cryptography>=1.1->paramiko>=1.7.7->pysftp)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting setuptools>=11.3 (from cryptography>=1.1->paramiko>=1.7.7->pysftp)
Using cached setuptools-21.0.0-py2.py3-none-any.whl
Collecting enum34 (from cryptography>=1.1->paramiko>=1.7.7->pysftp)
Using cached enum34-1.1.5-py2.py3-none-any.whl
Collecting ipaddress (from cryptography>=1.1->paramiko>=1.7.7->pysftp)
Using cached ipaddress-1.0.16-py27-none-any.whl
Collecting cffi>=1.4.1 (from cryptography>=1.1->paramiko>=1.7.7->pysftp)
Using cached cffi-1.6.0.tar.gz
Complete output from command python setup.py egg_info:
No working compiler found, or bogus compiler options
passed to the compiler from Python's distutils module.
See the error messages above.
(If they are about -mno-fused-madd and you are on OS/X 10.8,
see http://stackoverflow.com/questions/22313407/ .)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-eC7Zv8/cffi/
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
# Command failed: pip install --target=/home/awulll/dapapp/.buildozer/applibs pysftp
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
real 0m5.286s
user 0m3.188s
sys 0m0.357s
I already tried check the link suggested in th log, but it doesn't help me too.
It looks like one of the pysftp dependencies is pulling in cffi as a further dependency, which needs compilation and therefore can't be built by python-for-android without a recipe. p4a already has a cffi recipe so it will work - maybe the easiest option is to add a pysftp recipe.
You could also try getting the newest buildozer release and running buildozer android_new debug instead. Changes to dependency resolution might mean it work, but it also might not help - especially if buildozer itself is managing this part.

elastic beanstalk: incremental push git

When I would like to push incremental changes to the AWS Elastic Beanstalk solution I get the following:
$ git aws.push
Updating the AWS Elastic Beanstalk environment None...
Error: Failed to get the Amazon S3 bucket name
I've already added FULLS3Access to my AWS users policies.
I had a similar issue today and here are the steps I followed to investigate :-
I modified line no 133 at .git/AWSDevTools/aws/dev_tools.py to print the exception like
except Exception, e:
print e
* Please make sure of spaces as Python does not work in case of spaces.
I ran command git aws.push again
and here is the exception printed :-
BotoServerError: 403 Forbidden
{"Error":{"Code":"SignatureDoesNotMatch","Message":"Signature not yet current: 20150512T181122Z is still later than 20150512T181112Z (20150512T180612Z + 5 min.)","Type":"Sender"},"
The issue is because there was a time difference in server and machine I corrected it and it stated working fine.
Basically the Exception will helps to let you know exact root cause, It may be related to Secret key as well.
It may have something to do with the boto-library (related thread). If you are on ubuntu/debian try this:
Remove old version of boto
sudo apt-get remove python-boto
Install newer version
sudo apt-get install python-pip
sudo pip install -U boto
Other systems (e.g. Mac)
Via easy_install
sudo easy_install pip
pip install boto
Or simply build from source
git clone git://github.com/boto/boto.git
cd boto
python setup.py install
Had the same problem a moment ago.
Note:
I just noticed your environment is called none. Did you follow all instructions and executed eb config/eb init?
One more try:
Add export PATH=$PATH:<path to unzipped eb CLI package>/AWSDevTools/Linux/ to your path and execute AWSDevTools-RepositorySetup.sh maybe something is wrong with your repository setup (notice the none weirdness). Other possible solutions:
Doublecheck AWSCredentials (maybe you are using different Key IDs / Wrong CredentialsFile-format)
Old/mismatching versions of eb client & python (check with eb -v and python -v) (current client is this)
Use amazons policy validator to doublecheck if your AWS User is allowed to perform all actions
If all that doesn't help im out of options. Good luck.

Could not find any downloads that satisfy the requirement django-1.6.1

I am going through this tutorial on Django. I have Django installed outside of the virtualenv, but inside, I try to use the same version as the linked video. I use the command
pip install django--1.6.1
but get the following error message:
(skillshare)skillshare$ pip install django--1.6.1
Downloading/unpacking django-1.6.1
Could not find any downloads that satisfy the requirement django-1.6.1
Cleaning up...
No distributions at all found for django-1.6.1
Storing debug log for failure in /Users/NAThompson/.pip/pip.log
The log file reads:
Getting page https://pypi.python.org/simple/django--1.6.1/
Could not fetch URL https://pypi.python.org/simple/django--1.6.1/:
404 Client Error: Not Found
Will skip URL https://pypi.python.org/simple/django--1.6.1/ when looking for
download
links for django-1.6.1
Getting page https://pypi.python.org/simple/
URLs to search for versions for django-1.6.1:
* https://pypi.python.org/simple/django--1.6.1/
Getting page https://pypi.python.org/simple/django--1.6.1/
Could not fetch URL https://pypi.python.org/simple/django--1.6.1/:
404 Client Error: Not Found
How can this be fixed?
your command is wrong, that's right:
pip install django==1.6.1