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

Version 4.5 requires Python 3.6? #765

Closed
banjophil opened this issue Aug 11, 2020 · 6 comments · Fixed by #777
Closed

Version 4.5 requires Python 3.6? #765

banjophil opened this issue Aug 11, 2020 · 6 comments · Fixed by #777
Labels
bug Bug

Comments

@banjophil
Copy link

After upgrading to 4.5 on a raspberry pi getting this error:

Traceback (most recent call last):
  File "/usr/local/bin/instaloader", line 5, in <module>
    from instaloader.__main__ import main
  File "/usr/local/lib/python3.5/dist-packages/instaloader/__init__.py", line 16, in <module>
    from .instaloader import Instaloader
  File "/usr/local/lib/python3.5/dist-packages/instaloader/instaloader.py", line 16, in <module>
    from typing import Any, Callable, ContextManager, IO, Iterator, List, Optional, Set, Union, cast
ImportError: cannot import name 'ContextManager'
@banjophil banjophil added the bug Bug label Aug 11, 2020
@aandergr
Copy link
Member

Which version of Python do you use? According to the Python documentation, typing.ContextManager is supported in Python >= 3.5.4.

@banjophil
Copy link
Author

3.5.3

@aandergr
Copy link
Member

Okay, then I'd recommend to update Python to at least a more recent 3.5 release. If you have to stick to 3.5.3 for some reason, you could remove the occurrences of ContextManager (with that capitalization) from instaloader/instaloader.py, since it is used for type checking only.

@aandergr aandergr added question Question and removed bug Bug labels Aug 11, 2020
@banjophil
Copy link
Author

Sure, I'm also happy using an older Instaloader release for the moment. I thought we should maybe change the documentation to mention the new version only supports Python >= 3.5.4. I'm also new to github, so sorry if I'm not doing this right.

@aandergr
Copy link
Member

aandergr commented Aug 12, 2020

I thought we should maybe change the documentation to mention the new version only supports Python >= 3.5.4.

As for now, given that the limitation to >= 3.5.4 stems from an optional type cast, I'd prefer that we change the code such that it works on Python 3.5.3. I introduced that incompatibility with updating our code to make use of more solid typing features, which are also available on recent Python 3.5 releases (2a37116).

According to the-psf:pypi.downloads BigQuery table, only 0.6 percent of Instaloader 4.5 and 4.4.5 installations have been done with Python 3.5, so a step in the not-so-far future might be to drop support for Python 3.5 entirely in one of the next bigger releases and get rid of the limitations of supporting such an old Python version. Python 3.6 has been released more than three years ago, and only few people seem to use recent software on an outdated operating system. Dropping Python 3.5 support would give us at least literal string formatting, the file system path protocol, variable annotations, guaranteed availability of BLAKE2 hash and better unicode support on Windows.

@aandergr
Copy link
Member

Fixed in Version 4.5.1.

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

Successfully merging a pull request may close this issue.

2 participants