Page 1 of 1

Re: pytz

Posted: Wed Jan 15, 2014 5:16 pm
by DougieLawson
sudo apt-get install python{,3}-pip
sudo pip install pytz # for python 2
sudo pip3 install pytz # for python 3

Re: pytz

Posted: Wed Jan 15, 2014 6:03 pm
by croston
It should be pip-3.2 not pip3.

Re: pytz

Posted: Thu Jan 16, 2014 12:52 pm
by paddyg
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

Re: pytz

Posted: Thu Jan 16, 2014 4:02 pm
by paddyg
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!

Re: pytz

Posted: Tue Jan 21, 2014 3:58 pm
by paddyg
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.