0
votes

I'm trying to get the Amazon Glacier tools running on Debian (Wheezy, and not exactly -- I'm running OpenMediaVault). I've got Python 2.6, 2.7 and 3.2 installed.

glacier-cmd wants the 'pytz' package, so I obliged using -pip-:

root@srvr:/# pip install pytz
Collecting pytz
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading pytz-2015.4-py2.py3-none-any.whl (475kB)
    100% |████████████████████████████████| 475kB 469kB/s 
Installing collected packages: pytz
Successfully installed pytz-2015.4

OK, looks like success. So, I ran -glacier-cmd without arguments:

root@srvr:/# glacier-cmd
Traceback (most recent call last):
  File "/usr/local/bin/glacier-cmd", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2707, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pytz

Really? Seems like it's installed... Let's try again, with pip2.7:

root@srvr:/# pip2.7 install pytz
Requirement already satisfied (use --upgrade to upgrade): pytz in /usr/local/lib/python2.7/dist-packages
root@srvr:/# pip2.7 install pytz --upgrade
Requirement already up-to-date: pytz in /usr/local/lib/python2.7/dist-packages
root@srvr:/# which pip
/usr/local/bin/pip
root@srvr:/# which pip2.7
/usr/local/bin/pip2.7

OK, those last two commands were superfluous but I was getting paranoid. I tried again:

root@srvr:/# glacier-cmd Traceback (most recent call last): File "/usr/local/bin/glacier-cmd", line 5, in from pkg_resources import load_entry_point File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2707, in working_set.require(requires) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve raise DistributionNotFound(req) pkg_resources.DistributionNotFound: pytz

I'm stumped. I ran python interactively and -pytz- imports and seems to work fine!

root@srvr:/# python
Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
- import sys
- print sys.path
['', '/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/prettytable-0.7.2-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/boto-2.38.0-py2.7.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7']
-  import pytz
-  from pytz import timezone
-  utc=pytz.utc
-  utc.zone
'UTC'
-  exit()

... but when I call it thusly it continues to fail:

root@srvr:/# glacier-cmd
Traceback (most recent call last):
  File "/usr/local/bin/glacier-cmd", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2707, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pytz

I'm running as the same user throughout. I even gave up and ran continuously as root.

1

1 Answers

0
votes

You have two different Python installations on your computer:

  /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.

is

  /usr/local/lib/python2.7/

And

  /usr/local/bin/glacier-cmd

is

  /usr/lib/python2.7/

Use your distribution provided pip package and not /usr/local/bin/pip to install pytz and then glacier-cmd should see it. Or even better install pytz from a distribution package if you plan use with a command installed to the system-wide Python installation.

Alternatively build virtualenv where you install both the command the package (recommended). See Python package installation documentation.