Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81605 > unrolled thread
| Started by | billyfurlong@gmail.com |
|---|---|
| First post | 2014-11-26 09:09 -0800 |
| Last post | 2014-12-02 03:50 +1100 |
| Articles | 9 — 6 participants |
Back to article view | Back to comp.lang.python
Issues installing Python 2.7 billyfurlong@gmail.com - 2014-11-26 09:09 -0800
Re: Issues installing Python 2.7 Chris Angelico <rosuav@gmail.com> - 2014-11-27 10:47 +1100
Re: Issues installing Python 2.7 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-27 11:53 +1100
Re: Issues installing Python 2.7 Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-27 12:40 -0500
Re: Issues installing Python 2.7 Chris Angelico <rosuav@gmail.com> - 2014-11-28 09:40 +1100
Re: Issues installing Python 2.7 Michael Torrie <torriem@gmail.com> - 2014-11-26 21:04 -0700
Re: Issues installing Python 2.7 Steven D'Aprano <steve@pearwood.info> - 2014-11-27 08:13 +0000
Re: Issues installing Python 2.7 billyfurlong@gmail.com - 2014-12-01 08:40 -0800
Re: Issues installing Python 2.7 Chris Angelico <rosuav@gmail.com> - 2014-12-02 03:50 +1100
| From | billyfurlong@gmail.com |
|---|---|
| Date | 2014-11-26 09:09 -0800 |
| Subject | Issues installing Python 2.7 |
| Message-ID | <2680a96a-f5a9-44d8-b4b1-6e0ca32a53ed@googlegroups.com> |
Hi all, Not a python user but I'm trying to upgrade python so I can install pip which is required for one of the apps that I'm installing. I've tried to install using the below instructions, but when I type python I still get the old 2.4.3 version. Oh Red Hat 5.8 is where I'm installing on. yum groupinstall "development tools" -y yum install readline-devel openssl-devel gmp-devel ncurses-devel gdbm-devel \ glib-devel expat-devel libGL-devel tk tix gcc-c++ \ libX11-devel glibc-devel bzip2 tar tcl-devel tk-devel pkgconfig \ tix-devel bzip2-devel sqlite-devel autoconf db4-devel libffi-devel \ valgrind-devel -y mkdir tmp cd tmp wget http://python.org/ftp/python/2.7.5/Python-2.7.5.tgz tar xvfz Python-2.7.5.tgz cd Python-2.7.5 ./configure --prefix=/opt/python2.7 --enable-shared make make altinstall Add this to the bashrc export PATH=$PATH:/opt/python2.7/bin/ Now the installation worked fine but shouldn't I see that it's using the correct version??? I also did try to run /opt/python2.7/bin/python2.7 and it give me this. [root@wmy machine bin]# python2.7 python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory Please help the newb. He's frustrated.
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-11-27 10:47 +1100 |
| Message-ID | <mailman.16356.1417045644.18130.python-list@python.org> |
| In reply to | #81605 |
On Thu, Nov 27, 2014 at 4:09 AM, <billyfurlong@gmail.com> wrote: > Hi all, > > Not a python user but I'm trying to upgrade python so I can install pip which is required for one of the apps that I'm installing. > > I've tried to install using the below instructions, but when I type python I still get the old 2.4.3 version. Oh Red Hat 5.8 is where I'm installing on. Since RHEL depends on Python's stability, you'll continue to get the old version when you just type 'python'. Changing that would potentially break hundreds of scripts in your system. You're definitely going to have to type 'python2.7' to get the new version. > yum groupinstall "development tools" -y > yum install readline-devel openssl-devel gmp-devel ncurses-devel gdbm-devel \ > glib-devel expat-devel libGL-devel tk tix gcc-c++ \ > libX11-devel glibc-devel bzip2 tar tcl-devel tk-devel pkgconfig \ > tix-devel bzip2-devel sqlite-devel autoconf db4-devel libffi-devel \ > valgrind-devel -y > mkdir tmp > cd tmp > wget http://python.org/ftp/python/2.7.5/Python-2.7.5.tgz > tar xvfz Python-2.7.5.tgz > cd Python-2.7.5 Hmm, you just grabbed 2.7.5, but there's a 2.7.8 (and 2.7.9 is in RC, coming soon). I don't think it'll make much difference here, but you may as well grab the latest stable. > ./configure --prefix=/opt/python2.7 --enable-shared > > make > > make altinstall It's been a while since I built a Python 2 from source, but I suspect 'make altinstall' is safe, and the --prefix to configure is unnecessary. However... my suspicion is that you simply need to reference the shared library from the same directory. > Add this to the bashrc > export PATH=$PATH:/opt/python2.7/bin/ > > > [root@wmy machine bin]# python2.7 > python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory See if that file exists somewhere in /opt/python2.7 - if it does, you may simply need to add that directory to ld.so.conf (or ld.so.conf.d if that's how your system's set up) and rerun ldconfig. Alternatively, you should be able to run Python directly from the build tree. If that works, you know for sure that it's a simple pathing problem. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2014-11-27 11:53 +1100 |
| Message-ID | <547675f7$0$12982$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #81605 |
billyfurlong@gmail.com wrote:
> Hi all,
>
> Not a python user but I'm trying to upgrade python so I can install pip
> which is required for one of the apps that I'm installing.
>
> I've tried to install using the below instructions, but when I type python
> I still get the old 2.4.3 version. Oh Red Hat 5.8 is where I'm installing
> on.
That's good! That means you didn't break the system python, which would be
bad.
It's probably possible *in principle* to teach Red Hat Linux to use Python
2.7 as the only version of Python installed, but that will probably break a
lot of critical system scripts like yum. The safest way to deal with this
issue is to
Your options are:
- upgrade the OS to a more recent version which supports 2.7 out of the box;
- explicitly refer to python2.7 instead of python
- use an alias, I put this in my bashrc:
alias python='python2.7'
> yum groupinstall "development tools" -y
> yum install readline-devel openssl-devel gmp-devel ncurses-devel
> gdbm-devel \ glib-devel expat-devel libGL-devel tk tix gcc-c++ \
> libX11-devel glibc-devel bzip2 tar tcl-devel tk-devel pkgconfig \
> tix-devel bzip2-devel sqlite-devel autoconf db4-devel libffi-devel \
> valgrind-devel -y
> mkdir tmp
> cd tmp
> wget http://python.org/ftp/python/2.7.5/Python-2.7.5.tgz
> tar xvfz Python-2.7.5.tgz
> cd Python-2.7.5
>
> ./configure --prefix=/opt/python2.7 --enable-shared
>
> make
>
> make altinstall
So far this all looks good to me.
> Add this to the bashrc
> export PATH=$PATH:/opt/python2.7/bin/
I'm not so sure about that, but I don't have time to investigate right now.
> Now the installation worked fine but shouldn't I see that it's using the
> correct version???
>
> I also did try to run /opt/python2.7/bin/python2.7 and it give me this.
>
> [root@wmy machine bin]# python2.7
> python2.7: error while loading shared libraries: libpython2.7.so.1.0:
> cannot open shared object file: No such file or directory
>
> Please help the newb. He's frustrated.
Are you sure that /opt/python2.7/bin/python2.7 even exists? What do "ls -l"
and "file" say about them?
--
Steven
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2014-11-27 12:40 -0500 |
| Message-ID | <mailman.16375.1417110040.18130.python-list@python.org> |
| In reply to | #81613 |
On Thu, 27 Nov 2014 11:53:10 +1100, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> declaimed the following:
>billyfurlong@gmail.com wrote:
>
>> Add this to the bashrc
>> export PATH=$PATH:/opt/python2.7/bin/
>
>I'm not so sure about that, but I don't have time to investigate right now.
>
If this is for the user login (and where it won't conflict with the
system startup processes) I'd have swapped the $PATH and /opt... order --
putting the 2.7 bin directory ahead of the system bin directory.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-11-28 09:40 +1100 |
| Message-ID | <mailman.16382.1417128061.18130.python-list@python.org> |
| In reply to | #81613 |
On Fri, Nov 28, 2014 at 4:40 AM, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote: > On Thu, 27 Nov 2014 11:53:10 +1100, Steven D'Aprano > <steve+comp.lang.python@pearwood.info> declaimed the following: > >>billyfurlong@gmail.com wrote: > >> >>> Add this to the bashrc >>> export PATH=$PATH:/opt/python2.7/bin/ >> >>I'm not so sure about that, but I don't have time to investigate right now. >> > If this is for the user login (and where it won't conflict with the > system startup processes) I'd have swapped the $PATH and /opt... order -- > putting the 2.7 bin directory ahead of the system bin directory. I wouldn't. Do you know, for absolute certain, which programs you run that end up calling on Python, perhaps via "#!/usr/bin/env python", or perhaps by being shell scripts and running "python my_main_module.py", or something? You'd break those. Unless, of course, you're making absolutely sure there's no "python" command in the /opt/... directory, in which case the PATH order won't have any semantic difference, and directory caching will make sure there's virtually no performance difference, so the current form is just as good. That said, I have never compiled a Python 2, ever. I've always compiled Py3, and let that happily take over the name "python3", leaving the system Python 2.x on the name "python" and "python2". ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Michael Torrie <torriem@gmail.com> |
|---|---|
| Date | 2014-11-26 21:04 -0700 |
| Message-ID | <mailman.16359.1417061067.18130.python-list@python.org> |
| In reply to | #81605 |
To further explain my terse post from before (from my phone), see below. On 11/26/2014 10:09 AM, billyfurlong@gmail.com wrote: > Now the installation worked fine but shouldn't I see that it's using the correct version??? > > I also did try to run /opt/python2.7/bin/python2.7 and it give me this. > > [root@wmy machine bin]# python2.7 > python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory > > Please help the newb. He's frustrated. So the longer answer is that only certain directories are searched by Linux for shared libraries. Python happens to provide a shared library, which it depends on, which is installed by the source tarball in /opt along with the binaries. There are a number of ways you can solve this: - Create a file in /etc/ld.so.conf.d/python2.7.conf and place in it the following path: /opt/python2.7/lib - before running /opt/python2.7/bin/python2.7, set the LD_LIBRARY_PATH environment variable (example in bash): $ LD_LIBRARY_PATH=/opt/python2.7/lib /opt/python2.7/bin/python2.7 - create a wrapper script in /usr/bin that sets LD_LIBRARY_PATH and execs python2.7 I recommend the first as a permanent solution.
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2014-11-27 08:13 +0000 |
| Message-ID | <5476dd45$0$2855$c3e8da3$76491128@news.astraweb.com> |
| In reply to | #81605 |
On Wed, 26 Nov 2014 09:09:30 -0800, billyfurlong wrote: > ./configure --prefix=/opt/python2.7 --enable-shared Do you need to install to /opt instead of the default of /usr/local/bin? I have multiple versions of Python installed on a Red Hat system (Centos, but RH should be the same) using the default prefix of /usr/local/bin and don't have any trouble. I recommend you try again with just: ./configure make make altinstall then add an alias to your .bashrc alias python=python2.7 and see how that works for you. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | billyfurlong@gmail.com |
|---|---|
| Date | 2014-12-01 08:40 -0800 |
| Message-ID | <84aa01c7-5a55-4489-8ef7-43713b0abb01@googlegroups.com> |
| In reply to | #81619 |
This actually worked!! It's a bare machine with nothing (except the system) using python.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-12-02 03:50 +1100 |
| Message-ID | <mailman.16455.1417452625.18130.python-list@python.org> |
| In reply to | #81756 |
On Tue, Dec 2, 2014 at 3:40 AM, <billyfurlong@gmail.com> wrote: > This actually worked!! It's a bare machine with nothing (except the system) using python. Good to know! But, uhh... *what* actually worked? You've posted with no content, so we have no idea which of the several suggestions in this thread worked - and,more importantly, neither does anyone who comes reading the archive. One of the beauties of a good mailing list is that information hangs around; if anyone else has the same problem as you do, s/he can read the response and know what to do, without waiting for the turn-around time of email questions and answers. For that to work, context is crucial. But I'm glad you're sorted out! ChrisA
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web