AppImageCommunity / pkg2appimage

Tool and recipes to convert existing deb packages to AppImage
http://appimage.org
MIT License
692 stars 213 forks source link

Do you know how to create an AppImage for a pip package? #149

Open fusion809 opened 7 years ago

fusion809 commented 7 years ago

Hi,

I'd like to know if you have any ideas as to how to create an AppImage for a python pip package. There are a few pip packages I am interested in turning into an AppImage, such as:

Any ideas as to how to do this? I have tried running # pip install --install-option="--prefix=/AppDir/usr" --ignore-installed spyder from within a CentOS 7 Docker container but it installed Spyder in the /usr directory not in /AppDir.

Thanks for your time, Brenton

probonopd commented 7 years ago

Hi Brenton, please check out https://docs.python.org/3/library/venv.html

fusion809 commented 7 years ago

For some reason Spyder's pip install is failing in this virtual environment:

Downloading/unpacking spyder
  Running setup.py egg_info for package spyder
    WARNING: unable to build documentation because Sphinx is not installed

    warning: no files found matching '*.svg' under directory 'spyder_breakpoints'
    warning: no files found matching '*.png' under directory 'spyder_breakpoints'
    warning: no files found matching '*.svg' under directory 'spyder_profiler'
    warning: no files found matching '*.svg' under directory 'spyder_pylint'
    warning: no files found matching '*.' under directory 'doc'
    warning: no files found matching 'CHANGELOG'
Downloading/unpacking rope>=0.9.4 (from spyder)
  Running setup.py egg_info for package rope

Downloading/unpacking jedi (from spyder)
  Running setup.py egg_info for package jedi

    warning: no previously-included files matching '*.pyc' found under directory '*'
Downloading/unpacking pyflakes (from spyder)
  Running setup.py egg_info for package pyflakes

Downloading/unpacking pygments>=2.0 (from spyder)
  Running setup.py egg_info for package pygments

Downloading/unpacking qtconsole>=4.2.0 (from spyder)
  Running setup.py egg_info for package qtconsole

Downloading/unpacking nbconvert (from spyder)
  Running setup.py egg_info for package nbconvert

Downloading/unpacking sphinx (from spyder)
  Running setup.py egg_info for package sphinx

    warning: no files found matching 'TODO'
    warning: no files found matching 'ez_setup.py'
    no previously-included directories found matching 'doc/_build'
Downloading/unpacking pep8 (from spyder)
  Running setup.py egg_info for package pep8

    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
    warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
    no previously-included directories found matching 'docs/_build'
Downloading/unpacking pylint (from spyder)
  Running setup.py egg_info for package pylint

    warning: no files found matching 'README'
    warning: no files found matching 'README.Python3'
    warning: no files found matching '*.html' under directory 'doc'
Downloading/unpacking psutil (from spyder)
  Running setup.py egg_info for package psutil

    warning: no previously-included files matching '*' found under directory 'docs/_build'
Downloading/unpacking qtawesome (from spyder)
  Running setup.py egg_info for package qtawesome

Downloading/unpacking qtpy>=1.1.0 (from spyder)
  Downloading QtPy-1.1.2.tar.gz
  Running setup.py egg_info for package qtpy

Downloading/unpacking pickleshare (from spyder)
  Downloading pickleshare-0.7.4.tar.gz
  Running setup.py egg_info for package pickleshare

Downloading/unpacking pyzmq (from spyder)
  Running setup.py egg_info for package pyzmq

    warning: no files found matching 'tox.ini'
    no previously-included directories found matching 'docs/build'
    no previously-included directories found matching 'docs/gh-pages'
    warning: no previously-included files found matching 'bundled/zeromq/src/Makefile*'
    warning: no previously-included files found matching 'bundled/zeromq/src/platform.hpp'
    warning: no previously-included files found matching 'setup.cfg'
    warning: no previously-included files found matching 'zmq/libzmq*'
    warning: no previously-included files matching '__pycache__/*' found anywhere in distribution
    warning: no previously-included files matching '.deps/*' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    warning: no previously-included files matching '*.pyd' found anywhere in distribution
    warning: no previously-included files matching '.git*' found anywhere in distribution
    warning: no previously-included files matching '.DS_Store' found anywhere in distribution
    warning: no previously-included files matching '.mailmap' found anywhere in distribution
    warning: no previously-included files matching 'Makefile.am' found anywhere in distribution
    warning: no previously-included files matching 'Makefile.in' found anywhere in distribution
Downloading/unpacking traitlets (from qtconsole>=4.2.0->spyder)
  Running setup.py egg_info for package traitlets

Downloading/unpacking jupyter-core (from qtconsole>=4.2.0->spyder)
  Running setup.py egg_info for package jupyter-core

Downloading/unpacking jupyter-client>=4.1 (from qtconsole>=4.2.0->spyder)
  Running setup.py egg_info for package jupyter-client

Downloading/unpacking ipykernel>=4.1 (from qtconsole>=4.2.0->spyder)
  Running setup.py egg_info for package ipykernel

Downloading/unpacking mistune!=0.6 (from nbconvert->spyder)
  Running setup.py egg_info for package mistune

    warning: no previously-included files found matching 'mistune.c'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
Downloading/unpacking jinja2 (from nbconvert->spyder)
  Running setup.py egg_info for package jinja2

    warning: no files found matching 'run-tests.py'
    warning: no files found matching '*' under directory 'custom_fixers'
    warning: no files found matching '*' under directory 'jinja2/testsuite/res'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    warning: no previously-included files matching '*.pyc' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
Downloading/unpacking nbformat (from nbconvert->spyder)
  Running setup.py egg_info for package nbformat

Downloading/unpacking entrypoints (from nbconvert->spyder)
  Could not find any downloads that satisfy the requirement entrypoints (from nbconvert->spyder)
Cleaning up...
No distributions at all found for entrypoints (from nbconvert->spyder)
Storing complete log in /root/.pip/pip.log

I have reported this issue upstream spyder-ide/spyder#3766.

fusion809 commented 7 years ago

Hmm, well I seem to have overcome that little error with the help of the Spyder dev team, but there is still one big one. Python seems to be very absolute path-oriented, so it seems like quite the challenge to provide a portable app. Like when I copy the AppDir from the CentOS 7 Docker container to my Ubuntu 16.04 system and run AppDir/usr/bin/spyder it gives the error:

zsh: ./spyder: bad interpreter: /AppDir/usr/bin/python: no such file or directory

The only solution StackOverflow has offered me is (here is a link) to replace the shebangs with relative paths but that has failed too. When I run AppDir/usr/bin/spyder after replacing shebangs it starts Python in the terminal, instead of launching Spyder. Do you have any ideas?

probonopd commented 7 years ago

Use union: true or binpatch: true.

fusion809 commented 7 years ago

But this AppImage is built in a CentOS 7 Docker container, so I can't use a yaml for it, can I?

probonopd commented 7 years ago

No, so you'd need to do manually what union: true or binpatch: true do. See the meta Recipe file.