1

I'm the developer of a Python GUI application. I'd like users of my application to be able to install the application using pip because not all of its dependencies have made it into Debian yet, and I don't anticipate that situation changing any time soon.

A PPA would be a good idea, of course, but in my case that would mean creating from scratch Debian packages for Python packages that are not my own and involve things I'm certainly not skilled at, e.g. SWIG.

The next best alternative to a PPA is Python's pip. And it works great! All the best advice says to use the --user option when running pip install. The pip developers say this and my impression is that Ubuntu actually defaults to this.

However on Ubuntu I am seeing two problems when using --user with pip:

  1. The application executable is being installed into ~/.local/bin, which is not on the default path in Ubuntu, in contrast to Fedora and possibly some other distros. (The setup.py uses setuptools' entry_points).
  2. For some inexplicable reason, even though the .desktop file is in ~/.local/share/applications, the application does not show up in the Dash, even after logout. Unfortunately the man pages installed to ~/.local/share/man/man1 also don't appear when the user runs man from the terminal.

I can ask Ubuntu users to create a ~/bin directory and add a symlink to my application in ~/.local/bin, but that won't solve the problem of the man page or the lack of a way to launch the application from the Dash.

How do I advise my users to best solve these problems?

The exact command I am advising users to install with is python3 -m pip install --user foo-1.0.tar.gz

4
  • I have plenty of .desktop files in ~/.local/share (Chrome, Pycharm, and others) and all of then show in dash. Could it be a problem with your file?. – Javier Rivera Mar 11 '16 at 7:34
  • If the executable the desktop file refers to is not on the path, the .desktop file doesn't do much good. Perhaps that's why it doesn't show in the Dash. Which brings us back to the root cause, namely ~/.local/bin not being on the default path – Damon Lynch Mar 11 '16 at 8:52
  • That's easy to solve. Just use the complete path (relative to ~) in the .desktop file. – Javier Rivera Mar 11 '16 at 9:31
  • I've been told by the pip developers that it's best to avoid any kind of path manipulation in setup.py, as after all it ultimately has to be called by different callers e.g. when building a package. In short I can't assume the setup.py is being called from pip using --user. One thing I've just realized is that when a link is made from ~/bin/foo to ~/.local/bin/foo , the icon shows up in the Dash. So that's positive. That still doesn't solve the problem of the man page however. – Damon Lynch Mar 11 '16 at 9:38
0

After talking with the Ubuntu devs on IRC, my understanding now is that Ubuntu follows Debian and adds ~/bin to the PATH if the folder exists. There are no plans to do the same for ~/.local/bin. So the end user must manually adjust their path, or add a symlink, etc. As an application developer I guess I'll need a special install script for Ubuntu and Debian users that does some of these things, which is a real shame, as I'm sure this hits every other Python application developer who relies on pip too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.