mukulhase / WebWhatsapp-Wrapper

An API for sending and receiving messages over web.whatsapp [Working as of 18th May 2018]
https://webwhatsapi.readthedocs.io/en/latest/
MIT License
2.03k stars 796 forks source link

Error on docker fresh install: urllib2 Name or service not known #296

Open NarinLab opened 6 years ago

NarinLab commented 6 years ago

Hello, thanks for the great project. But i have error when following the docker install tutorial (fresh install on Raspbian Stretch - latest version using docker and exactly as written on the readme), and since i'm new to docker, i don't know how to troubleshoot this name error issues on urllib. May be a network or dns problem, i don't know how to check the docker environment.

Please help.

pi@krishna:~/docker/WebWhatsapp-Wrapper $ docker run --network selenium -it -e SELENIUM='http://firefox:4444/wd/hub' -v $(pwd):/app  webwhatsapi /bin/bas
h -c "pip install ./;pip list;python sample/remote.py"
Processing /app
Requirement already satisfied: python-dateutil>=2.6.0 in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (2.7.3)
Requirement already satisfied: selenium>=3.4.3 in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (3.12.0)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (1.11.0)
Requirement already satisfied: python-axolotl in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (0.1.42)
Requirement already satisfied: cryptography in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (2.2.2)
Requirement already satisfied: python-axolotl-curve25519 in /usr/local/lib/python2.7/site-packages (from python-axolotl->webwhatsapi==2.0.3) (0.4.1.post2)
Requirement already satisfied: protobuf>=3.0.0.b2 in /usr/local/lib/python2.7/site-packages (from python-axolotl->webwhatsapi==2.0.3) (3.6.0)
Requirement already satisfied: idna>=2.1 in /usr/local/lib/python2.7/site-packages (from cryptography->webwhatsapi==2.0.3) (2.7)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/local/lib/python2.7/site-packages (from cryptography->webwhatsapi==2.0.3) (0.24.0)
Requirement already satisfied: cffi>=1.7 in /usr/local/lib/python2.7/site-packages (from cryptography->webwhatsapi==2.0.3) (1.11.5)
Requirement already satisfied: enum34 in /usr/local/lib/python2.7/site-packages (from cryptography->webwhatsapi==2.0.3) (1.1.6)
Requirement already satisfied: ipaddress in /usr/local/lib/python2.7/site-packages (from cryptography->webwhatsapi==2.0.3) (1.0.22)
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/site-packages (from protobuf>=3.0.0.b2->python-axolotl->webwhatsapi==2.0.3) (39.1.0)
Requirement already satisfied: pycparser in /usr/local/lib/python2.7/site-packages (from cffi>=1.7->cryptography->webwhatsapi==2.0.3) (2.18)
Building wheels for collected packages: webwhatsapi
  Running setup.py bdist_wheel for webwhatsapi ... done
  Stored in directory: /tmp/pip-ephem-wheel-cache-VyaFjw/wheels/4b/1c/59/a69d3cb46a693578104e640ef6e42bbb128292df4586f1cb10
Successfully built webwhatsapi
Installing collected packages: webwhatsapi
Successfully installed webwhatsapi-2.0.3
Package                   Version
------------------------- -----------
asn1crypto                0.24.0
cffi                      1.11.5
cryptography              2.2.2
enum34                    1.1.6
idna                      2.7
ipaddress                 1.0.22
numpy                     1.14.5
pip                       10.0.1
protobuf                  3.6.0
pycparser                 2.18
python-axolotl            0.1.42
python-axolotl-curve25519 0.4.1.post2
python-dateutil           2.7.3
selenium                  3.12.0
setuptools                39.1.0
six                       1.11.0
typing                    3.6.4
virtualenv                15.2.0
webwhatsapi               2.0.3
wheel                     0.31.0
Environment {'LANG': 'C.UTF-8', 'PYTHONIOENCODING': 'UTF-8', 'TERM': 'xterm', 'GPG_KEY': 'C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF', 'PYTHON_VERSION': '2.7.15', 'SHLVL': '1', 'PYTHON_PIP_VERSION': '10.0.1', 'HOSTNAME': 'b68130285a8f', 'SELENIUM': 'http://firefox:4444/wd/hub', 'PWD': '/app', 'PATH': '/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'HOME': '/root', '_': '/usr/local/bin/python'}
Traceback (most recent call last):
  File "sample/remote.py", line 12, in <module>
    driver = WhatsAPIDriver(client='remote', command_executor=os.environ["SELENIUM"])
  File "/usr/local/lib/python2.7/site-packages/webwhatsapi/__init__.py", line 216, in __init__
    **extra_params
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 156, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 245, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 472, in execute
    return self._request(command_info[0], url, body=data)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 534, in _request
    resp = opener.open(request, timeout=self._timeout)
  File "/usr/local/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/local/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/local/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python2.7/urllib2.py", line 1228, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/local/lib/python2.7/urllib2.py", line 1198, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>
kevinkit commented 6 years ago

I am not quite sure if this project will work on a raspberry pi due to some missing libs etc. Sorry for being so vague, but this could be an issue - you could try to change to ubuntu mate (which may provide some more libs in comparison to stretch)

zafai commented 6 years ago

Try to run the docker command like this:

docker run --network selenium -it -e SELENIUM=http://firefox:4444/wd/hub -v $(pwd):/app webwhatsapi /bin/bash -c "pip install ./;pip list;python sample/remote.py"

NarinLab commented 6 years ago

Hello,

thanks for replying. I found another info after running some check:

docker start -ai firefox

giving me

standard_init_linux.go:190: exec user process caused "exec format error"

I think there is problem with compatibility of Firefox stuff with Pi, so the docker container failed to start.

NarinLab commented 6 years ago

After doing more deep check, I can conclude this version of docker to be too problematic on Raspbian Stretch (architecture problem - totally not compatible). Mainly the firefox and selenium stuff.

Solution for now, I will try to switch OS to Ubuntu Mate 16.04.2. Its look more promising, although there is no guarantee that Firefox and selenium docker stuff will 100% work on that platform (ARMv7). I give try, and will back.

OJ7 commented 6 years ago

Seeing the same issue when running on fresh Docker install on Mac OS 10.13.5

Elintondm commented 4 years ago

The same error here.

I think it is related to python version.

RotemAkerman commented 3 years ago

After doing more deep check, I can conclude this version of docker to be too problematic on Raspbian Stretch (architecture problem - totally not compatible). Mainly the firefox and selenium stuff.

Solution for now, I will try to switch OS to Ubuntu Mate 16.04.2. Its look more promising, although there is no guarantee that Firefox and selenium docker stuff will 100% work on that platform (ARMv7). I give try, and will back.

Almost 2 years later, I get the same errors on Pi4 with python3.8 and latest Pi os.