'certificate verify failed' when using PyFCM to send a Push Notification - python-2.7

I'm trying to send push notifications via PyFCM (via Firebase Cloud Messaging).
When I tried to do this initially, I got the SNIMMissingWarning telling me that the request to the Firebase server was insecure.
I upgraded packages to handle this, but now I'm stuck with a 'certificate_verify_failed' error.
I went through the PyFCM code and found that it was using the requests module to send a request to the server.
I know that this issue is related to not having the CA certificates for the Firebase server, but have no idea how to get these certificates and setup the requests module to use them.
Can someone help?

Found the problem, sharing it for the benefit of others,
Apart from installing requests[security], I needed to install libssl-dev via
sudo apt-get install libssl-dev
So the overall setup for this is, first install the development versions of ffi and ssl libraries:
sudo apt-get install libffi-dev libssl-dev
Then, install requests[security]
pip install requests[security]

Related

Can't apt-get install packages on pythonanywhere

I'm trying to deploy a django project to pythonanywhere. I'm using this package in my project:
https://github.com/algoo/preview-generator
In order for preview-generator to work it has the following requirements:
apt-get install zlib1g-dev libjpeg-dev python3-pythonmagick inkscape xvfb poppler-utils libfile-mimeinfo-perl qpdf libimage-exiftool-perl ufraw-batch ffmpeg
The Bash console in Pythonanywhere won't let me install packages as root. Is there any way for me to install these required packages on the pythonanywhere server?
I read that the best you can do is make a request to the pythonanywhere team to have the packages added in future versions. Is this still the case?

Cascade dependencies when add python packages to my app libraries

I'm trying to add python packages to my Choregraphe app because some packages that are installed by default with python 2.7 aren't in python embedded in Choregraphe.
I want to add urllib3 and certifi to my app to be able to sen HTTPS requests and verify SSL certificates.
So I added a lib folder to my app with the necessary packages, it works fine for urllib3 but to verify SSL certificates I got a cascade of dependencies so I don't manage to do what I want.
Does anyone know if there is a way to access manually the default python version accessible by my Robot so that I can send my request with these packages ?
Thanks in advance !
If you're running this on a Pepper with NAOqi 2.5, pip is installed on the robot; though you'll need to upgrade it:
pip install --user --upgrade pip
and then you can run
/home/nao/.local/bin/pip install --user urllib3 certifi
Then you don't need to package those files in your choregraphe package.
It won't work on the virtual robot (but then you can just add the real path of those libraries to sys.path), and it means you'll have to do this procedure yourself if you want to install your app on a new robot, which can be a hassle.

How to install tqdm on a linux server without internet access?

I am trying to install the python package tqdm on a linux server.
However, the said server has no internet access. Hence, I am unable to install it using pip. I am also unable to find the tqdm package in Debian's package index.
However, what I am able to do is scp files from my local machine to the server. My local has full internet and sudo access.
Any leads please?
Note: I have sudo access on the server.
You could install it with pip. Just use the available commandline options as follows:
pip --no-index --find-links /path/to/directory/with/egg tqdm
Documentation:
https://pip.pypa.io/en/stable/reference/pip_wheel/#no-index
https://pip.pypa.io/en/stable/reference/pip_wheel/#find-links

php56-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64 when installing phpmyadmin

I have successfully installed php70 and mysql. But when i am trying to install phpmyadmin by
$ sudo yum-config-manager --enable epel
And Then
$ sudo yum install -y phpMyAdmin
It gives me
--> Finished Dependency Resolution
Error: php70-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
Error: php56-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
Also after google sometimes i found a solution that try this
sudo yum install php70-mbstring
And i have tried this also, Still facing same error.
Any suggestion...?
I guess that you are following the Amazon tutorial to install phpMyAdmin ?
I had the same problem today and resolved it by uninstall PHP 7.0 with the yum command (the same given by Amazon with 'remove' instead of 'install' :
sudo yum remove httpd24 php70 mysql56-server php70-mysqlnd
and installed PHP 5.6 instead :
sudo yum install httpd24 php56 mysql56-server php56-mysqlnd
I don't know if this is a good solution, but it worked and I could install phpMyAdmin without dependencies problem. I hope it will help :)
In case you want to keep php7, I found a solution with AWS Amazon experts.
Just use :
sudo yum install -y php70-mbstring
I was having the same issue today. I had some success downloading phpmyadmin from phpmyadmin.net, and following their instructions. I did run into a different problem during the setup of phpmyadmin....
So, I punted on resolving this with the Amazon AMI for now, and chose to install the Bitnami LAMP AMI to get me going quicker. It comes with phpmyadmin configured.
NOTE: Bitnami's AMI is running PHP Version 5.6.29, so I would say it's valid to follow the previous post's advice and downgrade, unless your web application specifically needs PHP 7.0.

How to install Graphlab Create on Ubuntu?

When i am trying to install Graphlab Create, it's just retrying connections. I have healthy broadband wifi connection at my home (NO proxy).
Error: (graphlab)ankit#ankit21:~$ pip install graphlab-create==0.9.1
Collecting graphlab-create==0.9.1
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fd6a16ae850>, 'Connection to 192.168.16.253 timed out. (connect timeout=15)')': /simple/graphlab-create/
The proxy 192.168.16.253 is proxy of my college internet. But i have changed the setting in networks setting to automatic proxy. Others installs in terminal are working properly only this is having the problem.
You need your specific academic license key, but trying to install the older version automatically updates your install to 1.7.1. If you choose to copy your code from the installation instructions and you remove --upgrade, and change to 0.9.1 it will still not work.
pip install --no-cache-dir https://get.dato.com/GraphLab-Create/0.9.1/your_key/GraphLab-Create-License.tar.gz
You can obtain your key for the latest version when you register with GraphLab on the Dato website. The academic license is free for each user for one year.
On the official site (https://turi.com/download/install-graphlab-create.html?email=**YOU**%40gmail.com&key=**7C68-...-D3D7**) we have:
Registered email address: YOUR_ADDRESS
Product key: YOUR_PRODUCT_KEY
Installing with dependencies:
Install Anaconda
bash /path to download file/Anaconda2-4.0.0-Linux-x86_64.sh
Create conda environment
conda create -n gl-env python=2.7 anaconda=4.0.0
source activate gl-env
Ensure pip version >= 7
conda update pip
Install GraphLab Create
pip install --upgrade --no-cache-dir https://get.graphlab.com/GraphLab-Create/2.1/YOUR_ADDRESS/YOUR_PRODUCT_KEY/GraphLab-Create-License.tar.gz
Ensure installation of IPython and IPython Notebook
conda install ipython-notebook