Does pandas work on Openshift? - python-3.x

I am trying to get an application started on Openshift, using the Python cartridge 3.3. I've added my dependencies into the requirements.txt, but the application fail to load on pandas dependency. I've searched through the web and there's only one mention of issues related to pandas and numpy but cannot seem to help. I've attempted to install pandas via ssh and end up with the following message after a while
Installing collected packages: pandas
Running setup.py install for pandas
Connection to [app].rhcloud.com closed by remote host.
Connection to [app].rhcloud.com closed.
Has anyone already used pandas on Openshift? Is there potential issues due to C dependencies?
Thank you

I had the same problem. It seems that with OpenShift there's a problem compiling algos.cwhich is part of pandas.
By installing manually I was able to avoid OpenShift's closing of the connection:
See my answer to this similar question.

Related

Easiest way to install set of standard Python Modules in LINUX

I am setting up a server, and trying to run python code. Painfully installing python3.X; and just realized I have to install all standard/required python modules one-by-one.
Is there a way to easily install the latest set of standard python modules? I don't mean using a requirements.txt file.
Standard modules are : numpy, pandas, scipy, scilearn, requests etc... But I know there must be alot of useful python modules.
So, I tried googling and cannot seem to find a public way to easily install a whole list

publish packages in conda forge receive error 'MY PACKAGE requires pathlib, which is not installed'

This is quite strange as pathlib seems already built in python > 3.4, anyone got an idea what raises the error?
ps. Package is already in pypi, the recipe was created directly from grayskull.

Some AWS lambda functions stopped working with "No module named setuptools._distutils" error

I have an application with many serverless functions deployed to AWS lambda. These functions use Python 3.7 runtime environment. But yesterday after deploying some minor changes, few of these functions stopped working with the error.
[ERROR] Runtime.ImportModuleError: Unable to import module 'functions.graphql.lambda.user_balance': No module named 'setuptools._distutils'
The weird thing is that the functions which are throwing this error were not changed and other functions are working without any issues. No python module was added/removed.
Just to check if the code change has anything to do with this error, I tried deploying a previous version. But the error persists.
I used the serverless framework for deployment.
It looks like this is an issue that started happening for all Python users as of yesterday as the set up tools got updated, but PIP did not.
According to this GitHub issue there is a temporary workaround until this is actually fixed.
Setting environment variable SETUPTOOLS_USE_DISTUTILS=stdlib is a workaround, e.g.:
export SETUPTOOLS_USE_DISTUTILS=stdlib
pip3 install ....
My assumption would be that you could add this as an environment variable for the Lambda possibly through the serverless config?
This is the bug in setuptools https://github.com/pypa/setuptools/issues/2353. Follow the below temporary workaround.
Linux
export SETUPTOOLS_USE_DISTUTILS=stdlib
Windows
set SETUPTOOLS_USE_DISTUTILS=stdlib
After that, execute the pip command.
pip install XXXXX

Complete build package of "pdftotext" for deploying on AWS-Lambda with Python3.7

I am trying to deploy a small python 3.7 code which uses "pdftotext" on AWS-Lambda. I was able to run the code successfully on my local machine (Mac). Using virtual-environment as specified by AWS documentation, I created a deployment package of the code with pdftotext. However still I am getting module not found error in Lambda. If you have been able to create a complete build package for pdftotext with all its dependencies, can you share please. Thanks in advance.
Using virtual-environment as specified by AWS documentation, I created a deployment package of the code with pdftotext.
import pdftotext
Getting module not found error for pdftotext when testing in AWS-Lambda.
A bit late to the party on the answer to this question, but I asked a similar question here: Get pdftotext Python module running on Lambda
My problem was I was compiling the binary on Amazon Linux 1 when the Python 3.8 lambda runtime uses Amazon Linux 2 shared libraries.
Install the library on an Amazon Linux 2 EC2 instance or docker container, and the library will be usable in your lambda.
Posting this in case it helps someone that comes across this question.

unable to run flask app using another port

I am new to flask. After installing it in ubuntu-lts, I tried to change the port but was unable to run the flask app from another port as another user is using an existing port.
I get this error :
from flask import Flask, request
ImportError: No module named 'flask'
[INFO] Worker exiting (pid: 34455)
[INFO] Reason: Worker failed to boot.
Where is the mistake - installation or another problem? thank you.
My guess is that you are on wrong dev environment.
Ensure you are on right python version and Flask is installed for that version. Now, what I mean by this is, that, a normal pip install Flask would install Flask for python2.7, but you seem to have tagged python3 in the OP.
If you are intending to develop your Flask application on Python3, you might want to make a virtual environment using that will use Python3, then install flask inside that. Or else, you could tell Python to install Flask for python3 explicitly.
I agree that you might have installed Flask on your system, but I think the one you installed is for Python2 and you are trying to run the flask app in Python3 environment.
These are wild guesses as your question doesn't say exactly what environment setup you are on.

Resources