2.6.1 on ubuntu eee

General discussions related to Python.

Moderators: KDoiron, ChrJim, mawe, python

2.6.1 on ubuntu eee

Postby CryingSaul on Wed Jan 14, 2009 3:43 pm

hi all,

i'm learning python on my osx machine, on which i've installed 2.6.1 and numpy without a hitch. now i've got an eee pc 901 'netbook' on which i would like to test stuff when i'm on the move. i'm new to linux but i'm getting along. the eee is running the special ubuntu 8.10 distribution called 'easy peasy' (ex-ubuntu-eee for those who know what i'm talking about). the version of python that comes with it is 2.5.2. this is a problem since all my 2.6.1 scripts are using 'modern' syntax (mainly string.format(etc)). i figured that learning was better if i kept an eye on 3.0 rather than 2.5.

i could install 2.6.1 using the linux version and going through ./configure, make etc, but i'm afraid of messing things up (i've resintalled ubuntu 10 times already because i didn't know what i was doing). i read somewhere that ubuntu is heavily dependent on python working correctly. when checking available (and official) ubuntu "packages", the latest one available is 2.5. most of the stuff i've installed on my eee has come from either aptitude or synaptic which, as i've learned the hard way, are the way to go if i want a stable system.

i googled for "python repositories" but didn't find anything useful.

could someone please explain, in the most basic terms, what is the safest way to do what i need? i'm especially worried about ubuntu dependencies and stuff like that, which drove me nuts already when different libraries got cross-referenced and wouldn't remove or get reinstalled.

also, any possible problems with numpy i should know about?

thanks a lot.
CryingSaul
New Python User
New Python User
 
Posts: 27
Joined: Wed Dec 10, 2008 12:49 am

Re: 2.6.1 on ubuntu eee

Postby Wacky on Wed Jan 14, 2009 6:12 pm

the version of python that comes with it is 2.5.2. this is a problem since all my 2.6.1 scripts are using 'modern' syntax (mainly string.format(etc)). i figured that learning was better if i kept an eye on 3.0 rather than 2.5.

Good thinking, IMO.

i could install 2.6.1 using the linux version and going through ./configure, make etc, but i'm afraid of messing things up (i've resintalled ubuntu 10 times already because i didn't know what i was doing). i read somewhere that ubuntu is heavily dependent on python working correctly.

I'm tempted to say that "heavily" is an understatement.

when checking available (and official) ubuntu "packages", the latest one available is 2.5. most of the stuff i've installed on my eee has come from either aptitude or synaptic which, as i've learned the hard way, are the way to go if i want a stable system.

:D Yup.

i googled for "python repositories" but didn't find anything useful.

could someone please explain, in the most basic terms, what is the safest way to do what i need? i'm especially worried about ubuntu dependencies and stuff like that, which drove me nuts already when different libraries got cross-referenced and wouldn't remove or get reinstalled.

Compile Python from source and install it locally to your user account. Here's a post explaining how I've done it before. I recommend making a "~/python/x.y" directory, and using that as your installation prefix, so that you can easily have "~/python/2.6/bin/python2.6" alongside "~/python/3.0/bin/python3.0" -- I didn't think of that in the linked post. You'd also need to make the appropriate changes/additions to the ~/.bashrc file.

Your configure would then look like this:

Code: Select all
./configure --prefix=$HOME/python/2.6

also, any possible problems with numpy i should know about?

Now this I don't know about... I'm not sure that I'm sure (...if that makes sense) how to install compiled modules locally without doing lots of things manually. Perhaps "/home/username/python/X.Y/bin/pythonX.Y setup.py install" would get the package's setup.py to use the pythonX.Y binary's paths? I honestly don't know. Maybe you can also specify prefixes for setup.py installers... Someone else might be able to shed light on that.
The plus sign (+) is valid within an email address; please do not
write or suggest code that precludes its use, as many use it as a
"label" to filter incoming mail. </crusade> (Eek! Heresy, Imagist! ;))
Wacky
Python Guru
Python Guru
 
Posts: 673
Joined: Fri Aug 29, 2008 10:40 am
Location: EU

Re: 2.6.1 on ubuntu eee

Postby CryingSaul on Thu Jan 15, 2009 8:42 am

thanks a lot for the detailed reply. i notice that my /usr/local/bin directory is empty, and i wonder if this is not where these kinds of setups are supposed to go, rather than in the home folder. if i use the prefix method you describe but use /usr/local/bin instead, will it affect anything on the system (in a bad way, that is)?

