Hi there I was recently developing an application on openshift.
I used the Python 3.3 Cartridge together with Django. And there is the problem. Because of the "old" version of python I get some exceptions. (Which is indeed a problem with the python version, because i tested it with python 3.3.2 on my local computer.)
My question is know is it possible to make an custom cartridge with pyhton 3.4? Or even update the existing python cartridge?
If yes, how does it work?
It might be possible to create a custom cartridge that has python 3.4. You would need to ssh into a gear on OpenShift Online (or use a compatible local RHEL or CentOS installation) to compile python 3.4 and it's dependencies, then you can use the Cartridge Developers Guide (https://docs.openshift.org/origin-m4/oo_cartridge_developers_guide.html) to create a cartridge that you can install it with.
You can also add it as a request at https://openshift.uservoice.com and get other users to vote on it.
Related
The review apps are running on the latest python version 3.9.4 and that seems to break the installation of pandas. I'm currently using review apps to review PRs. I have set the runtime to use python version 3.8.6 but that only works for the app in production. Is there any way to set the python version for review apps?
Seems setting a python runtime fixes it(make sure to update the branch before trying to check unlike me).
I have a project with Python 3.5.4, but I want to use a Python library called pyghmi, but the library only supports the Python 2.x.
How can I solve this issue?
The project was updated for python3 and is tested with python 3.5, though I will confess the vast majority of users are using python 2.7 at the moment. The building of rpms, however, has not yet been tested for python3 (so far system python of centos 6 and centos7 has been the rpm environment).
I would be interested to know the issue you are hitting.
Could you please let me know the best way to upgrade python on linux? I need it because my redhat linux machine is offering 2.6.6 version as default. If I install python 2.7 then it breaks yum and mod_wsgi. Has anyone found out the best way to do it? I really need this for flask web development.
I had tried https://danieleriksson.net/2017/02/08/how-to-install-latest-python-on-centos/ steps but it caused issues with mod_wsgi (which was on 2.6).
Just to add - I have read and tried almost everything related to this topic but couldn't succeed. Hence I am asking this question if someone has already figured out a way for this.
In addition to what SpliFF said, you can create a virtual environment and set which python version you would like to use by using the -p flag.
You can install multiple versions of python side-by-side. What makes one "default" is the python and python2 symlinks in /usr/bin.
However you should definitely not change the default python on Redhat for the reasons you list and more.
Instead, you will need to tell WSGI which python to use. This question covers that: Run mod_wsgi with virtualenv or Python with version different that system default
Also, according to this answer ( Deploying Python Flask App on Apache with Python version installed in Virtual Environment Only ) you may need to compile a custom wsgi against the python version you want to use.
For RedHat based operating systems, use SCL versions of Python.
https://www.softwarecollections.org/en/
They are installed in separate area so they do not conflict.
There is no mod_wsgi in SCL, so use pip method to install it and then link Apache to it. Details in:
https://pypi.python.org/pypi/mod_wsgi
I am going through a tutorial on building a website with django. It suggests using mod_python but I have heard to stay away from that and use wsgi instead. Problem is I am running python 3.3 (and apache 2.4.2 for that matter, everything seems to be compatible with apache 2.2). Is there any way to get all of this working on 3.3? Or is my best bet to go back to python 2.7? Thanks.
Edit: I am on Windows, so that seems to be another roadblock.
You could use nginx + uwsgi to depoly your django site instead of Apache+mod_wsgi. Here's a tutorial.
As many tutorials is about how to configure the environment in Unix-like environment, you could use cgywin to simulate a Unix-like environment on Windows.
The version of Python you use is not much critical when you develop a site using Django except that you have to use some libraries that don't support Python-3.x.
It will be hard, between python2 and python3 there is a lot of incompatibility, and somehow the developers of the most python frameworks somehow won't understand, why they should port their software to the newer version of the language.
The simplest way if you use python 2.
The best way were to start an independent, python 3 fork of your most loved python framework.
EDIT: newer django supports python3, thus it should work.
On my development system, I have Python 2.6, Django 1.1 and GAE.
I have three projects running on Python 2.6 and Django 1.1.
I have 1 project using GAE, Python 2.6 and Django 1.1.
I have heard that my set-up for running GAE using Python 2.6 may create some head-scratching problems while deploying it on the production server, because GAE supports only Python 2.5, and using 2.6 is not recommended.
Can I develop GAE application using Python 2.6? If not, what should I do? I am using Windows Vista as my development system.
Please note : I don't want to disturb my other projects in development, which uses Python 2.6 and Django 1.1.
Use virtualenv to isolate your development environments, so you can have one running 2.5 and the others running 2.6.
Edited to add: once 2.5 is installed, you can initialize your virtualenv to use it with the -p option:
virtualenv -p /path/to/python2.5/python.exe destination_dir
Unless you are using python 2.6 specific syntax/code your application is safe to run on GAE.
Re virtualenv question above: virtualenv have a parameter
--python=PYTHON_EXE that you can point to the interpreter you'd like
it to use. Running virtualenv without parameters or with an --help
option whill show you which options you may pass it.