Bug#769685: awscli: FTBFS: ImportError: Failed to import test module: awscli.testutils
Greetings, The primary bug reported here is still present -- awscli seems quite broken in sid -- and the proposed resolution works. On a very clean and up to date Debian sid system: $ dpkg -l | grep awscli ii awscli 1.5.5-1 all Universal Command Line Environment for AWS $ aws Traceback (most recent call last): File /usr/bin/aws, line 15, in module import awscli.clidriver File /usr/share/awscli/awscli/clidriver.py, line 16, in module import botocore.session File /usr/lib/python3/dist-packages/botocore/session.py, line 29, in module from botocore.endpoint import EndpointCreator File /usr/lib/python3/dist-packages/botocore/endpoint.py, line 28, in module from botocore.awsrequest import AWSRequest File /usr/lib/python3/dist-packages/botocore/awsrequest.py, line 27, in module from requests.packages.urllib3.connection import HTTPConnection ImportError: cannot import name 'HTTPConnection' $ sudo sed -i -e s/^from requests.packages./from / /usr/lib/python3/dist-packages/botocore/awsrequest.py $ aws usage: aws [options] command subcommand [parameters] aws: error: the following arguments are required: command Regarding the second item raised by Tom, the failure of the command: $ aws --debug --region us-east-1c ec2 describe-instances This command fails because `us-east-1c` is an availability zone, not a region. Using `us-east-1` here instead works fine. Cheers, -- TC -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#769685: awscli: FTBFS: ImportError: Failed to import test module: awscli.testutils
Supposedly #769496 fixed this bug, but I continued to have troubles with 'aws' (from package 'awscli'). I suspect the 'monkey patch' fix is very sensitive to import order (?) I partial fix was to make this change in /usr/lib/python3/dist-packages/botocore/awsrequest.py #from requests.packages.urllib3.connection import HTTPConnection #from requests.packages.urllib3.connectionpool import HTTPConnectionPool #from requests.packages.urllib3.connectionpool import HTTPSConnectionPool from urllib3.connection import HTTPConnection from urllib3.connectionpool import HTTPConnectionPool from urllib3.connectionpool import HTTPSConnectionPool HOWEVER aws is still having some other troubles (which may or may not be related to this bug). Regards, --Tom $ aws --debug --region us-east-1c ec2 describe-instances [...] 2014-11-17 11:45:03,723 - MainThread - botocore.endpoint - DEBUG - Exception received when sending HTTP request. Traceback (most recent call last): File /usr/lib/python3/dist-packages/urllib3/connectionpool.py, line 516, in urlopen body=body, headers=headers) File /usr/lib/python3/dist-packages/urllib3/connectionpool.py, line 304, in _make_request self._validate_conn(conn) File /usr/lib/python3/dist-packages/urllib3/connectionpool.py, line 724, in _validate_conn conn.connect() File /usr/lib/python3/dist-packages/urllib3/connection.py, line 203, in connect conn = self._new_conn() File /usr/lib/python3/dist-packages/urllib3/connection.py, line 133, in _new_conn (self.host, self.port), self.timeout, **extra_kw) File /usr/lib/python3/dist-packages/urllib3/util/connection.py, line 64, in create_connection for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM): File /usr/lib/python3.4/socket.py, line 534, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Name or service not known -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#769685: awscli: FTBFS: ImportError: Failed to import test module: awscli.testutils
Hello Tom, many thanks for let me know of this! On Monday 17 November 2014 11:59:38 Tom Marble wrote: Supposedly #769496 fixed this bug, but I continued to have troubles with 'aws' (from package 'awscli'). I suspect the 'monkey patch' fix is very sensitive to import order (?) It should not to be sensitive to import order, but I will investigate better also this. I partial fix was to make this change in /usr/lib/python3/dist-packages/botocore/awsrequest.py #from requests.packages.urllib3.connection import HTTPConnection This import is not working and I will investigate why. It's of course related to the patch but it's a bit strange: import requests.packages.urllib3.connection dir(requests.packages.urllib3.connection) ['BaseSSLError', 'ConnectTimeoutError', 'ConnectionError', 'DummyConnection', 'HTTPConnection', 'HTTPException', 'HTTPSConnection', 'RECENT_DATE', 'SocketTimeout', 'SystemTimeWarning', 'UnverifiedHTTPSConnection', 'VerifiedHTTPSConnection', '_HTTPConnection', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 'assert_fingerprint', 'connection', 'datetime', 'match_hostname', 'port_by_scheme', 'resolve_cert_reqs', 'resolve_ssl_version', 'six', 'socket', 'ssl', 'ssl_wrap_socket', 'sys', 'warnings'] requests.packages.urllib3.connection.HTTPConnection class 'urllib3.connection.HTTPConnection' So the form import is working but not the from ... import. I can't look at this right now, but I will work on it, I hope tomorrow. Feel free to open a serious bug against requests, since the purpose of the monkey patching is to transparently work. Of course, any suggestions are appreciated! :) #from requests.packages.urllib3.connectionpool import HTTPConnectionPool #from requests.packages.urllib3.connectionpool import HTTPSConnectionPool I tried these and they seem to work. from urllib3.connection import HTTPConnection from urllib3.connectionpool import HTTPConnectionPool from urllib3.connectionpool import HTTPSConnectionPool I'm sorry for the more work you had to do, the monkey patch approach was supposed to avoid all of this. HOWEVER aws is still having some other troubles (which may or may not be related to this bug). Regards, --Tom $ aws --debug --region us-east-1c ec2 describe-instances [...] [CUT traceback] socket.gaierror: [Errno -2] Name or service not known This seems to be related on DNS, can you try to simply resolve the host name? Kind regards, -- Daniele Tricoli 'Eriol' http://mornie.org -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#769685: awscli: FTBFS: ImportError: Failed to import test module: awscli.testutils
Source: awscli Version: 1.5.5-1 Severity: serious From my pbuilder build log: ... dh_auto_test -O--buildsystem=pybuild I: pybuild base:170: cd /tmp/buildd/awscli-1.5.5/.pybuild/pythonX.Y_3.4/build; python3.4 -m unittest discover -v awscli.testutils (unittest.loader.ModuleImportFailure) ... ERROR == ERROR: awscli.testutils (unittest.loader.ModuleImportFailure) -- Traceback (most recent call last): File /usr/lib/python3.4/unittest/case.py, line 58, in testPartExecutor yield File /usr/lib/python3.4/unittest/case.py, line 577, in run testMethod() File /usr/lib/python3.4/unittest/loader.py, line 32, in testFailure raise exception ImportError: Failed to import test module: awscli.testutils Traceback (most recent call last): File /usr/lib/python3.4/unittest/loader.py, line 312, in _find_tests module = self._get_module_from_name(name) File /usr/lib/python3.4/unittest/loader.py, line 290, in _get_module_from_name __import__(name) File /tmp/buildd/awscli-1.5.5/.pybuild/pythonX.Y_3.4/build/awscli/testutils.py, line 47, in module from botocore.session import Session File /usr/lib/python3/dist-packages/botocore/session.py, line 29, in module from botocore.endpoint import EndpointCreator File /usr/lib/python3/dist-packages/botocore/endpoint.py, line 28, in module from botocore.awsrequest import AWSRequest File /usr/lib/python3/dist-packages/botocore/awsrequest.py, line 27, in module from requests.packages.urllib3.connection import HTTPConnection ImportError: cannot import name 'HTTPConnection' -- Ran 1 test in 0.001s FAILED (errors=1) E: pybuild pybuild:256: test: plugin distutils failed with: exit code=1: cd /tmp/buildd/awscli-1.5.5/.pybuild/pythonX.Y_3.4/build; python3.4 -m unittest discover -v dh_auto_test: pybuild --test -i python{version} -p 3.4 --dir . returned exit code 13 debian/rules:8: recipe for target 'build' failed make: *** [build] Error 13 dpkg-buildpackage: error: debian/rules build gave error exit status 2 -- Daniel Schepler -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org