[Tutor] can't install

2013-12-24 Thread Lolo Lolo
ive struggled all day to install pip on ubuntu 12.04 for python 3.3 . The only 
pip in the apt-get cache is for python 2. i tried to download pip from source 
but setuptools is missing when it tries to import it. This made me download 
setuptools with apt-get but the version there is only for python 3.2 I've also 
download the distribute_setup.py file to get pip through easy_install but it 
returns errors when it uses urllib.request. Something to do with https, 
although the same distribute_setup.py worked perfectly when i used it on 
windows for 3.1 and 3.3.

This all started because i wanted to use virtualenv. After installing it i 
couldn't use it cos it needed zlib which i didn't have. apt-get only has zlib 
for python 2.7. 

I'm now at my wit's end. Life was great using windows. Everyone told me try 
ubuntu, now life is so stressful, even on christmas eve:( Any ideas on how to 
solve this issue would be appreciated:(___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Cantor pairing in three dimensions?

2013-12-24 Thread Brian van den Broek
On 23 December 2013 13:32, Danny Yoo d...@hashcollision.org wrote:

 I've got a puzzle: so there's a well-known function that maps the
 naturals N to N^2: it's called Cantor pairing:

 http://en.wikipedia.org/wiki/Pairing_function

 It's one of those mind-blowing things that I love.  I ran across it a
 few years ago in a thread on Python-tutor a few years back:

 https://mail.python.org/pipermail/tutor/2001-April/004888.html


 Recently, the topic came up again for me, but in an expanded context:

 https://plus.google.com/117784658632980303930/posts/4SMcjm2p9vv


 So here's the question: is there an analogy of the Cantor pairing
 function that maps N to N^3?



Hi Danny,

It does generalize; a well known result of set theory has it that the
Cartesian product of finitely many countable sets is itself countable
(where countable means either finite or infinite but able to be mapped
1:1 to the natural numbers). Here's a hand-wavy proof sketch that
assumes we've already got the map N - N^2:

Given a map from N - N^m we can easily create a new map N - N^(m+1):
replicate the grid from
http://en.wikipedia.org/wiki/File:Pairing_natural.svg (the diagram
in the wiki page that you linked to), with the natural numbers along
the x-axis replaced by the members of N^m. Now, follow the same
procedure that was used to demonstrate the existence of the map N -
N^2. The resulting function is a map N - N^(m + 1), as desired.

Best,

Brian vdB
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] can't install

2013-12-24 Thread Steven D'Aprano
On Tue, Dec 24, 2013 at 11:15:36AM -0800, Lolo Lolo wrote:

 ive struggled all day to install pip on ubuntu 12.04 for python 3.3 . 

All your questions are really about the Ubuntu packaging system, not 
learning Python. You may have better answers from an Ubuntu forum. I 
fear that the best I can give you is sympathy. Perhaps an Ubuntu user 
will be more useful.

But the good news is that all this should become history from Python 3.4 
onwards, there are plans to include pip in 3.4.


-- 
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] can't install

2013-12-24 Thread Tobias M.

On 24.12.2013 20:15, Lolo Lolo wrote:
ive struggled all day to install pip on ubuntu 12.04 for python 3.3 . 
The only pip in the apt-get cache is for python 2. i tried to download 
pip from source but setuptools is missing when it tries to import it. 
This made me download setuptools with apt-get but the version there is 
only for python 3.2 I've also download the distribute_setup.py file to 
get pip through easy_install but it returns errors when it uses 
urllib.request. Something to do with https, although the same 
distribute_setup.py worked perfectly when i used it on windows for 3.1 
and 3.3.

I guess I just had the same problem.
Is this the error you get when executing distribute_setup.py?

urllib.error.URLError: urlopen error unknown url type: https

If yes, Python3.3 is missing ssl support. You can build python from 
source to get ssl support. Before doing so, you must make sure ssl is 
installed on your system:


sudo apt-get install libssl-dev

Then you download the python sources and do:

./configure --prefix=prefix

where prefix is a custom path (e.g. in your home directory) where you 
want to install python. You can configure without the --prefix option, 
but if you just want to use this python installation for virtuelenvs I 
would install it separate from the rest of the system.


Then you can build and install Python:

make
make install

Note that after the first make a list of modules that were not build is 
displayed. '_ssl' should NOT be listed.


Then you can create a virtualenv with your custom python build and 
should be able to install easy_install with distribute_setup.py:


prefix/bin/pyvenv ~/my_venv
source ~/my_venv/bin/activate
wget python-distribute.org/distribute_setup.py
python distribute_setup.py

I don't know if there is a better way to get a virtual environment with 
python3.3 and ssl support in Ubuntu, but this worked for me :)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor