I'm having trouble using the vendor-supplied boto3 on Ubuntu Trusty. Has anyone else run into this issue, and if so how did you resolve?
FWIW, boto3 works fine in a venv on the same machine, so I think this is a packaging issue. I need to make boto3 available on 1000+ machines, so using the vendor-supplied package is desirable.
I tried installing lxml, cssselect, and requests manually as described in How to fix ImportError: No module named packages.urllib3? but that didn't solve the problem.
Thanks,
Jeffrey
vagrant@vagrant-ubuntu-trusty-64:~$ cat /etc/issue
Ubuntu 14.04.3 LTS \n \l
vagrant@vagrant-ubuntu-trusty-64:~$ sudo aptitude install python-boto3
....
vagrant@vagrant-ubuntu-trusty-64:~$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto3
>>> boto3.__version__
'1.2.2'
>>> boto3.resource('s3')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/boto3/__init__.py", line 87, in resource
return _get_default_session().resource(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/boto3/session.py", line 292, in resource
aws_session_token=aws_session_token, config=config)
File "/usr/lib/python2.7/dist-packages/boto3/session.py", line 200, in client
aws_session_token=aws_session_token, config=config)
File "/usr/lib/python2.7/dist-packages/botocore/session.py", line 796, in create_client
client_config=config, api_version=api_version)
File "/usr/lib/python2.7/dist-packages/botocore/client.py", line 59, in create_client
cls = self._create_client_class(service_name, service_model)
File "/usr/lib/python2.7/dist-packages/botocore/client.py", line 76, in _create_client_class
base_classes=bases)
File "/usr/lib/python2.7/dist-packages/botocore/hooks.py", line 226, in emit
return self._emit(event_name, kwargs)
File "/usr/lib/python2.7/dist-packages/botocore/hooks.py", line 209, in _emit
response = handler(**kwargs)
File "/usr/lib/python2.7/dist-packages/boto3/utils.py", line 59, in _handler
module = import_module(module)
File "/usr/lib/python2.7/dist-packages/boto3/utils.py", line 52, in import_module
__import__(name)
File "/usr/lib/python2.7/dist-packages/boto3/s3/inject.py", line 13, in <module>
from boto3.s3.transfer import S3Transfer
File "/usr/lib/python2.7/dist-packages/boto3/s3/transfer.py", line 138, in <module>
from requests.packages.urllib3.exceptions import ReadTimeoutError
ImportError: No module named packages.urllib3.exceptions
On the same machine, installing boto3 in a venv seems to work fine. (At least I'm able to create a ServiceResource() object.)
vagrant@vagrant-ubuntu-trusty-64:~$ virtualenv venv-boto3
New python executable in venv-boto3/bin/python
Installing setuptools, pip...done.
vagrant@vagrant-ubuntu-trusty-64:~$ source venv-boto3/bin/activate
(venv-boto3)vagrant@vagrant-ubuntu-trusty-64:~$ pip install boto3
Downloading/unpacking boto3
Downloading boto3-1.4.4-py2.py3-none-any.whl (127kB): 127kB downloaded
...
(venv-boto3)vagrant@vagrant-ubuntu-trusty-64:~$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto3
>>> boto3.__version__
'1.4.4'
>>> boto3.resource('s3')
s3.ServiceResource()