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.

Incompatible version is released to Python 2

See original GitHub issue

chainer>=7.0.0 released before #8517 is still released to Python 2, even though they doesn’t support Python 2. Due to this, we cannot use pip install chainer in Python 2. Instead, we always have to specify install version like pip install chainer<7.0.0.

$ pip install --user chainer --no-cache-dir -U
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. 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 chainer
  Downloading https://files.pythonhosted.org/packages/a8/ba/32b704e077cb24b4d85260512a5af903e772f06fb58e716301dd51758869/chainer-7.0.0.tar.gz (1.0MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.0MB 8.1MB/s 
Requirement already satisfied, skipping upgrade: setuptools in /usr/lib/python2.7/dist-packages (from chainer) (20.7.0)
Requirement already satisfied, skipping upgrade: typing_extensions in /usr/local/lib/python2.7/dist-packages (from chainer) (3.6.6)
Requirement already satisfied, skipping upgrade: filelock in /usr/local/lib/python2.7/dist-packages (from chainer) (3.0.12)
Requirement already satisfied, skipping upgrade: numpy>=1.9.0 in /usr/lib/python2.7/dist-packages (from chainer) (1.11.0)
Requirement already satisfied, skipping upgrade: protobuf>=3.0.0 in /usr/local/lib/python2.7/dist-packages (from chainer) (3.7.1)
Requirement already satisfied, skipping upgrade: six>=1.9.0 in /usr/local/lib/python2.7/dist-packages (from chainer) (1.12.0)
Requirement already satisfied, skipping upgrade: typing>=3.6.2 in /usr/local/lib/python2.7/dist-packages (from typing_extensions->chainer) (3.6.6)
Building wheels for collected packages: chainer
  Building wheel for chainer (setup.py) ... done
  Created wheel for chainer: filename=chainer-7.0.0-cp27-none-any.whl size=966689 sha256=5d7d792512b88770a53c52e193fd05d6d1e3d978e4c7e8f6dcd1abc6980ea5ed
  Stored in directory: /tmp/pip-ephem-wheel-cache-MwgxDb/wheels/42/ab/c8/d723d9d7a08b5649c7343f113e74c729d4a1bd5d96e349294b
Successfully built chainer
Installing collected packages: chainer
Successfully installed chainer-7.0.0
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
$ python -c 'import chainer'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/pazeshun/.local/lib/python2.7/site-packages/chainer/__init__.py", line 10, in <module>
    from chainer import backends  # NOQA
  File "/home/pazeshun/.local/lib/python2.7/site-packages/chainer/backends/__init__.py", line 1, in <module>
    from chainer.backends import cuda  # NOQA
  File "/home/pazeshun/.local/lib/python2.7/site-packages/chainer/backends/cuda.py", line 77
    def shape(self) -> types.Shape:
                    ^
SyntaxError: invalid syntax

This situation easily causes mistakes of installing incompatible versions. In addition, this is problem when using ROS. In ROS, we want to resolve all dependency with rosdep install command, but its philosophy is like apt and it doesn’t have a method to specify install version. http://wiki.ros.org/ROS/Tutorials/rosdep (Now we are working on making exceptions of Python packages in that philosophy, but the discussion doesn’t advance: https://github.com/ros-infrastructure/rosdep/pull/694)

I know released version cannot be overwritten, https://stackoverflow.com/questions/21064581/how-to-overwrite-pypi-package-when-doing-upload-from-command-line so solutions I know are the following:

  • Release Python 2 compatible version to chainer>=7.0.0 (very strange solution)
  • Remove chainer>=7.0.0 released before #8517 (very drastic solution)

I know this is difficult problem, but hope this is solved.

cf. https://github.com/chainer/chainer/pull/8517#issuecomment-576128957

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
knorth55commented, Jan 13, 2021

I checked with pip 20.3.3 and it correctly install 6.7.0 for python2! Thank you so much!

[knorth55][melodic-p50][~]
$ sudo pip install chainer
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 pip 21.0 will remove support for this functionality.
WARNING: The directory '/home/knorth55/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting chainer
  Downloading chainer-6.7.0.tar.gz (876 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 876 kB 8.3 MB/s
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages (from chainer) (44.1.1)
Requirement already satisfied: typing<=3.6.6 in /usr/local/lib/python2.7/dist-packages (from chainer) (3.6.6)
Requirement already satisfied: typing_extensions<=3.6.6 in /usr/local/lib/python2.7/dist-packages (from chainer) (3.6.6)
Requirement already satisfied: filelock in ./.local/lib/python2.7/site-packages (from chainer) (3.0.12)
Requirement already satisfied: numpy>=1.9.0 in ./.local/lib/python2.7/site-packages (from chainer) (1.16.6)
Requirement already satisfied: protobuf>=3.0.0 in /usr/local/lib/python2.7/dist-packages (from chainer) (3.14.0)
Requirement already satisfied: six>=1.9.0 in ./.local/lib/python2.7/site-packages (from chainer) (1.15.0)
Building wheels for collected packages: chainer
  Building wheel for chainer (setup.py) ... done
  Created wheel for chainer: filename=chainer-6.7.0-py2-none-any.whl size=885949 sha256=7f3777ae2f0a8a8df8601251eeb9e58725b81259fce41fbdbfbc722555d83a4d
  Stored in directory: /tmp/pip-ephem-wheel-cache-OXXzyg/wheels/2a/79/8c/a36c747a259e068df041501f6101135c04edb121df2876499e
Successfully built chainer
Installing collected packages: chainer
Successfully installed chainer-6.7.0
[knorth55][melodic-p50][~]
$ pip --version
pip 20.3.3 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
0reactions
kmaehashicommented, Jan 13, 2021

@pazeshun Thanks for the feedback! As for cupy-cuda* packages, I think it’s reasonable to simply remove Python 2.7 wheels from PyPI, but unfortunately for cupy sdist package I would like to avoid releasing post releases for v7 series which is no longer maintained.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sunsetting Python 2
As of January 1st, 2020 no new bug reports, fixes, or changes will be made to Python 2, and Python 2 is no...
Read more >
There are incompatible versions in the resolved dependencies
I'm trying to run this on my raspberry pi (running raspbian), and it is the back-end python app where the issue lies. Any...
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 >
The final Python 2 release marks the end of an era
Python is currently at version 3.8.2, as version 3 has been in active development since 2008. But because the two versions were incompatible...
Read more >
Python 2 Vs. Python 3: Key Difference Between 2.x & 3.x
This version was mainly released to fix problems that exist in Python 2. The nature of these changes is such that Python 3...
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