Install extra packages in Flatpak sandbox - flatpak

There are some Flatpak apps that have optional dependencies that are not bundled with the app. E.g the plotting package Veusz is available as a Flatpak and it can optionally use the Python package h5py to open HDF5 files. But h5py is not bundled with the Flatpak version. I saw a flatpak command flatpak enter that the documentation says allows us to
Enter the flatpak sandbox.
So I started the Veusz flatpak app and used flatpak ps to get its PID. Then I tried sudo flatpak enter PID pip3 install h5py but it installed h5py in my host operating system!
TLDR; Is it possible to install custom packages (not just Python packages) in a Flatpak application's sandbox? If yes, how shall I do it?

In general, you need to add an extension point and create a new package.
For example, add an extension point for the directory you need to add files (here lib/GL):
[Extension org.gnome.Platform.GL]
version=1.4
directory=lib/GL
and make a new flatpak package with the files to add (here org.gnome.Platform.GL).
In this case though, there may be some sort of issue. Looking at the metadata file for the Veusz flatpak here, they seem to be including hdf5 and h5py already. If you're missing this functionality you probably want to raise an issue in the repo.

Related

How to create a RPM which install python dependencies?

I have a python application that has flask dependency.
All I need is to create an RPM out of this application and with this RPM I should be able to install the dependencies to another machine.
Things I have tried,
Created a setup.py file,
setup(
name='sample-package',
version='1.0.0.0',
author="Niranj Rajasekaran",
author_email="nrajasekaran#test.com",
package_dir={'': 'src/py'},
namespace_packages=['main'],
packages=find_packages('src/py/'),
install_requires=['Flask']
)
Ran this command
python setup.py bdist_rpm
Got two RPMs in dist/, one is noarch and other is src
I tried to install noarch rpm using this
yum install {generated-file}.rpm
I am able to get sample-package-1.0.0.0.egg file in site-packages but not flask.
Two questions,
Is my approach correct?
If so what is something that I am missing?
bdist_rpm lacks of a lot of functionality and IMO is not very well maintained. E.g. pyp2rpm is much better for converting existing PyPI modules. But your module does not seem to be on PyPI, so you need to specify it to bdist_rpm manually because it cannot retrieve this information from setup.py.
Run:
python setup.py bdist_rpm --requires python-flask
This will produce an rpm file which requires the python-flask package. For more recent RHEL/Fedora it would be python3-flask.

Where do you install django-registration-redux module?

I have my own project called "polling". I am looking to install the django-registration-redux submodule to create the log-in process. Where should I same the Django-registration-redux module? Another way to ask this is what does the directory structure look like?
Should I save it within the polling directory? or on the same level as polling because it is a separate project that I'm importing?
From the docs:
Automatic installation via a package manager
Several automatic package-installation tools are available for Python; the recommended one is pip.
Using pip, type:
pip install django-registration-redux
Manual installation from a downloaded package
If you prefer not to use an automated package installer, you can download a copy of django-registration-redux and install it manually... From a command line in that directory, type:
python setup.py install
Bottom line, just run the setup installation process and it will "install" it to the right place.

offline install for py2neo in ubuntu

I downloaded the .zip from the py2neo github and placed in the site-packages folder and ran
pip install py2neo
Everything looks like it's in the right place (I compared to windows setup and they both contain the same files in the same places) but when I run a .py I get:
ImportError: No module named batch *
It sounds like your paths aren't setup correctly. To install, I would recommend simply running the pip install py2neo line without first downloading the zip and allowing pip to pull py2neo from PyPI. Alternatively, if you are trying to avoid using a network connection from your server, run python setup.py install from within a copy of the GitHub repository.
Note: You will want to checkout the latest release branch from the GitHub repository before installing. At the time of writing, this is named release/1.6.4.

Is it possible to install a django package without pip?

I am trying to install django-dash to run one of the dashboard examples and see what it's like.
I am on Windows running Python 2.7 and Django 1.6.5. I know the usual approach is to download pip then install the package using pip. However, I am on a work computer with no administrative rights so I can't access my Internet Option Settings to find my proxy URL to follow the instructions below:
Proxy problems
If you work in an office, you might be behind a HTTP proxy. If so, set the environment variables http_proxy and https_proxy. Most Python applications (and other free software) respect these. Example syntax:
http://proxy_url:port
http://username:password#proxy_url:port
I had the same issue when trying to install Django but was able to get it to work by moving the django directory under Python27/Lib/site-packages. Is there something similar I can do with django-dash?
I also tried downloading the sources and running python setup.py install. I received the following error:
File "setup.py", line 3, in <module> from setuptools import setup, find_packages ImportError: No module named setuptools
Link to django-dash: http://django-dash.readthedocs.org/en/latest/
Yes, you can probably get the sources from The Python Package Index
Once you have them, uncompress the files and install them manually (this will depend on you OS).
On Linux systems:
python setup.py build
python setup.py install
Here's the full reference
EDIT : Note that when manually installing those packages, you must also install any missing dependencies, eg. setuptools in your case

Installing EWSWrapper?

How to install ewswrapper for python off of their site on a windows, (sadly), 64 bit machine with python 2.7.
The Link to the site is here.
Thank you for your help.
The generally recommended way to install python packages is using a package manager like pip or (gasp) easy_install. However, there are a few exceptions like this one.
On Windows, there may be a pre-built package for you to download. In this case, the link is http://ewswrapper.lafiel.net/index.php?al3x_download=file&userid=PUBLIC&filepath=/PYTHON_Releases/_PYTHON_2012_02_09_EWSWrapper_v_0_2.7z.
You'll need to unzip the file with 7zip, and place the resulting directory in your site-packages path. You can locate your system's site-packages path by looking at this SO answer: How do I find the location of my Python site-packages directory?
Additionally, EWSWrapper will require a few dependencies that you should be able to get in pip.
pip.exe install python-ntlm suds
If you don't have pip, you can install it: How do I install pip on Windows?
Just so you know, this isn't the normal way a package is installed. Perhaps someone should let them know...