Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Be able to install python bindings from Github using pip #6470

Closed
motin opened this issue Oct 2, 2018 · 4 comments
Closed

[FR] Be able to install python bindings from Github using pip #6470

motin opened this issue Oct 2, 2018 · 4 comments

Comments

@motin
Copy link
Contributor

motin commented Oct 2, 2018

TL;DR
Due to the way we build this project you can't install from Github. You will either need to use the version on pypi or clone the repo and follow the build steps.

Long version
We are currently dependent on this pending PR: #6463, thus we have added the following to requirements.txt:

-e git://github.com/motin/selenium.git@add-python-client-support-for-webextensions-in-firefox#egg=selenium&subdirectory=py

This however results in a broken package, yielding errors like:

__________________________________ ERROR ... __________________________________
...
.tox/py36/src/selenium/py/selenium/webdriver/__init__.py:18: in <module>
    from .firefox.webdriver import WebDriver as Firefox  # noqa
.tox/py36/src/selenium/py/selenium/webdriver/firefox/webdriver.py:29: in <module>
    from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
.tox/py36/src/selenium/py/selenium/webdriver/remote/webdriver.py:26: in <module>
    from .webelement import WebElement
.tox/py36/src/selenium/py/selenium/webdriver/remote/webelement.py:43: in <module>
    getAttribute_js = pkgutil.get_data(_pkg, 'getAttribute.js').decode('utf8')
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py:591: in get_data
    return loader.get_data(resource_name)
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py:255: in get_data
    return open(pathname, "rb").read()
E   IOError: [Errno 2] No such file or directory: '.../.tox/py36/src/selenium/py/selenium/webdriver/remote/getAttribute.js'

Meta -

OS: OSX
Selenium Version: PR

Expected Behavior -

No difference in behavior or functionality than when not installed directly from github.

Actual Behavior -

Selenium runs into issue with missing files in the package.

Steps to reproduce -

  1. Install python bindings from Github using pip:
pip install -e git://github.com/SeleniumHQ/selenium.git#egg=selenium&subdirectory=py
  1. Attempt to use selenium in your project as usual, for instance access the remote webdriver:
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver

Notes

The same error has previously been observed here and here.

It is possible to workaround this by followed the build instructions here
https://github.com/SeleniumHQ/selenium/wiki/Python-Bindings#development
and then manually copying the built package contents to the site-packages/selenium/ folder.

@motin motin changed the title Installing python bindings from Github using pip results in broken package (IOError: [Errno 2] No such file or directory: .../src/selenium/py/selenium/webdriver/remote/getAttribute.js Installing python bindings from Github using pip results in broken package (IOError: [Errno 2] No such file or directory: .../src/selenium/py/selenium/webdriver/remote/getAttribute.js) Oct 2, 2018
@AutomatedTester
Copy link
Member

Unfortunately due to the way we build this project you can't install from Github. You will either need to use the version on pypi or clone the repo and follow the build steps.

@motin
Copy link
Contributor Author

motin commented Oct 2, 2018

Unfortunately due to the way we build this project you can't install from Github. You will either need to use the version on pypi or clone the repo and follow the build steps.

This is a very good summary of the issue, thanks for the TLDR description. Edited the original post to include it for clarity.

@AutomatedTester Not sure why the issue was closed though? Should I file another issue specifically for setup.py to support the relevant commands necessary to install a package from source? Or are you saying that it is impossible or very difficult to make that happen?

Thanks again for clarifying.

@motin motin changed the title Installing python bindings from Github using pip results in broken package (IOError: [Errno 2] No such file or directory: .../src/selenium/py/selenium/webdriver/remote/getAttribute.js) [FR] Be able to install python bindings from Github using pip Oct 2, 2018
@AutomatedTester
Copy link
Member

This is not something that I feel the python library should support. The repo is a monorepo so has code for different languages and has build targets that rely on each other. If this was a purely a python project we could totally do this.

If you're wanting to have this work, and are happy to do the leg work of getting it working and then handling the maintenance then we can see about adding it. It would require custom commands support to call our build tool, which it would also need to handle it being downloaded before being run

@motin
Copy link
Contributor Author

motin commented Oct 2, 2018

Thanks for the explanation. I fully understand. We will add some instructions on the need for building from source manually and using the built package while we wait for the PR to become part of a future release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants