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.

Dependency to six library

See original GitHub issue

Imagehash 4.3.0 tries to import six, but it is not declared as a dependency for Python 3.10:

https://github.com/osmlab/editor-layer-index/actions/runs/3120554190/jobs/5061223939 https://github.com/osmlab/editor-layer-index/blob/gh-pages/requirements.txt

Traceback (most recent call last):
  File "/home/runner/work/editor-layer-index/editor-layer-index/scripts/sync_wms.py", line 28, in <module>
    import imagehash
  File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/imagehash/__init__.py", line 155, in <module>
    from six.moves.collections_abc import Callable
ModuleNotFoundError: No module named 'six'
Error: Process completed with exit code 1.

There seems to be a fix already in master, but I’m not sure if this works in all cases. I would suggest something like this (not tested):

# not sure when typing.Callable was first introduced. Maybe 3.5?, But I'm not sure if such old python version are still supported by ImageHash
if sys.version_info >= (3, 6):
    # https://stackoverflow.com/questions/65858528/is-collections-abc-callable-bugged-in-python-3-9-1
    if sys.version_info > (3, 9, 1):
        from collections.abc import Callable
    else:
        from typing import Callable
    try:
        MeanFunc = Callable[[NDArray], float]
        HashFunc = Callable[[Image.Image], ImageHash]
    except TypeError:
        MeanFunc = Callable  # type: ignore
        HashFunc = Callable  # type: ignore

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
JohannesBuchnercommented, Sep 28, 2022

I made a release, 4.3.1. Can you please test whether it works for you?

0reactions
JohannesBuchnercommented, Sep 28, 2022

I made a release, 4.3.1. Can you please test whether it works for you?

@JohannesBuchner Thanks for creating a new release that fast! The github action that was affected will trigger automatically on Sunday. I will report back if it solved the issue or not. But I’m very positive that it will.

OK, please reopen if it is still an issue.

Github Actions test these versions: 2.7, 3.5, 3.6, 3.9.1, 3 (latest, 3.10.4 at the moment)

I appreciate that you are willing to support that many old Python versions. In case you are not aware, Python 2.7 reached its end of life on January 1, 2020. A lot of Python packages follow roughly the numpy deprecation policy of supporting Python versions for 42 months: https://numpy.org/neps/nep-0029-deprecation_policy.html

I am aware. I might drop it once things really start to break, but it’s not that bad atm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

six · PyPI
Six is a Python 2 and 3 compatibility library. It provides utility functions for smoothing over the differences between the Python versions with...
Read more >
Six: Python 2 and 3 Compatibility Library — six 1.15.0 ...
Six provides simple utilities for wrapping over differences between Python 2 and Python 3. It is intended to support codebases that work on...
Read more >
six-1.11.0 (Python Module) - Linux From Scratch!
Introduction to Six Module​​ Six is a Python 2 and 3 compatibility library. This package is known to build and work properly using...
Read more >
benjaminp/six: Python 2 and 3 compatibility library - GitHub
Six is a Python 2 and 3 compatibility library. It provides utility functions for smoothing over the differences between the Python versions with...
Read more >
six - Python Package Health Analysis - Snyk
Six is a Python 2 and 3 compatibility library. It provides utility functions for smoothing over the differences between the Python versions with...
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