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.

Python 2 incompatibility

See original GitHub issue

Hello,

There seems to be an issue with the latest version of fastavro (1.0) on Python 2 after you dropped the Python 2 support from what I saw in your Changelog. Here is the error that I have when trying to install fastavro on Python 2 :

if sys.implementation.name != "pypy":
     AttributeError: 'module' object has no attribute 'implementation'

You dropped Python 2 support but you forgot to add python_requires='>=3.5' in your setup.py that will prevent users with Python 2 from downloading a sdist version they cannot build.

For more information about python_requires you can check the following details: Note: supporting python_requires requires setuptools>=24.2.0 and pip>=9.0.0 to benefit from it. Details here: https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
scottbeldencommented, Aug 26, 2020

Okay, so I learned that there is a new yank feature on pypi which looks like it will do what I want. It effectively hides the 1.0.0 release so that it won’t be used by pip but is still technically installable if someone does pip install fastavro==1.0.0.

I was able to install correctly on Python 2 now:

pip install -U --no-cache fastavro
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting fastavro
  Downloading fastavro-0.24.2-cp27-cp27m-macosx_10_14_x86_64.whl (465 kB)
     |████████████████████████████████| 465 kB 804 kB/s
Requirement already satisfied, skipping upgrade: pytz in ... (from fastavro) (2020.1)
Installing collected packages: fastavro
Successfully installed fastavro-0.24.2
1reaction
scottbeldencommented, Aug 26, 2020

So I tried merging the PR and creating a 1.0.0.post release. I thought the idea of the post release was to effectively shadow the 1.0.0 release, but that doesn’t seem to happen. When I try to install on Python 2, pip skips the 1.0.0.post as expected because of the python_requires, but it still just tries to use the 1.0.0 tarball.

I could delete the 1.0.0 tarball from pypi… I’m a little worried about doing that as it sometimes causes issues for people that run their own mirrors or have the cached 1.0.0 version, but leaving it up also seems like a bad idea because now anyone on Python 2 that tries to install will hit an error at install time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PEP 291 – Backward Compatibility for the Python 2 Standard ...
This PEP describes the packages and modules in the Python 2 standard library which should remain backward compatible with previous versions of ...
Read more >
Cheat Sheet: Writing Python 2-3 compatible code
This notebook shows you idioms for writing future-proof code that is compatible with both versions of Python: 2 and 3. It accompanies Ed...
Read more >
Python Language Tutorial => Incompatibilities moving from ...
Python 2.7 is backwards-compatible with most earlier versions of Python, and can run Python code from most 1.x and 2.x versions of Python...
Read more >
Supporting Python 2 and 3 without 2to3 conversion
Python 2.7 has some small improvements on Python 3 compatibility, but it's likely that if you want to run the same code under...
Read more >
Are Python 2.7 and 3.x permanently incompatible? - Quora
That's good question. And the answer is Yes, Python 2.7 and 3.x will be permanently incompatible. However, even though the technical is Yes,...
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