Is there any Portable IronPython Availabe? - python

I have developed an application where a small part of the solution is done in ironpython, but when I am migrating to production they (client) are not giving permission to install ironpython.
I am trying to get any portable version of IronPython. So that without installing I can run IronP` code.
Please Help.

There is no need to MSI-install IronPython on the clients you are deploying your application to.
Just XCOPY deploy your application as well as required portions of IronPython (e.g. by grabbing a current ZIP release or getting files from your local installation).
The required files will at least include
IronPython.dll,
Microsoft.Dynamic.dll,
Microsoft.Scripting.dll and
Microsoft.Scripting.Metadata.dll
from the correct Platforms-subfolder (e.g. Net45).
If the python standard library is used in your python code (or needs to be available to dynamically loaded code) the Lib-folder (or a subset) has to be included as well.
Should your application be deployed via MSI or a similar mechanism just include relevant IronPython files instead of XCOPYing.

Related

Transform a python file, that uses packages like pandas, to be usable by someone that has no python environment

I have a client for whom I have created a program that utilizes a variety of data and machine learning packages. The client would like for the program to be easily run without installing any type of python environment. Is this possible?
I am assuming the best bet would be to transform the .py file into a .exe file but am unsure of how to do this if I have packages that need to be installed before the program can be run.
Are there websites that exist that allow you to easily host complex .py files on them to be run by anyone that accesses the URL?
I think you are looking for "freezing", which package everything including the interpreter, libs and packages into a single executable file.
There are several tools for this purpose:
https://wiki.python.org/moin/Freeze
https://docs.python-guide.org/shipping/freezing/
I think the use of colaboratory that is cloud service provided by Google might be better. Your client who has to sign up for Google account can not only run the python program, but also utilize any major python packages on the cloud (of course, it's possible to install the necessary packages into the client's cloud space), without constructing the python environment on client's local PC. What's more, it's at free!

Implementing Python functionality in Android application

I have created one project which has machine learning and Signal processing functionality.
This project is running on server without any issue. My android device making API call to server and getting response.
I want this functionality to be run offline (Without Internet) without calling to remote API.
What are the possible way to run to Python functionality in the Android application?
Writing entire application in Java is not feasible because it depends on many python libraries like numpy, scipy, pandas, sklearn etc.
Maybe you can use Termux which is an Android terminal emulator and Linux environment app.
It comes with a package manager pkg which can be used to install Python.
pkg install python # or python2
It installs python and the pip package manager.
You can also find some useful information in wiki.python.org/moin/Android.
You can try Chaquopy, it allows intermixing of Python, Java and Kotlin. Furthermore it allows the use of cheeseshop (PyPi) packages such as the one you described.
You should be able to integrate your existing code with a Java application for Android.
https://chaquo.com/chaquopy/
It requires a commercial license if you don't want to opensource your code.
It is possible to use python for android project https://github.com/kivy/python-for-android. For rooted device or system app it is possible to launch python interpreter (compiled binaries) as a separate process with script as a parameter

Is there an easy way to distribute a Flask server as an executable?

I'm building some simple editors with Backbone.js, and I'm hoping to be able to distribute them as apps for users to edit content in a mostly client-side way (i.e., I don't want users to have to futz with setting up stuff like MySQL or Apache).
So I was imagining a scenario like:
User downloads a .zip file
In the resulting opened folder, the user clicks index.html
That opens in a browser
Backbone app starts, stores data in localStorage
The user can then export to CSV.
Believe it or not, that would solve my problem: I want to help users edit data in a browser and then get it back out in a familiar format (CSV can be loaded into Excel, for instance).
And I’d like to do this without forcing them to configure a server. It seems like this is almost possible in the HTML5 stack. However, in at least one browser (Chrome), this doesn't work, because I get errors like this one:
XMLHttpRequest cannot load file:///users/me/project/data/Appdata.json. Origin null is not allowed by Access-Control-Allow-Origin.
(Oddly enough, I don't get that error in Firefox, and the .js or .json files load fine.)
So at this point it seems to me that there's no way around having these users use something kind of local server to serve up the Backbone interface.
So, I'm trying to figure out how to build a distributable, cross-platform executable that will allow my users to start a Flask server. (I hope to build a REST backend to a Backbone.js app.)
Is this wishful thinking? I'm assuming I can get the people in question to install Python.
Is this doable? There seem to be many ways to package up Python programs, (pyinstaller? py2exe? ...) So I thought I would ask here in case someone might know of a solution for the stack I have in mind.
TIA!
You can use Anthony Gordon McMillan’s Pyinstaller or Tuininga’s cx_Freeze
Quoting the PyInstaller website:
Features
Packaging of Python programs into standard executables, that work on
computers without Python installed.
Multiplatform: works under
Windows (32-bit and 64-bit),
Linux (32-bit and 64-bit),
Mac OS X (32-bit only, 64-bit in git, see Features/MacOsCompatibility) and
experimentally Solaris and AIX (in git).
Multiversion: works under any version of Python from 2.2 up to 2.7.
My suggestion would be to create a thin service wrapper around your code. This will allow the server to run independently of your main codebase - also allowing the user to shut down the server directly (simply right clicking the service icon and selecting "Exit").
This SO answer should help you get started.
After reading your updated question, I think something like mongoose might be more suited to your task. It is an embeddable web server that is FLOSS and has python bindings. Flask might be overkill.
Not easily. On Windows, you'd have to include Python itself. Mac and Linux usually have Python installed, but you can't be sure of what version so it's often easier to bundle your specific Python for them as well. Then you'd have to include all the dependencies that you want to run with in your package or be able to install them with pip, easy_install, etc.
You can use py2app and py2exe. This won't be cross-platform as you'll still need to make a different version for each target OS. The only way to make it cross-platform is to bundle all versions and have some cross-platform code execute the appropriate version for that platform.
If you need databases like MySQL or even SQLite things get more complicated as you'll have to include those too.

Suitability of deploying python 2.7 apps using external (PyPi) packages in major hosts

I am writing a python program for processing files (no DJango involved). I need ZODB3 and Whoosh which are hosted on http://pypi.python.org. It needs to be deployed in a major host like Bluehost or Hostgator.
My questions are:
Can I depend on reliable Python 2.7 support from major hosts?
Can they support other packages (one host has a list of supported packages and tells us to contact tech support for more packages), especially if it is available from the easy_install interface?
Is it a pain to set up?
Will my choice of ZODB (object persistence library, part of ZOPE) cause problems?
It seems a dumb question, but it can probably save weeks of my time.
Some relevant details:
Its only for file processing, no DJango required. ZODB is for object persistence. I dont need to back up the ZODB store as it can be readily reconstructed.
No you cannot depend on any kind of Python support from any hoster or any operating system. Build your own portable Python distro and include all the 3rd party modules that you will need. Then you have one tarball to install on any Linux VM and everything just works. You also avoid breaking OS tools that depend on Python such as Webmin because you have your own separate Python and never touch the system default one.
Compiling Python 2.6.6 and need for external packages wxPython, setuptools, etc... in Ubuntu

Distributing a stand-alone Python web-based application to non-technical users

I'm writing a web application in Python, intended for use by teachers and pupils in a classroom. It'll run from a hosted website, but I also want people to be able to download a self-contained application they can install locally if they want more performance or they simply won't have an Internet connection available in the classroom.
The users aren't going to be able to manage instructions like "first install Python, then install dependencies, download the .tar.gz archive and type these commands into the command line...". I need to be able to create an all-in-one type installer that can potentially install Python, dependencies (Python-LDAP), some Python code, and register a Python-based web server as a Windows Service.
I've had a look through previous questions, but none quite seem relevant. I'm not concerned about the security of source code (my application will be open source, I'll sell content to go with it), I just need non-technical Windows users to be able to download and use my application with no fuss.
My current thoughts are to use NSIS to create an installer that includes Python and Python-LDAP as MSIs, then registers my own simple Python-based web server as a Windows service and puts a shortcut in the start menu / on the desktop linking to http://localhost. Is this doable with NSIS - can NSIS check for currently installed copies of Python, for instance? Is there a better way of doing this - is there a handy framework available that lets me shove my code in a folder and bundle it up to make an installer?
Using NSIS is great (i use it too) but i would suggest using a "packager" like pyinstaller (my personal fav, alternatives bb_freeze, py2exe) to create an exe before the using NSIS
The primary benefit you get by doing this is;
Your download is smaller as you're not bundling the whole Python Standard Lib and extra stuff your app wont need and you get an exe file to boot!
You can try the Bitnami Stack for Django that includes Apache, MySQL,Python, etc in an all-in-one installer. It is free/open source

Categories