hhannine / superpaper

A cross-platform multi monitor wallpaper manager.
MIT License
1.15k stars 47 forks source link

Not usable if installed with pipx #142

Closed Roy-Orbison closed 3 months ago

Roy-Orbison commented 1 year ago

Describe the bug Python now strongly discourages package installation with pip, even in --user mode instead of system-wide, because it can cause compatibility issues with system apps. The general recommendation is to use pipx to automatically manage a virtual environment for python apps.

To Reproduce Steps to reproduce the behaviour:

  1. Install Superpaper with pipx, e.g.:
    
    roy@orbox:~$ pipx install superpaper
      installed package superpaper 2.2.1, installed using Python 3.11.2
      These apps are now globally available
        - superpaper
    done! ✨ 🌟 ✨
  2. run superpaper

Expected behavior Program to launch as normal, but I don't even know if it should work with pipx.

Actual behaviour

/home/roy/.local/pipx/venvs/superpaper/lib/python3.11/site-packages
/home/roy/.config/superpaper
/home/roy/.config/superpaper/profiles
Traceback (most recent call last):
  File "/home/roy/.local/bin/superpaper", line 5, in <module>
    from superpaper.__main__ import main
  File "/home/roy/.local/pipx/venvs/superpaper/lib/python3.11/site-packages/superpaper/__main__.py", line 13, in <module>
    from superpaper.cli import cli_logic
  File "/home/roy/.local/pipx/venvs/superpaper/lib/python3.11/site-packages/superpaper/cli.py", line 9, in <module>
    from superpaper.data import CLIProfileData
  File "/home/roy/.local/pipx/venvs/superpaper/lib/python3.11/site-packages/superpaper/data.py", line 16, in <module>
    from superpaper.message_dialog import show_message_dialog
  File "/home/roy/.local/pipx/venvs/superpaper/lib/python3.11/site-packages/superpaper/message_dialog.py", line 3, in <module>
    import wx
ModuleNotFoundError: No module named 'wx'

Desktop (please complete the following information):

Roy-Orbison commented 1 year ago

I solved it with advice from other python apps' issues:

python3 -m venv --system-site-packages .venv/superpaper
. .venv/superpaper/bin/activate
pip install superpaper

Then manually added an app menu item with /home/roy/.venv/superpaper/bin/superpaper as the program and /home/roy/.venv/superpaper/share/icons/hicolor/256x256/apps/superpaper.png as the icon.

I'll let you close this in case you wish to add support for pipx or document how it can be made to work.

DavidMakin commented 10 months ago

pipx runpip superpaper install wxPython fixed it on Ubuntu for me

radiotaiso commented 9 months ago

Encountered the same issue, trying to install wxPython in the pipx venv results in fail:

Both pipx runpip superpaper install wxPython and pipx inject superpaper wxPython result in the same error.

