User avatar
DougieLawson
Posts: 39301
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: pytz

Wed Jan 15, 2014 5:16 pm

sudo apt-get install python{,3}-pip
sudo pip install pytz # for python 2
sudo pip3 install pytz # for python 3
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
croston
Posts: 708
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: pytz

Wed Jan 15, 2014 6:03 pm

It should be pip-3.2 not pip3.

User avatar
paddyg
Posts: 2555
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: pytz

Thu Jan 16, 2014 12:52 pm

Although the pip system should make installing python modules easy, sometimes I wonder! I suppose all the horrible things about installing with python boil down to it having to work on 'any' operating system but among all the pip-Xyz, distutils, easy_install, various egg related things and setup.py install it's quite hard to figure out what's supposed to be happening!

For a python only package like this (i.e. I don't think pytz needs anything to be compiled) the main objective is to get the source files into /usr/local/lib/python2.7/dist-packages/ (or .../python3.2/.. etc) after doing that using 'import pytz' will work as the dist-packages path will be in the python{3} path accordingly.

If the pip-3.2 install hasn't worked properly you could try pip-3.2 uninstall and doing it again which sometimes works. If you've got the egg file there you could try going to the relevant directory and $ easy_install pytz-2013.9-py3.2.egg Or you could download pytz-2013.9.tar.gz from https://pypi.python.org/pypi/pytz/#downloads expand it on your pi, go to the directory with setup.py in then run $ python3 setup.py install
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
paddyg
Posts: 2555
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: pytz

Thu Jan 16, 2014 4:02 pm

Yes you might need to

Code: Select all

$ sudo easy_install xyz
or
$ sudo pip-3.2 install xyz
or
$ cd extracted_xyz_targz_directory
$ sudo setup.py install
as the program needs to be able to write to those root only directories

I've used pip and the normal $ python3 setup.py install but never eggs or easy_install so I'm not sure about all the things that can go wrong with them!
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
paddyg
Posts: 2555
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: pytz

Tue Jan 21, 2014 3:58 pm

You certainly have every right to take your bat home; very frustrating. One last thing I would try is to download the tar.gz file from the pypi.python.org link above, extract it into your home folder (so you have /home/pi/pytz-2013.9 with the directory pytz inside it representing the module) Add a simple test script inside the pytz-2013.9 directory and it should be able to import pytz as it's a subdirectory with the required __init__.py etc. I certainly seem to be able to import it on this ubuntu laptop. If you're happy to do whatever you want to do in that directory that's fine but if you want to make pytz generally available you could then try the ''python3 setup.py install" from that same directory.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

Return to “Python”