0

I would like to use python setup.py install to install Spyder to /AppDir/usr (i.e., this is the --prefix that I specify to python setup.py install) and I would like this installation of Spyder to work even if I move the /AppDir directory. This presently is not the case as when I cd to the moved /AppDir/usr/bin (which is no longer at /AppDir/usr/bin but rather at ~/GitHub/mine/packaging/AppImages/recipes/spyder/AppDir/usr/bin, as I moved it) directory and run ./spyder from within it I get the error:

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

To make this installation of Spyder portable I believe I need the installed files of Spyder in /AppDir/usr to call on relative file paths instead of absolute file paths (so instead of calling on the interpreter /AppDir/usr/bin/python it would call on say ./python). Is there a way to do this?

EDIT: I plan on creating an AppImage (a cross-distribution package format) from this AppDir so symbolic links will not work! As this AppImage is intended to be downloaded by others and used by others local solutions (e.g., making it run by modifying my local system like my ~/.zshrc file) will not work!

ivan_pozdeev
  • 33,874
  • 19
  • 107
  • 152
Josh Pinto
  • 1,453
  • 4
  • 20
  • 37

1 Answers1

0

The error you're getting results from the shebang in ./spyder. Shebangs must use absolute paths, so it cannot change automagically when you move the folder with the interpreter. In fact, the very idea behind the Filesystem Hierarchy Standard is for logical file locations to stay the same and predictable, regardless of their physical location (for Python specifically, e.g. .pyc files have absolute paths inside them so they may have to be regenerated once the installation is moved).

The simplest way out is to manually search & replace shebangs in all scripts that use that specific Python installation. See e.g. linux - How / Is it possible to install python in a portable way? - Unix & Linux Stack Exchange and Creating a Portable Python (local install) for Linux for other options.

Community
  • 1
  • 1
ivan_pozdeev
  • 33,874
  • 19
  • 107
  • 152