Collecting wxPython
  Using cached wxPython-4.2.1.tar.gz (73.7 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pillow in ./.local/share/pipx/venvs/superpaper/lib/python3.11/site-packages (from wxPython) (10.2.0)
Collecting six (from wxPython)
  Using cached six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
Requirement already satisfied: numpy in ./.local/share/pipx/venvs/superpaper/lib/python3.11/site-packages (from wxPython) (1.26.4)
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Building wheels for collected packages: wxPython
  Building wheel for wxPython (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for wxPython (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [132 lines of output]
      running bdist_wheel
      running build
      /tmp/pip-install-_umwnt4a/wxpython_779207addd2d4b0fa200d35e7dee143e/build.py:43: DeprecationWarning: dep_util is Deprecated. Use functions from setuptools instead.
        from distutils.dep_util import newer, newer_group
      Will build using: "/home/user/.local/share/pipx/venvs/superpaper/bin/python"
      3.11.8 (main, Feb  7 2024, 21:52:08) [GCC 13.2.0]
      Python's architecture is 64bit
      cfg.VERSION: 4.2.1

      Running command: build
      Running command: build_wx
      wxWidgets build options: ['--wxpython', '--unicode', '--gtk3']
      Configure options: ['--enable-unicode', '--with-gtk=3', '--enable-sound', '--enable-graphics_ctx', '--enable-display', '--enable-geometry', '--enable-debug_flag', '--enable-optimise', '--disable-debugreport', '--enable-uiactionsim', '--enable-autoidman', '--with-sdl']
      /tmp/pip-install-_umwnt4a/wxpython_779207addd2d4b0fa200d35e7dee143e/ext/wxWidgets/configure --enable-unicode --with-gtk=3 --enable-sound --enable-graphics_ctx --enable-display --enable-geometry --enable-debug_flag --enable-optimise --disable-debugreport --enable-uiactionsim --enable-autoidman --with-sdl
      checking build system type... x86_64-pc-linux-gnu
      checking host system type... x86_64-pc-linux-gnu
      checking for toolkit... gtk
      checking for gcc... gcc
      checking whether the C compiler works... yes
      checking for C compiler default output file name... a.out
      checking for suffix of executables...
      checking whether we are cross compiling... no
      checking for suffix of object files... o
      checking whether we are using the GNU C compiler... yes
      checking whether gcc accepts -g... yes
      checking for gcc option to accept ISO C89... none needed
      checking whether we are using the Intel C compiler... no
      checking how to run the C preprocessor... gcc -E
      checking for grep that handles long lines and -e... /usr/bin/grep
      checking for egrep... /usr/bin/grep -E
      checking whether gcc needs -traditional... no
      checking for g++... g++
      checking whether we are using the GNU C++ compiler... yes
      checking whether g++ accepts -g... yes
[....]
      checking for tiffio.h... no
      configure: WARNING: system tiff library not found, will use built-in instead
      checking whether tiff.h file exists... yes
      checking for expat.h... yes
      checking if expat.h is valid C++ header... yes
      checking for XML_ParserCreate in -lexpat... yes
      checking for LIBCURL... not found
      checking for GTK+ version...
      checking for pkg-config... no
      checking for GTK+ - version >= 3.0.0... no
      *** A new enough version of pkg-config was not found.
      *** See http://pkgconfig.sourceforge.net
      configure: error:
      The development files for GTK+ were not found. For GTK+ 2, please
      ensure that pkg-config is in the path and that gtk+-2.0.pc is
      installed. For GTK+ 1.2 please check that gtk-config is in the path,
      and that the version is 1.2.3 or above. Also check that the
      libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
      --libs' are in the LD_LIBRARY_PATH or equivalent.

      Error running configure
      ERROR: failed building wxWidgets
      Traceback (most recent call last):
        File "/tmp/pip-install-_umwnt4a/wxpython_779207addd2d4b0fa200d35e7dee143e/build.py", line 1563, in cmd_build_wx
          wxbuild.main(wxDir(), build_options)
        File "/tmp/pip-install-_umwnt4a/wxpython_779207addd2d4b0fa200d35e7dee143e/buildtools/build_wxwidgets.py", line 379, in main
          exitIfError(wxBuilder.configure(dir=wxRootDir, options=configure_opts),
        File "/tmp/pip-install-_umwnt4a/wxpython_779207addd2d4b0fa200d35e7dee143e/buildtools/build_wxwidgets.py", line 72, in exitIfError
          raise builder.BuildError(msg)
      buildtools.builder.BuildError: Error running configure
      Finished command: build_wx (0m2.488s)
      Finished command: build (0m2.488s)
      WARNING: Building this way assumes that all generated files have been
      generated already.  If that is not the case then use build.py directly
      to generate the source and perform the build stage.  You can use
      --skip-build with the bdist_* or install commands to avoid this
      message and the wxWidgets and Phoenix build steps in the future.

      "/home/user/.local/share/pipx/venvs/superpaper/bin/python" -u build.py build
      Command '"/home/user/.local/share/pipx/venvs/superpaper/bin/python" -u build.py build' failed with exit code 1.
      [end of output]

Using Debian Testing [Debian 6.6.15-2 (2024-02-04) x86_64] Python 3.11.8

Using the workaround of installing the pip package in a venv manually works, I symlinked .venv/superpaper/bin/superpaper to my path and can use the console to run it.

Thanks @Roy-Orbison

Roy-Orbison commented 9 months ago

I didn't realise at the time, but pipx install accepts the same option pip does:

pipx install --system-site-packages superpaper

I uninstalled the venv version and installed it again using the above command. It works fine.

I also changed my app menu item so that the program is just superpaper and the icon is /home/roy/.local/pipx/venvs/superpaper/share/icons/hicolor/256x256/apps/superpaper.png

azeemh commented 3 months ago

i had a problem with superpaper appimage and the GTK theme problem that hit everything on linux, but i was able to install with python 3.12.3 using pipx install --system-site-packages superpaper and it finally worked.