Closed mforbes closed 2 years ago
Hi @mforbes,
Yes this is a known issue, it is the first time though that someone reports it in almost 8 years! :) You will also note that the author of the colour
package had the same kind of issue back then because the color
namespace was used: all is objects are called Color
or refer to color.
So while there is no elegant solution, there is a dirty one that should hopefully work for you, i.e. namespace merging which is easy because colour.py
is a single file:
python3 -m venv colour-science-colour
source colour-science-colour/bin/activate
pip install colour
mv colour-science-colour/lib/python3.9/site-packages/colour.py colour-science-colour/lib/python3.9/site-packages/color.py
pip install colour-science
echo "from color import *" >> colour-science-colour/lib/python3.9/site-packages/colour/__init__.py
The steps run in a shell with output:
Eris:Environments kelsolaar$ python3 -m venv colour-science-colour
Eris:Environments kelsolaar$ source colour-science-colour/bin/activate
(colour-science-colour) Eris:Environments kelsolaar$ pip install colour
Collecting colour
Using cached colour-0.1.5-py2.py3-none-any.whl (23 kB)
Installing collected packages: colour
Successfully installed colour-0.1.5
WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available.
You should consider upgrading via the '/Users/kelsolaar/Documents/Development/Environments/colour-science-colour/bin/python3.9 -m pip install --upgrade pip' command.
(colour-science-colour) Eris:Environments kelsolaar$ mv colour-science-colour/lib/python3.9/site-packages/colour.py colour-science-colour/lib/python3.9/site-packages/color.py
(colour-science-colour) Eris:Environments kelsolaar$ pip install colour-science
Collecting colour-science
Using cached colour_science-0.4.1-py3-none-any.whl (2.2 MB)
Collecting imageio<3,>=2
Using cached imageio-2.16.1-py3-none-any.whl (3.3 MB)
Collecting numpy<2,>=1.19
Using cached numpy-1.22.3-cp39-cp39-macosx_11_0_arm64.whl (12.8 MB)
Collecting scipy<2,>=1.5
Using cached scipy-1.8.0-cp39-cp39-macosx_12_0_arm64.whl (28.7 MB)
Collecting typing-extensions<5,>=4
Using cached typing_extensions-4.1.1-py3-none-any.whl (26 kB)
Collecting pillow>=8.3.2
Using cached Pillow-9.0.1-1-cp39-cp39-macosx_11_0_arm64.whl (2.7 MB)
Installing collected packages: pillow, numpy, typing-extensions, scipy, imageio, 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
WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available.
You should consider upgrading via the '/Users/kelsolaar/Documents/Development/Environments/colour-science-colour/bin/python3.9 -m pip install --upgrade pip' command.
(colour-science-colour) Eris:Environments kelsolaar$ echo "from color import *" >> colour-science-colour/lib/python3.9/site-packages/colour/__init__.py
(colour-science-colour) Eris:Environments kelsolaar$ python
Python 3.9.9 (main, Nov 21 2021, 03:16:13)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import colour
>>> colour.Color
<class 'color.Color'>
>>> colour.utilities.describe_environment()
===============================================================================
* *
* Interpreter : *
* python : 3.9.9 (main, Nov 21 2021, 03:16:13) *
* [Clang 13.0.0 (clang-1300.0.29.3)] *
* *
* colour-science.org : *
* colour : 0.4.1 *
* *
* Runtime : *
* imageio : 2.16.1 *
* numpy : 1.22.3 *
* scipy : 1.8.0 *
* *
===============================================================================
defaultdict(<class 'dict'>, {'Interpreter': {'python': '3.9.9 (main, Nov 21 2021, 03:16:13) \n[Clang 13.0.0 (clang-1300.0.29.3)]'}, 'colour-science.org': {'colour': '0.4.1'}, 'Runtime': {'imageio': '2.16.1', 'numpy': '1.22.3', 'scipy': '1.8.0'}})
@KelSolaar Thanks for the suggestion. Any idea how I tell Poetry or Anaconda Project to do this? They don't currently allow hooks. Would it be possible to have a [colour]
extra in colour-science
that does this somehow on install?
Mmmh, I don't think it is possible unfortunately!
I will close this one as there is not much we can do about it!
Description
The
colour
namespace used by this package collides with thecolour
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 namecolour-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 oncolour
, so the solution suggested on stack overflow will not work unless I modifymanim
.Code for Reproduction
Exception Message
Environment Information