aldebaran/qibuild

test_venv_path test seems to fail because it is installing an incompatible version of IPython

Closed this issue · 4 comments

Starting from IPython6.0+, Python 2.7 is not supported anymore.

The test fail when trying to install remote_packages in python/qipy/venv.py configure_virtualenv function (master).

   if remote_packages:
        cmd = [pip_binary, "install"]
        if not ui.CONFIG["verbose"]:
            cmd.append("--quiet")
        cmd.extend(remote_packages)
        rc = qisys.command.call(cmd, ignore_ret_code=True, env=env)
        remote_ok = (rc == 0)
    if not pure_python_ok:
        ui.info(ui.red, "Failed to add some python projects")
    if not remote_ok:
        ui.info(ui.red, "Failed to add some third party requirements")

to verify this, just set ignore_ret_code to False

IMHO, it seems that the ui.info, should be ui.error

Here is the error captured when allowing the command call to except:

Collecting ipython
  Using cached ipython-6.2.1.tar.gz
    IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
    When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
    Beginning with IPython 6.0, Python 3.3 and above is required.
    See IPython `README.rst` file for more information:
        https://github.com/ipython/ipython/blob/master/README.rst
    Python sys.version_info(major=2, minor=7, micro=10, releaselevel='final', serial=0) detected.
    Your pip version is out of date, please install pip >= 9.0.1. pip 6.0.8 detected.
    Complete output from command python setup.py egg_info:


    IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.

    When using Python 2.7, please install IPython 5.x LTS Long Term Support version.

    Beginning with IPython 6.0, Python 3.3 and above is required.



    See IPython `README.rst` file for more information:



        https://github.com/ipython/ipython/blob/master/README.rst



    Python sys.version_info(major=2, minor=7, micro=10, releaselevel='final', serial=0) detected.

    Your pip version is out of date, please install pip >= 9.0.1. pip 6.0.8 detected.

Same problem on branch next

A quick (and maybe dirty..) way to fix this could be to patch the default ipython requirement in configure_parser

def configure_parser(parser):
    qibuild.parsers.cmake_build_parser(parser)
    parser.add_argument("requirements", nargs="*")
    parser.add_argument("--no-site-packages", action="store_false",
                        dest="site_packages",
                        help="Do not allow access to global `site-packages` "
                             "directory")
    parser.add_argument("-p", "--python",
                        help="The Python interpreter to use")
    parser.set_defaults(requirements=["pip", "virtualenv", "ipython<6"],
                        site_packages=True)

for some reason, I don't understand why I don't encounter the same behavior that I observe on my environment.

With a 2.7 env, I always get IPython 5.5.0

Tested on my side whith this fix

Here is the corresponding travis build

it seems to fix all the unit tests on branch next

It's an acceptable workaround for me.
There is indeed a strange bug with the test environment, I can't reproduce either

It's probably because of poor pip cache, see in the log: Using cached ipython-6.2.1.tar.gz

That's because we run the tests for python3 and python2 on the same machine, and there may be only one cache, so that it takes the latest version cached without checking compatibility.
Maybe upgrading pip on the test machine like suggested by the message could solve the issue.