Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS, iPadOS do no have support for "float128". #663

Closed
KelSolaar opened this issue Dec 19, 2020 · 12 comments
Closed

iOS, iPadOS do no have support for "float128". #663

KelSolaar opened this issue Dec 19, 2020 · 12 comments

Comments

@KelSolaar
Copy link
Member

As reported here: https://www.colour-science.org/posts/numfocus-colour-0314-and-colour-datasets-010/#comment-5187531290

File "../../../downloadable-site-packages/compiled/numpy/__init__.py", line 214, in __getattr__
File "Documents/site-packages/colour/io/image.py", line 98, in <module>
'float128', np.float128, None, 1, False)
AttributeError: module 'numpy' has no attribute 'float128'
File "../../../downloadable-site-packages/compiled/numpy/__init__.py", line 214, in __getattr__
>>> AttributeError: module 'numpy' has no attribute 'float128
@KelSolaar
Copy link
Member Author

KelSolaar commented Dec 19, 2020

A quick hack to get colour 0.3.16 running in Pyto is to patch it locally on iOS.

Assuming you have Pytest (or any other Pypi packaged) manually installed, you can run that once:

import os

# Install "pytest" from Pypi to get a hook on the "site-packages" directory.
import pytest

SITE_PACKAGES_ROOT = os.path.abspath(os.path.join(pytest.__path__[0], '..'))

COLOUR_ROOT = os.path.join(SITE_PACKAGES_ROOT, 'colour')

COLOUR_IO_IMAGE_PATH = os.path.join(COLOUR_ROOT, 'io', 'image.py')

with open(COLOUR_IO_IMAGE_PATH) as MODULE_FILE:
    CONTENT = MODULE_FILE.readlines()

with open(COLOUR_IO_IMAGE_PATH, 'w') as MODULE_FILE:
    for LINE in CONTENT:
        MODULE_FILE.write(LINE.replace('np.float128', 'np.float64'))

@fredsavoir
Copy link
Contributor

Hi thanks for patch but don't work
On my iOS.
Running as script change nothing ;(

@KelSolaar
Copy link
Member Author

Do you have any specific errors?

@fredsavoir
Copy link
Contributor

fredsavoir commented Dec 23, 2020 via email

@KelSolaar
Copy link
Member Author

Here is a video of the steps I took that work for me: https://drive.google.com/file/d/1z78Et5I5XplTr1J1XI2t1WNrGA5ZEKtV/view?usp=drivesdk

@fredsavoir
Copy link
Contributor

fredsavoir commented Dec 23, 2020 via email

@fredsavoir
Copy link
Contributor

fredsavoir commented Dec 23, 2020 via email

@KelSolaar
Copy link
Member Author

Glad to hear!

@baileyji
Copy link

baileyji commented Apr 9, 2021

I'll point out this also makes the library fail on Raspberry Pi.

In [2]: import colour.temperature as ct

AttributeError Traceback (most recent call last)
in ()
----> 1 import colour.temperature as ct

/home/pi/.local/lib/python3.7/site-packages/colour/init.py in ()
95 from .geometry import (PRIMITIVE_METHODS, primitive,
96 PRIMITIVE_VERTICES_METHODS, primitive_vertices)
---> 97 from .io import (LUT1D, LUT3x1D, LUT3D, LUTSequence, READ_IMAGE_METHODS,
98 SpectralDistribution_IESTM2714, WRITE_IMAGE_METHODS,
99 read_image, read_LUT, read_sds_from_csv_file,

/home/pi/.local/lib/python3.7/site-packages/colour/io/init.py in ()
5 from .luts import * # noqa
6 from . import luts
----> 7 from .image import ImageAttribute_Specification, convert_bit_depth
8 from .image import read_image_OpenImageIO, write_image_OpenImageIO
9 from .image import read_image_Imageio, write_image_Imageio

/home/pi/.local/lib/python3.7/site-packages/colour/io/image.py in ()
97 if platform.system() not in ('Windows', 'Microsoft'): # pragma: no cover
98 BIT_DEPTH_MAPPING['float128'] = BitDepth_Specification(
---> 99 'float128', np.float128, None, 1, False)
100
101
...
AttributeError: module 'numpy' has no attribute 'float128'

@fredsavoir
Copy link
Contributor

fredsavoir commented Apr 9, 2021 via email

@baileyji
Copy link

baileyji commented Apr 9, 2021

Yes, that hack worked, though I should note that the assumptions about SITE_PACKAGES_ROOT are not robust.

@KelSolaar
Copy link
Member Author

Hi @baileyji,

Yes, that hack worked, though I should note that the assumptions about SITE_PACKAGES_ROOT are not robust.

Absolutely and it is only temporary as the develop branch does not require that anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants