Search code examples
python-3.xfirefoxpipubuntu-16.04firefox-marionette

Error installing Firefox 'marionette_driver' python package


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.


Solution

  • 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.