[GH-ISSUE #90] [BUG] Build fails in macOS - problem with icon #65

Open
opened 2026-03-04 12:28:34 +03:00 by kerem · 5 comments
Owner

Originally created by @acyment on GitHub (Aug 21, 2023).
Original GitHub issue: https://github.com/casualsnek/onthespot/issues/90

Describe the bug
Build fails in macOS, apparently due to a problem with the icon's format

To Reproduce
Try to run build_mac.sh on a Mac

Expected behavior
Build obtained in dist folder

Log```

3383 INFO: Building BUNDLE BUNDLE-00.toc
Traceback (most recent call last):
File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/icon.py", line 50, in normalize_icon_type
from PIL import Image as PILImage
ModuleNotFoundError: No module named 'PIL'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/acyment/dev/onthespot/venv/bin/pyinstaller", line 8, in
sys.exit(_console_script_run())
^^^^^^^^^^^^^^^^^^^^^
File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/main.py", line 194, in _console_script_run
run()
File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/main.py", line 180, in run
run_build(pyi_config, spec_file, **vars(args))
File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/main.py", line 61, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/build_main.py", line 1019, in main
build(specfile, distpath, workpath, clean_build)
File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/build_main.py", line 944, in build
exec(code, spec_namespace)
File "/Users/acyment/dev/onthespot/onthespot_mac.spec", line 52, in
app = BUNDLE(
^^^^^^^
File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/osx.py", line 115, in init
self.postinit()
File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/datastruct.py", line 184, in postinit
self.assemble()
File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/osx.py", line 140, in assemble
self.icon = normalize_icon_type(self.icon, ("icns",), "icns", CONF["workpath"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/icon.py", line 54, in normalize_icon_type
raise ValueError(
ValueError: Received icon image '/Users/acyment/dev/onthespot/src/onthespot/resources/icon.png' which exists but is not in the correct format. On this platform, only ('icns',) images may be used as icons. If Pillow is installed, automatic conversion will be attempted. Please install Pillow or convert your 'png' file to one of ('icns',) and try again.
=> Setting executable permissions..
=> Cleaning ..
=> Done


**System Information (please complete the following information):**
 - OS: macOS 13.5
 - OnTheSpot Version: 0.5 (downloaded sources on Aug 21th 2023)

**Additional context**
I converted the png file to icns, changed all 4 references to "png" to "icns" in build_mac.sh and build finished successfuly. Not sure if pull requests were accepted
Originally created by @acyment on GitHub (Aug 21, 2023). Original GitHub issue: https://github.com/casualsnek/onthespot/issues/90 **Describe the bug** Build fails in macOS, apparently due to a problem with the icon's format **To Reproduce** Try to run build_mac.sh on a Mac **Expected behavior** Build obtained in dist folder **Log**``` 3383 INFO: Building BUNDLE BUNDLE-00.toc Traceback (most recent call last): File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/icon.py", line 50, in normalize_icon_type from PIL import Image as PILImage ModuleNotFoundError: No module named 'PIL' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/acyment/dev/onthespot/venv/bin/pyinstaller", line 8, in <module> sys.exit(_console_script_run()) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/__main__.py", line 194, in _console_script_run run() File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/__main__.py", line 180, in run run_build(pyi_config, spec_file, **vars(args)) File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/__main__.py", line 61, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/build_main.py", line 1019, in main build(specfile, distpath, workpath, clean_build) File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/build_main.py", line 944, in build exec(code, spec_namespace) File "/Users/acyment/dev/onthespot/onthespot_mac.spec", line 52, in <module> app = BUNDLE( ^^^^^^^ File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/osx.py", line 115, in __init__ self.__postinit__() File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/datastruct.py", line 184, in __postinit__ self.assemble() File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/osx.py", line 140, in assemble self.icon = normalize_icon_type(self.icon, ("icns",), "icns", CONF["workpath"]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/acyment/dev/onthespot/venv/lib/python3.11/site-packages/PyInstaller/building/icon.py", line 54, in normalize_icon_type raise ValueError( ValueError: Received icon image '/Users/acyment/dev/onthespot/src/onthespot/resources/icon.png' which exists but is not in the correct format. On this platform, only ('icns',) images may be used as icons. If Pillow is installed, automatic conversion will be attempted. Please install Pillow or convert your 'png' file to one of ('icns',) and try again. => Setting executable permissions.. => Cleaning .. => Done ``` **System Information (please complete the following information):** - OS: macOS 13.5 - OnTheSpot Version: 0.5 (downloaded sources on Aug 21th 2023) **Additional context** I converted the png file to icns, changed all 4 references to "png" to "icns" in build_mac.sh and build finished successfuly. Not sure if pull requests were accepted
Author
Owner

@lunacoaster commented on GitHub (Mar 17, 2024):

Adding pip install --upgrade --force-reinstall Pillow in build_mac.sh seems to fix the issue:

...
echo " => Installing dependencies to venv with pip..."
pip install -r requirements.txt
pip install --upgrade --force-reinstall Pillow
...
<!-- gh-comment-id:2002565180 --> @lunacoaster commented on GitHub (Mar 17, 2024): Adding `pip install --upgrade --force-reinstall Pillow` in `build_mac.sh` seems to fix the issue: ``` ... echo " => Installing dependencies to venv with pip..." pip install -r requirements.txt pip install --upgrade --force-reinstall Pillow ... ```
Author
Owner

@babbage9010 commented on GitHub (May 6, 2025):

Adding pip install --upgrade --force-reinstall Pillow in build_mac.sh seems to fix the issue:

...
echo " => Installing dependencies to venv with pip..."
pip install -r requirements.txt
pip install --upgrade --force-reinstall Pillow
...

Thanks, this fixed the "Build fails in macOS" issue for me... now it builds, but my app won't actually run. Before this fix it would try to run, and macOS would give me an error popup. Now the app has an icon and I can double-click it, and in less than a second it has died with no sign of an error anywhere. The only issue I see during the build is this, but I don't know what it means:

Collecting PyQt5==5.15.9 (from -r requirements.txt (line 14))
Using cached PyQt5-5.15.9.tar.gz (3.2 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
pyproject.toml: line 7: using '[tool.sip.metadata]' to specify the project metadata is deprecated and will be removed in SIP v7.0.0, use '[project]' instead
Traceback (most recent call last):
File "/Users/xxx/yyy/onthespot/onthespot/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in
main()
File "/Users/xxx/yyy/onthespot/onthespot/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
File "/Users/xxx/yyy/onthespot/onthespot/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 178, in prepare_metadata_for_build_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-build-env-h2dkmylf/overlay/lib/python3.10/site-packages/sipbuild/api.py", line 28, in build_wheel
project = AbstractProject.bootstrap('wheel',
File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-build-env-h2dkmylf/overlay/lib/python3.10/site-packages/sipbuild/abstract_project.py", line 74, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-build-env-h2dkmylf/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 629, in setup
self.apply_user_defaults(tool)
File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-install-8fr4mp9l/pyqt5_29cb056ca3df4c6189d4535e1a2323ef/project.py", line 68, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-build-env-h2dkmylf/overlay/lib/python3.10/site-packages/pyqtbuild/project.py", line 51, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-build-env-h2dkmylf/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 243, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-build-env-h2dkmylf/overlay/lib/python3.10/site-packages/pyqtbuild/builder.py", line 49, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
[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.
hint: See above for details.

<!-- gh-comment-id:2853006387 --> @babbage9010 commented on GitHub (May 6, 2025): > Adding `pip install --upgrade --force-reinstall Pillow` in `build_mac.sh` seems to fix the issue: > > ``` > ... > echo " => Installing dependencies to venv with pip..." > pip install -r requirements.txt > pip install --upgrade --force-reinstall Pillow > ... > ``` Thanks, this fixed the "Build fails in macOS" issue for me... now it builds, but my app won't actually run. Before this fix it would try to run, and macOS would give me an error popup. Now the app has an icon and I can double-click it, and in less than a second it has died with no sign of an error anywhere. The only issue I see during the build is this, but I don't know what it means: Collecting PyQt5==5.15.9 (from -r requirements.txt (line 14)) Using cached PyQt5-5.15.9.tar.gz (3.2 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [23 lines of output] pyproject.toml: line 7: using '[tool.sip.metadata]' to specify the project metadata is deprecated and will be removed in SIP v7.0.0, use '[project]' instead Traceback (most recent call last): File "/Users/xxx/yyy/onthespot/onthespot/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module> main() File "/Users/xxx/yyy/onthespot/onthespot/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) File "/Users/xxx/yyy/onthespot/onthespot/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 178, in prepare_metadata_for_build_wheel whl_basename = backend.build_wheel(metadata_directory, config_settings) File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-build-env-h2dkmylf/overlay/lib/python3.10/site-packages/sipbuild/api.py", line 28, in build_wheel project = AbstractProject.bootstrap('wheel', File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-build-env-h2dkmylf/overlay/lib/python3.10/site-packages/sipbuild/abstract_project.py", line 74, in bootstrap project.setup(pyproject, tool, tool_description) File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-build-env-h2dkmylf/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 629, in setup self.apply_user_defaults(tool) File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-install-8fr4mp9l/pyqt5_29cb056ca3df4c6189d4535e1a2323ef/project.py", line 68, in apply_user_defaults super().apply_user_defaults(tool) File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-build-env-h2dkmylf/overlay/lib/python3.10/site-packages/pyqtbuild/project.py", line 51, in apply_user_defaults super().apply_user_defaults(tool) File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-build-env-h2dkmylf/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 243, in apply_user_defaults self.builder.apply_user_defaults(tool) File "/private/var/folders/c2/1gkmpys101n8rk35pvg2kl740000gn/T/pip-build-env-h2dkmylf/overlay/lib/python3.10/site-packages/pyqtbuild/builder.py", line 49, in apply_user_defaults raise PyProjectOptionException('qmake', sipbuild.pyproject.PyProjectOptionException [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. hint: See above for details.
Author
Owner

@glassdimly commented on GitHub (Jun 28, 2025):

I got this initial error, but when I try to run from the cli I get

❯ ./onthespot_mac
Traceback (most recent call last):
  File "portable.py", line 1, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 457, in exec_module
  File "__init__.py", line 3, in <module>
ModuleNotFoundError: No module named 'PyQt5'
[PYI-50650:ERROR] Failed to execute script 'portable' due to unhandled exception: No module named 'PyQt5'
[PYI-50650:ERROR] Traceback:
Traceback (most recent call last):
  File "portable.py", line 1, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 457, in exec_module
  File "__init__.py", line 3, in <module>
ModuleNotFoundError: No module named 'PyQt5'

╭─ ~/bin/onthespot/dist/onthespot_mac.app/Contents/MacOS │
<!-- gh-comment-id:3014682056 --> @glassdimly commented on GitHub (Jun 28, 2025): I got this initial error, but when I try to run from the cli I get ``` ❯ ./onthespot_mac Traceback (most recent call last): File "portable.py", line 1, in <module> File "PyInstaller/loader/pyimod02_importers.py", line 457, in exec_module File "__init__.py", line 3, in <module> ModuleNotFoundError: No module named 'PyQt5' [PYI-50650:ERROR] Failed to execute script 'portable' due to unhandled exception: No module named 'PyQt5' [PYI-50650:ERROR] Traceback: Traceback (most recent call last): File "portable.py", line 1, in <module> File "PyInstaller/loader/pyimod02_importers.py", line 457, in exec_module File "__init__.py", line 3, in <module> ModuleNotFoundError: No module named 'PyQt5' ╭─ ~/bin/onthespot/dist/onthespot_mac.app/Contents/MacOS │ ```
Author
Owner

@glassdimly commented on GitHub (Jun 28, 2025):

I got this solved more or less and it's running.

A couple of changes
in ./build_mac.sh

echo " => Installing dependencies to venv with pip..."
pip install -r requirements.txt
pip install pyqt5
pip install --upgrade --force-reinstall Pillow

in requirements.txt

requests==2.30.0

If you want to see the errors from running the app, use ./dist/onthespot_mac.app/Contents/MacOS/onthespot_mac

<!-- gh-comment-id:3014718240 --> @glassdimly commented on GitHub (Jun 28, 2025): I got this solved more or less and it's running. A couple of changes in ./build_mac.sh ``` echo " => Installing dependencies to venv with pip..." pip install -r requirements.txt pip install pyqt5 pip install --upgrade --force-reinstall Pillow ``` in requirements.txt ``` requests==2.30.0 ``` If you want to see the errors from running the app, use `./dist/onthespot_mac.app/Contents/MacOS/onthespot_mac`
Author
Owner

@glassdimly commented on GitHub (Jun 28, 2025):

Actually... try this: https://github.com/justin025/onthespot

<!-- gh-comment-id:3014832244 --> @glassdimly commented on GitHub (Jun 28, 2025): Actually... try this: https://github.com/justin025/onthespot
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/onthespot#65
No description provided.