also, in case the python install doesn't do that automatically, is there any danger of changing the symlick 'python' (which i think is in /usr/bin) to point to the new version? or should i create one like 'python26' and always use that? in other words, does ubuntu rely on the 'python' symlink itself?

i found a detailed description of how to customize the setup of additional modules. i'll let you know how numpy behaved if you're interested...

thanks again.
CryingSaul
New Python User
New Python User
 
Posts: 27
Joined: Wed Dec 10, 2008 12:49 am

Re: 2.6.1 on ubuntu eee

Postby Wacky on Thu Jan 15, 2009 9:10 am

CryingSaul wrote:thanks a lot for the detailed reply. i notice that my /usr/local/bin directory is empty, and i wonder if this is not where these kinds of setups are supposed to go, rather than in the home folder.

You're welcome. If the program should be available to all users, then by all means, put it in /usr/local/bin. I just kept it in ~/python/x.y/ so that it was all on my /home partition. Plus it saves headaches having to explain how to fix anything that might be broken on someone else's system after they installed to /usr/local/bin. ;)

I honestly haven't mastered the whys and wherefores behind the Linux filesystem organisational hierarchy, and some distros seem to have different rules, but putting it in ~/ shouldn't break anything, at least.

if i use the prefix method you describe but use /usr/local/bin instead, will it affect anything on the system (in a bad way, that is)?

No, it shouldn't, but I don't know Ubuntu well enough to say for sure. Sorry.

also, in case the python install doesn't do that automatically, is there any danger of changing the symlink 'python' (which i think is in /usr/bin) to point to the new version?

Yes. Don't do that. :D Use your ~/.bashrc instead, so that any system scripts that call /usr/bin/python get the system Python, and any commands you issue from the shell use the newer one (see my previously linked post for details, and by all means ask if it's not clear).

or should i create one like 'python26' and always use that? in other words, does ubuntu rely on the 'python' symlink itself?

I don't know; I suspect it does, but I can't say either way. I'd err on the side of caution. ;)

i found a detailed description of how to customize the setup of additional modules. i'll let you know how numpy behaved if you're interested...

That'd be great, thanks!
The plus sign (+) is valid within an email address; please do not
write or suggest code that precludes its use, as many use it as a
"label" to filter incoming mail. </crusade> (Eek! Heresy, Imagist! ;))
Wacky
Python Guru
Python Guru
 
Posts: 673
Joined: Fri Aug 29, 2008 10:40 am
Location: EU

Re: 2.6.1 on ubuntu eee

Postby CryingSaul on Thu Jan 15, 2009 2:03 pm

ok, some news from the front (btw, thanks for the link to your other post which clarified things a lot). i seem to have got this working. i just hope ubuntu isn't messed up, but it looks ok. here's what i did:

    get the 2.6.1 source tar
    ./configure --prefix=/usr/local
    make
    sudo make install

at this point, 'which python' reported '/usr/local/bin/python' which had me worrying. but i figured that it was because $PATH starts with '/usr/local/sbin:/usr/local/bin...', although i am definitely not sure about that. typing 'python' starts 2.6.1 without any edits to the ~/.bashrc file as you suggested, so i left it alone.

then:


this seems to work fine too, although i can't run the numpy self test because it needs nose, which in turns needs setuptools. i didn't want to do 'sudo apt-get install python-setuptools' because i didn't know what will go where, so instead i ran a couple of basic numpy commands which worked ok. i suppose that if there was a problem, 'import numpy' would have barked at me.

i hope i haven't messed up anything in the process (i'm especially concerned about not having modified the bashrc file). if you have any ideas on how to check a broken ubuntu system, please let me know... so far, after a restart, everything seems ok but i may be wrong.

my scripts' output doesn't look the same in the ubuntu terminal and in the osx one, but i've started another post on that subject.

thanks a lot for all your help.
CryingSaul
New Python User
New Python User
 
Posts: 27
Joined: Wed Dec 10, 2008 12:49 am

Re: 2.6.1 on ubuntu eee

Postby Wacky on Thu Jan 15, 2009 2:11 pm

CryingSaul wrote:ok, some news from the front (btw, thanks for the link to your other post which clarified things a lot).

Welcome. Glad it helped. :)

