1

In brief, pip -vvv install apy reports "Successfully installed ..." even though the verbose output shows that Python fails to compile some of the installed files.

Below are the last lines of the output from pip -vvv install apy (I have removed some blank lines to reduce the listing's height):

... 
  Compiling /tmp/ankivenv/lib/python2.7/site-packages/jinja2/asyncfilters.py ...
    File "/tmp/ankivenv/lib/python2.7/site-packages/jinja2/asyncfilters.py", line 8
      async def auto_to_seq(value):
              ^
  SyntaxError: invalid syntax
  
  Compiling /tmp/ankivenv/lib/python2.7/site-packages/jinja2/asyncsupport.py ...
    File "/tmp/ankivenv/lib/python2.7/site-packages/jinja2/asyncsupport.py", line 18
      async def concat_async(async_gen):
              ^
  SyntaxError: invalid syntax

  changing mode of /tmp/ankivenv/bin/flask to 775

Successfully installed Jinja2-2.11.3 MarkupSafe-1.1.1 Werkzeug-1.0.1 apy-0.2.3 click-7.1.2 flask-1.1.4 httplib2-0.19.1 itsdangerous-1.1.0 oauth2-1.9.0.post1 pyparsing-2.4.7
Removed build tracker: '/tmp/pip-req-tracker-3_mlWH'

Furthermore, after getting the results shown above, I confirmed that python indeed cannot compile the installed versions of the files mentioned in the error messages above. For example:

python -m py_compile /tmp/ankivenv/lib/python2.7/site-packages/jinja2/asyncfilters.py
  File "/tmp/ankivenv/lib/python2.7/site-packages/jinja2/asyncfilters.py", line 8
    async def auto_to_seq(value):
            ^
SyntaxError: invalid syntax

Q: Is this a bug in the version of pip I am using? Or are the errors shown above indeed negligible?


The version of pip I am using for this is 20.3.4, in accordance with the recommendations given in https://stackoverflow.com/a/65871131 . (This is all running under Python 2.7.16.)

If anyone is interested, below I give a bash script that reproduces the results described above.

#!/bin/bash

MYVENV=/tmp/ankivenv

deactivate 2>/dev/null
rm -rf "$MYVENV"

export PYTHONWARNINGS=ignore:DEPRECATION

virtualenv --python=/usr/bin/python2 "$MYVENV" || exit $?
source "$MYVENV/bin/activate" || exit $?

##################################################################
# based on https://stackoverflow.com/a/65871131 ##################
curl -sO https://bootstrap.pypa.io/pip/2.7/get-pip.py || return $?
python get-pip.py || return $?
python -m pip install --upgrade 'pip < 21.0' || return $?
##################################################################

pip -vvv install apy
kjo
  • 33,683
  • 52
  • 148
  • 265
  • 2
    `async` is not supported in 2.7, which is why you're seeing invalid syntax https://stackoverflow.com/questions/54023021/write-an-async-coroutine-thats-python-2-and-3-compatible. – Greg Sep 04 '21 at 13:21
  • 1
    The errors occured during compiling .py files to bytecode .pyc files. Such errors are probably ignored, relying on the fact the interpreter creates missing .pyc automatically. – VPfB Sep 04 '21 at 13:31

0 Answers0