这是indexloc提供的服务,不要输入任何密码
Skip to content

[BUG]: Namespace clash with colour package. #958

@mforbes

Description

@mforbes

Description

The colour namespace used by this package collides with the colour package. Usually this is not a problem when packages have the same name as their project namespace (since these must be unique on PyPI) but since this project uses the name colour-science, the usual collision avoidance does not work.

Is there a way to configure colour-science to coexist with the colour package?

My actual issue is that I am using manim which depends on colour, so the solution suggested on stack overflow will not work unless I modify manim.

Code for Reproduction

$ python3 -m venv cs
$ . cs/bin/activate
(cs) $ pip install colour
...
Successfully installed colour-0.1.5
(cs) $ python -c "import colour; print(colour.Color)"
<class 'colour.Color'>
(cs) $ pip install colour-science
...
Successfully installed colour-science-0.4.1 imageio-2.16.1 numpy-1.22.3 pillow-9.0.1 scipy-1.8.0 typing-extensions-4.1.1
(cs) $ python -c "import colour; print(colour.Color)"
...
AttributeError: module 'colour' has no attribute 'Color'

Exception Message

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".../cs/lib/python3.8/site-packages/colour/__init__.py", line 874, in __getattr__
    return super().__getattr__(attribute)
  File ".../cs/lib/python3.8/site-packages/colour/utilities/deprecation.py", line 374, in __getattr__
    return getattr(self._module, attribute)
AttributeError: module 'colour' has no attribute 'Color'

Environment Information

===============================================================================
*                                                                             *
*   Interpreter :                                                             *
*       python : 3.8.12 | packaged by conda-forge | (default, Jan 30 2022,    *
*   23:33:09)                                                                 *
*                [Clang 11.1.0 ]                                              *
*                                                                             *
*   colour-science.org :                                                      *
*       colour : 0.4.1                                                        *
*                                                                             *
*   Runtime :                                                                 *
*       imageio : 2.16.1                                                      *
*       numpy : 1.22.3                                                        *
*       scipy : 1.8.0                                                         *
*                                                                             *
===============================================================================

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions