Open jfabernathy opened 9 months ago
I recommend you to have a look at the GitHub releases:
I tried to build the latest rc3 but the setup.py does not appear to be setup to be PIP668 compliant. I know I'm not smart enough to modify setup.py to get around this issue.
Please be more specific about which issue you are talking here and what actual errors you get. I have no issues building the latest source using python -m build .
as the preferred PyPA packaging approach. Installing might fail for newer package/Python versions or with the GObject introspection stuff inside a virtual environment by default.
I'm going to need more help with building this. python -m build
will not work on my system. I'm guessing the command should bepython3 -m build.
But I don't know where that should be run. Is setup.py not part of it any more? I tried python3 setup.py build
but that seemed to sort of work but not sudo python3 setup.py install
is where it got the problems with PEP668 issues.
For me ideally if the flatpak version was updated so it could be downloaded from github, that install worked great for me on Ubuntu 22.04 and Archlinux. on Debian 12 the version in the system repository is up to date.
Yes, this depends on your setup - all "modern" systems should use Python 3 by default anyway, but some older setups might actually need python3
, yes.
But I don't know where that should be run. Is setup.py not part of it any more?
Python is pushing towards supporting multiple build backends, with Python 3.12 virtual environments not shipping with setuptools
any more by default for example. For this reason, the basic stuff should avoid running the python setup.py
tasks, except required for some specific reasons. This holds true if a setup.py
file exists as well.
but not
sudo python3 setup.py install
is where it got the problems with PEP668 issues.
Do you have some errors/stacktraces? In general, it is considered bad by pip to install packages system-wide except when using the OS-level package manager, as this might have unintended side effects. Instead, you usually want to use virtual environments per project to get a local installation without strange side effects. In general, the new way usually is considered to be python3 -m pip install --verbose .
instead.
For me ideally if the flatpak version was updated so it could be downloaded from github, that install worked great for me on Ubuntu 22.04 and Archlinux.
Development has stalled for nearly a year now, so I do not suspect that there will be an official release. You might want to try fiddling with the provided GitHub Actions workflows to generate an up-to-date Flatpak build, although the latest run failed and the logs have been deleted automatically in the meantime, thus it is not clear to me what the corresponding issue might be.
Thanks you for your help. On a clean pull of the git, I can run
python3 setup.py build
without problems; clean build.
I next tried python3 -m pip install --verbose
and got these errors:
Using pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
Defaulting to user installation because normal site-packages is not writeable
ERROR: You must give at least one requirement to install (see "pip help install")
I then thought I should have had sudo in front so I did
sudo python3 -m pip install --verbose
and got
[sudo] password for jim:
Using pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
ERROR: You must give at least one requirement to install (see "pip help install")
So it appears I need to figure out what it means about giving at least one requirement to install.
You are missing the final period. You should run
python3 -m pip install --verbose .
from the root of the cloned repository to indicate that you want to install the package definition from the current directory.
I'm getting closer:
python3 -m pip install --verbose .
Using pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
Defaulting to user installation because normal site-packages is not writeable
Processing /home/jim/Downloads/gourmand
Running command pip subprocess to install build dependencies
Collecting setuptools>=40.8.0
Downloading setuptools-69.0.3-py3-none-any.whl (819 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 819.5/819.5 KB 7.4 MB/s eta 0:00:00
Collecting wheel
Downloading wheel-0.42.0-py3-none-any.whl (65 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.4/65.4 KB 14.4 MB/s eta 0:00:00
Installing collected packages: wheel, setuptools
Successfully installed setuptools-69.0.3 wheel-0.42.0
Installing build dependencies ... done
Running command Getting requirements to build wheel
running egg_info
warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
warning: no previously-included files matching '__pycache__/*' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.dylib' found anywhere in distribution
writing manifest file 'src/gourmand.egg-info/SOURCES.txt'
Getting requirements to build wheel ... done
Running command Preparing metadata (pyproject.toml)
running dist_info
creating /tmp/pip-modern-metadata-z09pfuj7/gourmand.egg-info
writing manifest file '/tmp/pip-modern-metadata-z09pfuj7/gourmand.egg-info/SOURCES.txt'
warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
warning: no previously-included files matching '__pycache__/*' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.dylib' found anywhere in distribution
writing manifest file '/tmp/pip-modern-metadata-z09pfuj7/gourmand.egg-info/SOURCES.txt'
Preparing metadata (pyproject.toml) ... done
Collecting sqlalchemy==1.4.36
Downloading SQLAlchemy-1.4.36-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 11.8 MB/s eta 0:00:00
Collecting lxml==4.6.3
Downloading lxml-4.6.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (6.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.9/6.9 MB 40.4 MB/s eta 0:00:00
Collecting recipe-scrapers>=14.27.0
Downloading recipe_scrapers-14.53.0-py3-none-any.whl (199 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.0/199.0 KB 30.4 MB/s eta 0:00:00
Requirement already satisfied: beautifulsoup4>=4.10.0 in /usr/lib/python3/dist-packages (from gourmand==1.0.0) (4.10.0)
Collecting pygobject==3.40.1
Downloading PyGObject-3.40.1.tar.gz (714 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 714.9/714.9 KB 32.2 MB/s eta 0:00:00
Running command pip subprocess to install build dependencies
Collecting setuptools
Using cached setuptools-69.0.3-py3-none-any.whl (819 kB)
Collecting wheel
Using cached wheel-0.42.0-py3-none-any.whl (65 kB)
Collecting pycairo
Downloading pycairo-1.25.1.tar.gz (347 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 347.1/347.1 KB 4.1 MB/s eta 0:00:00
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: pycairo
Building wheel for pycairo (pyproject.toml): started
Building wheel for pycairo (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Building wheel for pycairo (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.10
creating build/lib.linux-x86_64-3.10/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-3.10/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.10/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-3.10/cairo
running build_ext
creating build/temp.linux-x86_64-3.10
creating build/temp.linux-x86_64-3.10/cairo
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=25 -DPYCAIRO_VERSION_MICRO=1 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/python3.10 -c cairo/bufferproxy.c -o build/temp.linux-x86_64-3.10/cairo/bufferproxy.o -Wall -Warray-bounds -Wcast-align -Wconversion -Wextra -Wformat=2 -Wformat-nonliteral -Wformat-security -Wimplicit-function-declaration -Winit-self -Winline -Wmissing-format-attribute -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-aliasing -Wundef -Wunused-but-set-variable -Wswitch-default -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-command-line-argument -fno-strict-aliasing -fvisibility=hidden -std=c99
cairo/bufferproxy.c:32:10: fatal error: Python.h: No such file or directory
32 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycairo
Failed to build pycairo
ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /usr/bin/python3 /tmp/pip-standalone-pip-gz6tcqly/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-2ko09wua/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
cwd: [inherit]
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
You are missing the development headers of at least Python itself. For Ubuntu, you probably need to install python3-dev
and try again.
With that installed I got a little further:
Successfully built gourmand jstyleson
Failed to build pygobject
ERROR: Could not build wheels for pygobject, which is required to install pyproject.toml-based projects
You probably need to install python3-gi
as well.
No, I have that one. Here's the complete error from that last run: pip-install.log
Do you have libcairo-dev
installed?
jim@Office-PC:~/Downloads/gourmand$ sudo apt install libcairo-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libcairo2-dev' instead of 'libcairo-dev'
libcairo2-dev is already the newest version (1.16.0-5ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
BTW this is LinuxMint 21.2 which is built on Ubuntu 22.04 LTS
I am on a similar system based on Ubuntu 22.04.2 (although no Linux Mint, which should not matter), but it has been sufficient for me to install this package to get rid of the error in my tests. I installed libcairo-dev python3-gi gir1.2-gtk-3.0 libgirepository1.0-dev
and afterwards Gourmand would install without an error.
I have all of those. The most recent run shows this after "running build_ext":
Package py3cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `py3cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'py3cairo' found
Command '('pkg-config', '--print-errors', '--exists', 'py3cairo >= 1.16.0')' returned non-zero exit status 1.
error: subprocess-exited-with-error
× Building wheel for pygobject (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /usr/bin/python3 /usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpadlqhwak
cwd: /tmp/pip-install-teikh_a7/pygobject_2026d0e14eec4ffcb5bed4ad64ec56dd
Building wheel for pygobject (pyproject.toml) ... error
ERROR: Failed building wheel for pygobject
Successfully built gourmand
Failed to build pygobject
ERROR: Could not build wheels for pygobject, which is required to install pyproject.toml-based projects
Maybe installing python3-gi-cairo
helps?
python3-gi-cairo is already the newest version (3.42.1-0ubuntu1).
I just tried to build a current AppImage and Flatpak file. It seems like the AppImage does not work, while the Flatpak from https://github.com/FriedrichFroebel/gourmand/actions/runs/7321694245 might work.
I did get the flatpak version you referenced above and got it installed. That seems to work but I have to move my data to a new location as it's no longer in $HOME/.gourmand
I tried building gourmand on Debian 12 and Ubuntu 23.10 which both now require adhering to the new PIP rules about externally managed environments. I get basically the same errors. On Ubuntu 23.10 where I know I can install gourmand from the official repository, I tried to clone the repository from git hub and build using:
python3 setup.py build
The console log is attached and has some "Package to be ignored" warnings build.log
Just out of interest I tried to install with:
python3 -m pip install --verbose .
log below:
python3 -m pip install --verbose .
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
I've seen this error a lot messing with python3 since the PEP668 rules came into play.
error: externally-managed-environment
You should use a dedicated virtual environment to avoid conflicts.
What about all the warning in the build process? I don't think I received those when building for Ubuntu 22.04
I received the same warnings when building the package and it seemed to work without issues. They probably are hidden when running without the --verbose
flag.
Okay, I think I have the virtual environment setup. I'm testing on a clean VM using LMDE6 which is based on Debian 12. I created the venv by:
sudo apt install python3.11-venv
then
python3 -m venv .
then
$ bin/python3 bin/pip install .
Processing /home/jim/gourmand
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting beautifulsoup4>=4.10.0
Downloading beautifulsoup4-4.12.2-py3-none-any.whl (142 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.0/143.0 kB 2.1 MB/s eta 0:00:00
Collecting lxml==4.6.3
Downloading lxml-4.6.3.tar.gz (3.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 19.1 MB/s eta 0:00:00
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [3 lines of output]
Building lxml version 4.6.3.
Building without Cython.
Error: Please make sure the libxml2 and libxslt development packages are installed.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
This seems more like an application problem??
It seems like your virtual environment is missing the wheel package. Try installing it with python -m pip install --upgrade wheel
and when run the above installation command again.
Edit: Gourmand currently pins some packages, which might lead to some other issues, especially with binary wheels as for lxml and newer Python versions. The pinned lxml==4.6.3
dependency is not available as binary wheel for Python 3.11, thus you have to attempt building it yourself or modify the install_requires
section of Gourmand accordingly: https://pypi.org/project/lxml/4.6.3/#files
Just for reference: The current tests seem to run fine on Python 3.11 with the following updated setup.py
file: https://github.com/FriedrichFroebel/gourmand/blob/master/setup.py
i used the new setup.py and got the error about cairo. I must be missing something basic.
bin/python3 bin/pip install .
Processing /home/jim/gourmand
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting beautifulsoup4>=4.10.0
Using cached beautifulsoup4-4.12.2-py3-none-any.whl (142 kB)
Collecting lxml>=4.6.3
Downloading lxml-4.9.4-cp311-cp311-manylinux_2_28_x86_64.whl (7.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.9/7.9 MB 24.0 MB/s eta 0:00:00
Collecting pillow>=8.3.2
Using cached Pillow-10.1.0-cp311-cp311-manylinux_2_28_x86_64.whl (3.6 MB)
Collecting pygobject==3.40.1
Using cached PyGObject-3.40.1.tar.gz (714 kB)
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [43 lines of output]
Collecting setuptools
Using cached setuptools-69.0.3-py3-none-any.whl (819 kB)
Collecting wheel
Using cached wheel-0.42.0-py3-none-any.whl (65 kB)
Collecting pycairo
Using cached pycairo-1.25.1.tar.gz (347 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: pycairo
Building wheel for pycairo (pyproject.toml): started
Building wheel for pycairo (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Building wheel for pycairo (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [15 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-311
creating build/lib.linux-x86_64-cpython-311/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-cpython-311/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-cpython-311/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-cpython-311/cairo
running build_ext
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
Package 'cairo', required by 'virtual:world', not found
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycairo
Failed to build pycairo
ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
I recommend you to try understanding the errors produced by the build process - in this case you are apparently missing the general Cairo development headers (libcairo2-dev
).
Thanks for your patience. I switched over to cloning your test repository and was able to build without warnings and to install in a virtual environment without errors. I can run
cd /home/jim/test-repo-gourmand/gourmand
bin/gourmand
and the program works fine.
So I can setup the application menu to run from this directory and thus the venv, but not sure what can be done to run this on my system so other users can run the same version.
This seems like a lot of work compared to what used to be done a few years ago.
I guess that is why I like the flatpak version. Once it's downloaded from your github, any user on this PC can run it with their own set of recipes.
I guess I'm missing the easy button.
With Flatpak, it might depend on how you set up your repositories - they will either be available to your user only or to every user.
I understand that the current maintenance status of Gourmet/Gourmand and related tools tends to not be the best and there have been some discussions at the Gourmet repository about the general code quality and refactoring. From what I have seen, quite some internal cleanup tends to be necessary to be future proof - during my tests, I already observed deprecation warnings from pygobject, SQLAlchemy, imp, and setuptools/pip. For now, I just did the minimal amount of changes to get it working on Python 3.11, but not being an active user at the moment and already maintaining quite some personal and work-related projects I do not really have the time to make bigger changes to the code to ensure it keeps being maintained.
I may have spoke too soon on the build on Ubuntu 22.04. It has no printer plugin so you can't print.
You already reported this in the original repository as well and this should probably be a separate issue: https://github.com/thinkle/gourmet/issues/1029
I don't think I'm helping very much with all this. I'll just use the flatpak version you produced on your repo. It works well under all the distros I use here. Maybe that can make it to the official gourmand repo?
I don't think I'm helping very much with all this.
Your dialogue helped me. I had a similar issue and process and so both your posts helped me sanity check and I am grateful. I was also helped by the clarity offered around the current state of the project. <3
FYI. I've taken your flatpak version and tested it on Ubuntu 23.10, Linux Mint 21.2, Linux Mint Debian Edition 6, and Endeavour OS (Arch) and it works well including printing.
However, the official repo package for gourmand does not work on Ubuntu 23.10. It crashes after you restore your data.
The official repo version on Ubuntu 22.04 works but is old, Debian 12 repo version works and is the rc3. The AUR for gourmand is broken.
For all those reasons and the success with the flatpak from your test site, I'm sticking with that on all Distros.
I'm trying to insure I have the latest version of gourmand.
Flatpak seems to be at version 1.1.0rc2 Debian 12 bookworm seems to have version 1.1.0+really1.1.0-rc3-3 Ubuntu 22.04 seems to have version 1.0.0-7
I tried to build the latest rc3 but the setup.py does not appear to be setup to be PIP668 compliant. I know I'm not smart enough to modify setup.py to get around this issue.
Any information would be great.