Using PIP to install Pillow in a Flatpak - python

I've added a new function to a Python program which works when I run the program on my PC, but it isn't working in my Flatpak. I assumed that it was probably because the Pillow version on my PC (8.3.2) is rather more recent than that in the Flatpak manifest (5.4.1). The problem is that I can't get the Flatpak to build with the later version. I'm no expert on PIP or Flatpaks. Relevant part of manifest:
- name: python3-pillow
buildsystem: simple
build-commands:
- pip3 install --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} Pillow
sources:
- type: file
# url: https://files.pythonhosted.org/packages/3c/7e/443be24431324bd34d22dd9d11cc845d995bcd3b500676bcf23142756975/Pillow-5.4.1.tar.gz
# sha256: 5233664eadfa342c639b9b9977190d64ad7aca4edc51a966394d7e08e7f38a9f
# try later version of pillow
url: https://github.com/python-pillow/Pillow/archive/refs/tags/8.3.2.tar.gz
sha256: 8252b6b514aed2743abb5b7259b3253d6c4bf86902b9c5acd33fe79d24ec7b2f
Relevant part of Flatpak building output:
=======================================================================
Building module python3-pillow in /home/me/.flatpak-builder/build/python3-pillow-8
========================================================================
Running: pip3 install --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} Pillow
Looking in links: file:///run/build/python3-pillow
ERROR: Could not find a version that satisfies the requirement Pillow (from versions: none)
ERROR: No matching distribution found for Pillow
Error: module python3-pillow: Child process exited with code 1
END ================================================================================================
It looks as though it fails to download the tarball, but if I put the address into a browser, it downloads.

The problem is that pip is searching for a file in $PWD (/run/build/python3-pillow/) and it can't find a file that matches your system and your python version. So eather you didn't download any thing due to an error in the manifest file or you are downlaoding the wrong file.
I can't find any errors in the manifest, at least on the part that you posted.
Have you tried to use a wheel file rather then a tar.gz archive?
A list of them for the latest pillow version are here.
I don't know what runtime you are using for flatpak but the (org.freedesktop.Sdk-21.08) runtime has python v3.9.9 and i can assume that your app is for x86_64 so i think that Pillow-9.2.0-cp39-cp39-manylinux_2_28_x86_64.whl should work with you.

Answer here: Python Forum
Blah, blah.

Related

How do I fix the ERROR: Could not find a version that satisfies the requirement for uncompyle6-3.7.4-py3.8?

I have downloaded the uncompyle6-3.7.4-py3.8 egg file from pypi.org website in order to decompile a .pyc file. When I am trying to install it using the pip command in command prompt pip install uncompyle6-3.7.4-py3.8, I get the following error:
ERROR: Could not find a version that satisfies the requirement uncompyle6-3.7.4-py3.8 (from versions: none)
ERROR: No matching distribution found for uncompyle6-3.7.4-py3.8
I am using the latest version of Python (3.8). I tried to download another uncompyle file for the earlier 3.7 version, but even then I get the same error. I have also upgraded pip to its latest version. On their website it is mentioned that for Python 3.7 and above, the code in decompyle3 is generally better, yet I get the same error for pycdc.
How could I fix this error? Thank you!
You can install .whl files with pip, not .egg. In order to install .egg file you need easy_install.
Try this command:
python -m easy_install https://files.pythonhosted.org/packages/ef/91/07f46d34bf8d3bf385785b98b13ebddaa414638f553d9b33c8aa320f45cd/uncompyle6-3.7.4-py3.8.egg

missing packages in mobaxterm apt-get session

