feat(oklch): added oklch to color picker options#97
feat(oklch): added oklch to color picker options#97fnielson1 wants to merge 4 commits intostuartlangridge:appfrom
Conversation
|
OK, I tried running this, but it doesn't seem to work; the relative imports don't seem right. When I do |
@stuartlangridge |
|
Unless I'm missing something very obvious, that isn't working? I installed python3-colour from the Ubuntu archives, and that seems to be the same package as https://pypi.org/project/colour/, and it works: $ python -c "import colour; print(colour.Color)"
<class 'colour.Color'>but there is no 09:22 ~/S+/ColourPicker (fnielson1/app) $ python -m pick
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/aquarius/Scratch/ColourPicker/pick/__main__.py", line 10, in <module>
from .converters import rgb_to_lab, rgb_to_oklch, deltaE, LAB_COLOUR_NAMES
File "/home/aquarius/Scratch/ColourPicker/pick/converters.py", line 4, in <module>
from colour.models import sRGB_to_XYZ, XYZ_to_Oklab
ModuleNotFoundError: No module named 'colour.models'; 'colour' is not a packageis it a different external package? I am confused: it's quite possible I'm doing something very wrong here, but I don't know what. |
|
Hmmm... Lovely. I'll try it in a new environment and see exactly what I did to get it and I'll get back to you. Thanks for keeping at it! |
|
Got it @stuartlangridge ! You need to run:
or in my case, since I'm using a virtual python environment:
|
|
OK, I've now tried this, and it didn't work for different reasons (and I'm not sure why; some sort of library incompatibility that I don't understand): $ python -m venv --system-site-packages ./venv
$ source ./venv/bin/activate
$ python -m pick
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/aquarius/Scratch/ColourPicker/pick/__main__.py", line 10, in <module>
from .converters import rgb_to_lab, rgb_to_oklch, deltaE, LAB_COLOUR_NAMES
File "/home/aquarius/Scratch/ColourPicker/pick/converters.py", line 4, in <module>
from colour.models import sRGB_to_XYZ, XYZ_to_Oklab
ModuleNotFoundError: No module named 'colour.models'; 'colour' is not a package
# ok, so we install it as suggested
$ pip3 install colour-science
Collecting colour-science
Downloading colour_science-0.4.7-py3-none-any.whl.metadata (59 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 59.3/59.3 kB 2.8 MB/s eta 0:00:00
Collecting numpy<3,>=2.0.0 (from colour-science)
Downloading numpy-2.4.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (6.6 kB)
Downloading colour_science-0.4.7-py3-none-any.whl (9.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.1/9.1 MB 11.4 MB/s eta 0:00:00
Downloading numpy-2.4.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (16.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.4/16.4 MB 11.4 MB/s eta 0:00:00
Installing collected packages: numpy, colour-science
Attempting uninstall: numpy
Found existing installation: numpy 1.26.4
Not uninstalling numpy at /usr/lib/python3/dist-packages, outside environment /home/aquarius/Scratch/ColourPicker/venv
Can't uninstall 'numpy'. No files were found to uninstall.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
types-seaborn 0.13 requires pandas-stubs, which is not installed.
scipy 1.11.4 requires numpy<1.28.0,>=1.21.6, but you have numpy 2.4.1 which is incompatible.
types-seaborn 0.13 requires matplotlib>=3.8, but you have matplotlib 3.6.3 which is incompatible.
Successfully installed colour-science-0.4.7 numpy-2.4.1
# and now try running pick again
$ python -m pick
/usr/lib/python3/dist-packages/scipy/__init__.py:132: UserWarning: A NumPy version >=1.21.6 and <1.28.0 is required for this version of SciPy (detected version 2.4.1)
warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/aquarius/Scratch/ColourPicker/pick/__main__.py", line 10, in <module>
from .converters import rgb_to_lab, rgb_to_oklch, deltaE, LAB_COLOUR_NAMES
File "/home/aquarius/Scratch/ColourPicker/pick/converters.py", line 4, in <module>
from colour.models import sRGB_to_XYZ, XYZ_to_Oklab
File "/home/aquarius/Scratch/ColourPicker/venv/lib/python3.12/site-packages/colour/__init__.py", line 72, in <module>
from colour import plotting # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/aquarius/Scratch/ColourPicker/venv/lib/python3.12/site-packages/colour/plotting/__init__.py", line 1, in <module>
from colour.utilities import is_matplotlib_installed
File "/home/aquarius/Scratch/ColourPicker/venv/lib/python3.12/site-packages/colour/utilities/__init__.py", line 150, in <module>
from .metrics import metric_mse, metric_psnr
File "/home/aquarius/Scratch/ColourPicker/venv/lib/python3.12/site-packages/colour/utilities/metrics.py", line 25, in <module>
from colour.algebra import sdiv, sdiv_mode
File "/home/aquarius/Scratch/ColourPicker/venv/lib/python3.12/site-packages/colour/algebra/__init__.py", line 39, in <module>
from .interpolation import (
File "/home/aquarius/Scratch/ColourPicker/venv/lib/python3.12/site-packages/colour/algebra/interpolation.py", line 92, in <module>
import scipy.interpolate
File "/usr/lib/python3/dist-packages/scipy/interpolate/__init__.py", line 167, in <module>
from ._interpolate import *
File "/usr/lib/python3/dist-packages/scipy/interpolate/_interpolate.py", line 9, in <module>
import scipy.special as spec
File "/usr/lib/python3/dist-packages/scipy/special/__init__.py", line 772, in <module>
from . import _ufuncs
File "scipy/special/_ufuncs.pyx", line 1, in init scipy.special._ufuncs
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject |
|
That is so weird. Ugh. I'm probably gonna have to find a different library. |
… using non-deprecated building standards
|
Alright. I made a bunch of changes. I moved the icons in preparation for moving from |
I added an option to format the color value as oklch