Use pycurl without installation - python

I am working on a tkinter app and I would like to use the pycurl module in my project but without being installed on any host machine... Like a portable version into my package.
I didn't see any topic on the web speaking about it but still keeping hope to have a sort of workaround for it.
Thanks in advance.

You could create a binary file of your project using pyinstaller. It will bundle all the dependencies that are required by your application, users can just run the binary file without worrying about installing or setting up dependencies.

Related

Install additional python package to an app compiled with PyInstaller

I have an app that is already compiled thanks to PyInstaller with a limited amount of python packages. The app has been compiled with the --onefile option. I'd like to add the possibility to install any new package in the temporary environment at the launch of the app, but there is no pip (it doesn't matter that the package needs to be installed at each run, this is a very specific option of my app).
While the app was running, I tried to copy/paste manually a random package in the temporary _MEIXXXXX folder. That's quite a dirty way but it worked, I could use the python package.
Do you know if it's possible to do so in a better way ?

Python install location on OSX - trouble installing python modules

I'm having a problem installing python packages and I think it has to do with the fact that I apparently have 4 Python directories. I can download and install them without a problem using pip... but when trying to import them in an IDE they don't appear.
Any help would be appreciated and I should say that I'm a complete beginner.
That's a really tricky issue specific to OS X, and also hard to fix. The root cause is the fact the GUI apps and console apps do not share the same environment (with things like PATH and PYTHONPATH).
Read https://stackoverflow.com/a/588442/99834

How to properly deploy python webserver application with extension deps?

I developed my first webserver app in Python.
It's a but unusual, because it does not only depend on python modules (like tornado) but also on some proprietary C++ libs wrapped using SWIG.
And now it's time to deliver it (to Linux platform).
Due to dependency on C++ lib, just sending sources with requirements.txt does not seem enough. The only workaround would be to have exact Linux installation to ensure binary compatibility of the lib. But in this case there will be problems with LD_PATH etc.
Another option is to write setup.py to create sdist and then deploy it with pip install.
Unfortunately that would mean I have to kill all instances of the server before installing my package. The workaround would be to use virtualenv for each instance though.
But maybe I'm missing something much simpler?
If you need the package to be installed by some user the easiest way will be to write the setup.py - but no just with simple setup function like most of installers. If you look at some packages, they have very complicated setup.py scripts which builds many things and C extensions with installation scripts for many external dependences.
The LD_PATH problem you can solve like this. If your application have an entry-point like some script which you save in python's bin directory (or system /usr/bin) you override LD_PATH like export LD_PATH="/my/path:$LD_PATH".
If your package is system service, like some servers or daemons, you can write system package, for example debian package or rpm. Debian has a lot of scripts and mechanism to point out the dependencies with packages.
So, if you need some system libraries on the list you write it down in package source and debian will install them when you will be installing your package. For example your package have dependencies for SWIG and other DEV modules, and your C extension will be built properly.

Include a library in python application

I am trying to find a way to include a library in a Ubuntu/Python/PyGtk application even though It is not included in the stock python enviornment and I can't add it as a dependency in my setup.py file. The library is called pygal and does have a PIP package (No available .deb or ppa) but I was looking for a way to include it in my application. I would think I could just include the source .py files to the library but I am unsure of how to go about including it in my code. Pygal also requires the lxml python library. I can install it via pip on my machine and it works fine but didn't know if there was anyway to automate or include this in my .deb package's setup.py file. Any help or advice would be greatly appreciated.
I think this should work though I'm not sure.
You put the folder with the name pygal from the pygal egg in your application directory. You can take it from your python installation - it should have this path:
/usr/local/lib/python2.7/dist-packages/pygal-0.13.0-py2.7.egg/pygal
or if you use python 3.1
/usr/local/lib/python3.1/dist-packages/pygal-0.13.0-py3.1.egg/pygal
or download it from pipy.
You can use it like any python library:
from pygal import *
I've actually figured out how to package this as a *deb file that I can include in my future PPA (or possibly submit to the community) that will (hopefully) cleanly install the python package on the system. I found a great write up in the Debian wiki that actually doesn't seem cryptic to a newbie like myself, oddly enough.
http://wiki.debian.org/Python/Packaging#Example_1:_Python_extension

xcopy python deployment

I'm new to python and I'm writing my first program. I would like after I finish to be able to run the program from the source code on a windows or mac machine. My program has dependencies on 3rd party modules.
I read about virtualenv but I don't think it helps me because it says it's not relocatable and it's not cross-platform (see Making Environments Relocatable http://pypi.python.org/pypi/virtualenv).
The best scenario is to install the 3rd party modules locally in my project, aka xcopy installation.
I will be really surprised if python doesn't support this easily especially since it promotes simplicity and frictionless programming.
You can do what you want, you just have to make sure that the directory containing your third-party modules is on the python path.
There's no requirement to install modules system-wide.
Note, while packaging your whole app with py2exe may not be an option, you can use it to make a simple launcher environment. You make a script with imports your module/package/whatever and launches the main() entry-point. Package this with py2exe but keep your application code outside this, as python code or an egg. I do something similar where I read a .pth text file to learn what paths to add to the sys.path in order to import my application code.
Simply, that's generally not how python works. Modules are installed site-wide and used that way. Are you familiar with pip and/or easy_install? Those + pypi let you automatically install dependencies no matter what you need.
If you want to create a standalone executable typically you'd use py2exe, py2app or something like that. Then you would have no dependencies on python at all.
I also found about zc.buildout that can be used to include dependencies in an automatic way.

Categories