i seem to have got this working. i just hope ubuntu isn't messed up, but it looks ok. here's what i did:

    get the 2.6.1 source tar
    ./configure --prefix=/usr/local
    make
    sudo make install

Looks good!

at this point, 'which python' reported '/usr/local/bin/python' which had me worrying. but i figured that it was because $PATH starts with '/usr/local/sbin:/usr/local/bin...', although i am definitely not sure about that. typing 'python' starts 2.6.1 without any edits to the ~/.bashrc file as you suggested, so i left it alone.

You're spot-on, it's doing what's expected. I'd forgotten that /usr/local/bin would already be on your PATH; as long as it's before /usr/bin in the list, then when you (or anyone, actually) just types "python", you'll get the /usr/local/bin/python version. I think that Ubuntu's scripts use /usr/bin/python directly...

then:


Ahh, of course. I think I might even have done that once, but I'd completely forgotten. Thanks for the refresher!

this seems to work fine too, although i can't run the numpy self test because it needs nose, which in turns needs setuptools. i didn't want to do 'sudo apt-get install python-setuptools' because i didn't know what will go where, so instead i ran a couple of basic numpy commands which worked ok. i suppose that if there was a problem, 'import numpy' would have barked at me.

Most likely, yes. :D I'm sorry to say that I know absolutely nothing about using setuptools in an environment with multiple Pythons, but I suspect that sort of knowledge is going to become much more asked-for, and hopefully much more common, as Python 3.0 starts to gain traction.

i hope i haven't messed up anything in the process (i'm especially concerned about not having modified the bashrc file).

The ~/.bashrc file needn't be modified in your case; sorry that I didn't realise and/or explain that better earlier.

if you have any ideas on how to check a broken ubuntu system, please let me know... so far, after a restart, everything seems ok but i may be wrong.

That's about the extent of my ideas. :D If it boots, use it. ("It compiles! Ship it!")

my scripts' output doesn't look the same in the ubuntu terminal and in the osx one, but i've started another post on that subject.

I'll give it a look to see whether I can offer any suggestions.

thanks a lot for all your help.

You're more than welcome.
The plus sign (+) is valid within an email address; please do not
write or suggest code that precludes its use, as many use it as a
"label" to filter incoming mail. </crusade> (Eek! Heresy, Imagist! ;))
Wacky
Python Guru
Python Guru
 
Posts: 673
Joined: Fri Aug 29, 2008 10:40 am
Location: EU

Re: 2.6.1 on ubuntu eee

Postby Bill on Fri Jan 16, 2009 12:47 am

CryingSaul wrote:'which python' reported '/usr/local/bin/python'

You might try whereis python, it should show all the different hits on "python". Interestingly enough I got the following (I've just started with Ubuntu 8.10):
Code: Select all
~$ whereis python
python: /usr/bin/python2.5-config /usr/bin/python /usr/bin/python2.5 /etc/python /etc/python2.5 /usr/lib/python2.5 /usr/lib/python2.4 /usr/lib64/python2.5 /usr/lib64/python2.4 /usr/local/lib/python2.5 /usr/include/python2.5 /usr/include/python2.4 /usr/share/python /usr/share/man/man1/python.1.gz
b

notice hits on Python 2.4 as well as Python 2.5 although /usr/bin contains only python2.5.
-- Bill
Bill
Ultimate Python Hacker
Ultimate Python Hacker
 
Posts: 3612
Joined: Fri Nov 11, 2005 9:10 am
Location: Minnesota, USA

Re: 2.6.1 on ubuntu eee

Postby CryingSaul on Fri Jan 16, 2009 2:00 am

for comparison, here's my output after installing 2.6.1 using the method above:

Code: Select all
python: /usr/bin/python2.5 /usr/bin/python /etc/python2.5 /etc/python /usr/lib/python2.4 /usr/lib/python2.5 /usr/local/bin/python2.6-config /usr/local/bin/python2.6 /usr/local/bin/python /usr/local/lib/python2.6 /usr/local/lib/python2.5 /usr/include/python2.4 /usr/include/python2.5 /usr/share/python /usr/share/man/man1/python.1.gz
CryingSaul
New Python User
New Python User
 
Posts: 27
Joined: Wed Dec 10, 2008 12:49 am


Return to Python General

Who is online

Users browsing this forum: No registered users and 1 guest


Sponsored by Dreamlink Web hosting and Traduzioni Rumeno Italiano and ASSP Deluxe for cPanel.