When attempting to install Python in MobaXterm, two packages are not found in the local repository. I have found at least one of them in an external repository and I would like to configure my terminal to use another repository beside the one indicated in the example directory tree as follows:
http://mirrors.kernel.org/sourceware/cygwin/release/cygwin-devel
Either that or I would like to change the package version to one that exists in this location, but then I worry about package versioning issues.
Or a third option would be to download the packages I find in the other locations and install them using the same terminal I used to install the other Python packages.
Here are the two packages with issues:
Installing cygwin-devel
Downloading cygwin-devel-2.7.0-1.tar.xz...
Downloading /home/mobaxterm/.aptcyg/http%3a%2f%2fmirrors.kernel.org%2fsourceware%2fcygwin/release/cygwin-devel/cygwin-devel-2.7.0-1.tar.xz using Windows internet settings
sha512sum: can't open 'cygwin-devel-2.7.0-1.tar.xz': No such file or directory
/bin/apt-cyg: line 476: test: 8f382e85417a4efa951607776be66cf91381e4075bcc4458da40141951305675faff4890bd2723de91483725c5d5bd726128355a2de41a0c743428b2829fe48c: unary operator expected
md5sum: can't open 'cygwin-devel-2.7.0-1.tar.xz': No such file or directory
/bin/apt-cyg: line 479: test: 8f382e85417a4efa951607776be66cf91381e4075bcc4458da40141951305675faff4890bd2723de91483725c5d5bd726128355a2de41a0c743428b2829fe48c: unary operator expected
Checksum did not match, exiting
Installing libexpat1
Downloading libexpat1-2.2.0-0.tar.xz...
Downloading /home/mobaxterm/.aptcyg/http%3a%2f%2fmirrors.kernel.org%2fsourceware%2fcygwin/release/libexpat1/libexpat1-2.2.0-0.tar.xz using Windows internet settings
sha512sum: can't open 'libexpat1-2.2.0-0.tar.xz': No such file or directory
/bin/apt-cyg: line 476: test: a39f95f129fc7abe1e22f71925844dac0160f7c536f01bb8e5cc1f9b23f19266dd95e633a4e44d6b4ad792aa25c2a69b473dd06400ef4e7dab02e88877020455: unary operator expected
md5sum: can't open 'libexpat1-2.2.0-0.tar.xz': No such file or directory
/bin/apt-cyg: line 479: test: a39f95f129fc7abe1e22f71925844dac0160f7c536f01bb8e5cc1f9b23f19266dd95e633a4e44d6b4ad792aa25c2a69b473dd06400ef4e7dab02e88877020455: unary operator expected
Checksum did not match, exiting
Thanks in advance for any insights that might lead me to resolve this and have a clean Python installation.
I found a workaround - hopefully. In essence, the setup.ini file on the repository references a version of the packages that actually does not exist on that repository. After reading up on apt-get I learned that I could pass a legacy flag to get an earlier version of the package installed:
[micro.MSI] ➤ apt-get install --legacy libexpat1
Found package libexpat1
Installing libexpat1
Downloading libexpat1-2.2.0-0.tar.xz...
Unpacking libexpat1-2.2.0-0.tar.xz...
Extracting dependencies for usr/bin/cygexpat-1.dll...
Package libexpat1 requires the following packages, installing cygwin
Package cygwin is already installed, skipping
Package libexpat1 installed.
Rebasing new libraries
This might introduce versioning issues, but the dependency was already there, as it should be since it was installed in the earlier python installation. Now I can see if I can get the other modules installed for my project.
If anyone else has advice about this package management issue, please chime in. I am wondering if I should notify the source repository owners about their setup.ini file pointing to versions that do not exist.

Syntax error when trying to import Cntlr from arelle module

My goal is to use Arelle (open-source platform for XBRL community) to parse XBRL docs from the SEC.
I am following instructions found here.
I successfully git cloned Arelle's code into the Lib directory of Anaconda. However, when I try from arelle import Cntlr I get the following syntax error.
File "arelle\Cntlr.py", line 573
print(logEntry, file=file)
^
SyntaxError: invalid syntax
I am using Python 2.7.12. in Anaconda.
Any feedback is appreciated and I can provide further information upon request.
The instructions you found are rather old (from 2014), and appear to be outdated.
I was able to install the package with the following steps:
# This is needed because the 3to2 library can't be installed as an egg; if
# you don't install it with `pip` first the installation of Arelle will fail.
$ pip install 3to2
# Install Arelle directly from GitHub, this will take a while
$ pip install git+https://github.com/Arelle/Arelle
With 3to2 installed, the installation script setup.py proceeds to translate the Arelle sourcecode back to a Python 2 compatible form. Translation takes several minutes, be patient.

.whl is not a valid wheel filename, storing debug log for failure in C:\

I am having trouble installing a wheel file via pip.
I open my command prompt
write the following in the prompt
C:/Python34/Scripts/pip install C:/Users/Hamsa/Downloads/pygame.whl
Then I get this message
pygame.whl is not a valid wheel filename. Storing debug log for failure in C:\Users\Hamsa\pip\pip.log
I don't what to do and I need your help.
You should correct name format for installing wheel file. Because wheel file name also includes many information such as the version of program, supported python version. Your command should be like the command below.
pip install pygame‑1.9.3‑cp34‑cp34m‑win_amd64.whl
If the answer suggested by #Harun doesnot work, try
python -m pip install <whl file name with complete path>.whl
If u have more than 1 Python versions installed , check which version of python is being used to install the package using:
python -v
Also refer to pygame readme for an official installation guide.

Python Selenium noarch RPM build failure

Attempting to build Python Selenium noarch rpm from downloaded selenium-2.20.0.tar.gz
All necessary Python requirements are installed and working, using command:
python setup.py bdist --format=rpm
RPMBuild fails with error message:
Arch dependent binaries in noarch package
error: command 'rpmbuild' failed with exit status 1
Have tried following the suggestion of adding an additiional %define to the selenium.SPEC file, found under build/bdist.linux-i686/rpm/SPECS/selenium.spec
%define _binaries_in_noarch_packages_terminate_build 0
Unfortunately when i re-run the RPM build, the change is not picked up and the contents of the SPEC file after the build seem to have re-verted as the newly added %define is no longer present?!
Any suggestions welcome please..
Changes to selenium.spec weren't persisting as the spec file is automatically generated from content mostly from within setup.py
Two solutions were found:
1) Download most recent version of selenium-2.20.0.tar.gz from http://pypi.python.org/pypi/selenium/ to target machine, tar extract and run:
python setup.py install
2) Install python pip, then use pip to dowload and install the latest selenium in an automated fashion with the command:
pip install -U selenium
As yet i have not found the exact content that can be added to setup.py that will add the necessary RPM build define to the selenium.spec file for creating an installation RPM..
For the future if anyone comes across this
python setup.py bdist_rpm --force-arch x86_64
Worked for me

Categories