1

Error installing Mozilla automation client 'marionette_driver'.

Mozilla documentation says to install with the following command:

$ pip install marionette_driver

This produces an error:

Collecting marionette_driver
  Downloading marionette_driver-2.2.0.tar.gz
Collecting mozrunner>=6.13 (from marionette_driver)
  Downloading mozrunner-6.13.tar.gz (67kB)
    100% |████████████████████████████████| 71kB 1.5MB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-0829rk11/mozrunner/setup.py", line 24, in
<module>
        assert sys.version_info[0] == 2
    AssertionError

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
/tmp/pip-build-0829rk11/mozrunner/

These variations of the pip install command produce the same error.

$ sudo pip install marionette_driver
$ sudo -H pip install marionette_driver
$ pip3 install marionette_driver
$ sudo pip3 install marionette_driver
$ sudo -H pip3 install marionette_driver

(debian systems seem to require pip3 to install python3 packages, while it has been suggested the egg_info error can be avoided by using sudo -H. seems to make no difference.)

I have both Python 2.7 and 3.5 installed. I would normally expect pip to install python 2 packages. But I use 3.5, so what do I know? Anyway, the same error occurs using pip and pip3.

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
markling
  • 1,232
  • 1
  • 15
  • 28
  • 1
    `assert sys.version_info[0] == 2` means that it can only be installed for Python 2.x. – Mad Physicist Apr 11 '17 at 17:31
  • 1
    However, the error occurs in `mozrunner`, which appears to be a dependency of the package you need. Perhaps try finding a Py3-compatible version of `mozrunner` first. – Mad Physicist Apr 11 '17 at 17:32
  • Thank you for teaching me to read my error messages, Mad Phys. I must confess, I went a bit blurry-eyed over it. You hit the nail on the head. I have pursued your suggestion in Google and - indeed - mozunner and 8 other Mozilla 'moz' packages seem, bizarrely and archaically, to be the almost the only ones among the top 200 most used python packages that have not been converted to Python 3. (reference: https://python3wos.appspot.com). – markling Apr 11 '17 at 18:50

1 Answers1

2

The error occurs when you install the mozrunner dependency of marionette_driver. The error message indicates that it is checking that it is running on Python version 2.x (assert sys.version_info[0] == 2), which fails as you would expect. Unfortunately, at time of writing, there is not Python 3 compatible version of mozrunner, so it looks like you will not be able to install marionette_driver for Python 3.

If you are using virtual environments (e.g. with virtualenv, anaconda, or similar), you should be able to create a Python 2 environment and install it there with pip.

Also, on most Unix-like systems, you can install both Python 2 and 3. Usually, the executables will be called python2 and python3, with one of them sym-linked to the default python. The same goes for the corresponding pip2 and pip3 executables. You may have better luck running your installation via pip2, if you have Python 2 installed on your system.

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264