question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix the DeprecationWarning with Python 3.9.

See original GitHub issue
python -Wd -c "import colour"

gives a number of warnings:

.../opt/pyenv/versions/3.9.10/lib/python3.9/site-packages/colour/utilities/data_structures.py:34: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
  from collections import Mapping, MutableMapping
.../opt/pyenv/versions/3.9.10/lib/python3.9/site-packages/colour/continuous/signal.py:26: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
  from collections import Iterator, Mapping, Sequence
.../opt/pyenv/versions/3.9.10/lib/python3.9/site-packages/colour/utilities/common.py:613: DeprecationWarning: `np.complex` is a deprecated alias for the builtin `complex`. To silence this warning, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  [float, complex, np.integer, np.floating, np.complex]))
.../opt/pyenv/versions/3.9.10/lib/python3.9/site-packages/colour/io/luts/lut.py:21: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
  from collections import MutableSequence
.../opt/pyenv/versions/3.9.10/lib/python3.9/site-packages/colour/volume/rgb.py:186: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  limits=np.array([[0, 100], [-150, 150], [-150, 150]], dtype=np.float),
.../opt/pyenv/versions/3.9.10/lib/python3.9/site-packages/colour/utilities/common.py:613: DeprecationWarning: `np.complex` is a deprecated alias for the builtin `complex`. To silence this warning, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  [float, complex, np.integer, np.floating, np.complex]))
.../opt/pyenv/versions/3.9.10/lib/python3.9/site-packages/colour/utilities/common.py:613: DeprecationWarning: `np.complex` is a deprecated alias for the builtin `complex`. To silence this warning, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  [float, complex, np.integer, np.floating, np.complex]))

Related: https://github.com/colour-science/colour/issues/543

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
KelSolaarcommented, Jan 25, 2022

Ah! 😃 Sorry about that! I actually forgot that I fixed some more in the feature/typing branch which should be merged imminently, this one has none:

(colour-49B8_mty-py3.9) Eris:colour kelsolaar$ git status
On branch feature/typing
Your branch is up to date with 'upstream/feature/typing'.

nothing to commit, working tree clean
(colour-49B8_mty-py3.9) Eris:colour kelsolaar$ python -Wd -c "import colour"
(colour-49B8_mty-py3.9) Eris:colour kelsolaar$ 
1reaction
bersbersberscommented, Jan 25, 2022

@KelSolaar you are (mostly) right! I had tried pip install git+https://github.com/colour-science/colour (installing from master), but develop actually has fewer warnings. But in fact, it still has some:

pip uninstall colour-science
python -Wd -c "import colour"
pip install git+https://github.com/colour-science/colour@develop
python -Wd -c "import colour"

Output:

...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'colour'
...
  Resolved https://github.com/colour-science/colour to commit 38782ac059e8ddd91939f3432bf06811c16667f0
...
Successfully built colour
Installing collected packages: colour
Successfully installed colour-0.3.16
...

.../opt/pyenv/versions/3.9.10/lib/python3.9/site-packages/colour/utilities/common.py:961: DeprecationWarning: `np.complex` is a deprecated alias for the builtin `complex`. To silence this warning, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  a, (int, float, complex, np.integer, np.floating, np.complex))
.../opt/pyenv/versions/3.9.10/lib/python3.9/site-packages/colour/volume/rgb.py:192: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  limits=np.array([[0, 100], [-150, 150], [-150, 150]], dtype=np.float),
.../opt/pyenv/versions/3.9.10/lib/python3.9/site-packages/colour/utilities/common.py:961: DeprecationWarning: `np.complex` is a deprecated alias for the builtin `complex`. To silence this warning, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  a, (int, float, complex, np.integer, np.floating, np.complex))
.../opt/pyenv/versions/3.9.10/lib/python3.9/site-packages/colour/utilities/common.py:961: DeprecationWarning: `np.complex` is a deprecated alias for the builtin `complex`. To silence this warning, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  a, (int, float, complex, np.integer, np.floating, np.complex))
Read more comments on GitHub >

github_iconTop Results From Across the Web

warnings — Warning control — Python 3.11.1 documentation
DeprecationWarning. Base category for warnings about deprecated features when those warnings are intended for other Python developers (ignored by default, ...
Read more >
1772060 – Fix deprecation warning that the functionality will be ...
Bug 1772060 - Fix deprecation warning that the functionality will be removed on python 3.9. Summary: Fix deprecation warning that the functionality will...
Read more >
Fix a deprecation warning of 'collections' · 0617cebcc9 - nova
DeprecationWarning : Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will...
Read more >
Get random number from set deprecation - Stack Overflow
sample() in Python 3.9.2 says this when passed a dict : TypeError: Population must be a sequence. For dicts or sets, use sorted ......
Read more >
News — Cheetah3 - The Python-Powered Template Engine
Fix DeprecationWarning : unittest. ... Fixed a bug in tests with pure-python NameMapper . ... Run tests with Python 3.9 at Travis and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found