Python 2.7.10 Installation Error

I want to install 2.7.10 on OpenSUSE 13.2, but I’m stuck on an error which I did not see in the 2.7.8 install. Any help would be greatly appreciated.

This is how I installed python:
./configure --prefix=/usr
make
su root
make install

During make, I got this:


Python-2.7.10/Modules/_curses_panel.c:17:19: fatal error: panel.h: No such file or directory
 #include <panel.h>
                   ^
compilation terminated.

Python build finished, but the necessary bits to build these modules were not found:
bsddb185           dl                 imageop         
sunaudiodev                                           
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


Failed to build these modules:
_curses_panel                                         

running build_scripts

But this thread tells me that I do not need it (go to 2nd last comment). http://codeverge.com/opensuse.org.help.applications/need-python-2.6-in-suse-11.4/1907211
So I carried on.

Running python afterwards gives me:


Python 2.7.10 (default, Oct 18 2015, 13:12:33) 
[GCC 4.8.3 20140627 [gcc-4_8-branch revision 212064]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
  File "/etc/pythonstart", line 7, in <module>
    import readline
ImportError: No module named readline
>>> 

Trying to run an application that used to work now gives


File "/usr/lib/python2.7/subprocess.py", line 427, in <module>
    import select
ImportError: No module named select

I checked and /usr/lib/python2.7 does not have select.py.

Do you know how this is possible? I’ve installed readline-devel already.

I realize belatedly that I should’ve run “make altinstall” just to be safe. But anyhow that’s my problem.

Also, how do I revert back to 2.7.8 as the primary python version?

Thanks.

Why not as rpm from Repo?
https://software.opensuse.org/package/python?search_term="python"

Ok, I just tried but it gave me the following warning:

Problem: nothing provides python-base = 2.7.10 needed by python-2.7.10-56.1.x86_64
Solution 1: do not install python-2.7.10-56.1.x86_64
Solution 2: break python-2.7.10-56.1.x86_64 by ignoring some of its dependencies

I installed anyways, but running python again I see the same problems, and the timestamp on the python interpreter 13:12:33 stayed the same.

I noticed that the rpm installed in /usr/local instead, so I exported PYTHONPATH to point to /usr/local/lib/python2.7. Now however the same readline and select errors reappeared.

You have enabled the repo and than installed python from this repo?

What do you mean by enabling the repo?

I ran “sudo zypper in <rpm file I downloaded from the unofficial packages for one of the 2.7.10 rpms>”.

Ah so newbie, but yes I checked in yast and the repo was enabled, so yes I did enable and download from this repo.

With YaST you install (from a repo). That installation includes, but is not restricted to, downloading. Thus please, did you install it with YaST or not? And when yes, di you get any warnings/errors?

First,
You have to add the openSUSE Python repo which likely contains the dependency packages you’re looking for (The following command installs Python 2 on a 13.2, there are other repos)

zypper ar -f http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_13.2/ Python_openSUSE_13.2

Note that installing in this way by default modifies your Python system-wide.
If you want to install multiple Python versions and set them to apply to individual application trees or your entire system, you should install and manage your Python using virtualenv.

TSU

Now I just tried what tsu2 is suggesting, but after the install I don’t see any python2.7 related files or directories installed:
sudo zypper ar -f http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_13.2/ Python_openSUSE_13.2
root’s password:
Adding repository ‘Python_openSUSE_13.2’ …[done]
Repository ‘Python_openSUSE_13.2’ successfully added
Enabled : Yes
Autorefresh : Yes
GPG Check : Yes
URI : http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_13.2/

then,

sudo zypper in python
Empty destination in URI: hd:///?device=/dev/disk/by-id/scsi-1KingstonDataTraveler_2.0-part1

Abort, retry, ignore? [a/r/i/? shows all options] (a): i
Do you want to disable the repository openSUSE-13.2-0 permanently? [yes/no] (no): yes
Skipping repository ‘openSUSE-13.2-0’ because of the above error.
Retrieving repository ‘openSUSE-13.2-Update’ metadata …[done]
Building repository ‘openSUSE-13.2-Update’ cache …[done]
Loading repository data…
Reading installed packages…
‘python’ is already installed.
No update candidate for ‘python-2.7.8-1.1.x86_64’. The highest available version is already installed.
Resolving package dependencies…

Nothing to do.

I did receive this warning message:
Empty destination in URI: hd:///?device=/dev/disk/by-id/scsi-1KingstonDataTraveler_2.0-part1

Right now I just want to restore any python to my computer (although best if it’s 2.7.10 but not no big deal).

Ahh, I stumbled upon python-base after messing around with this command:

~/Downloads> zypper source-install libpython2_7-1_0
Reading installed packages…
Loading repository data…
Package ‘libpython2_7-1_0’ has source package ‘python-base’.
Source package ‘python-base’ for package ‘libpython2_7-1_0’ not found.
Resolving package dependencies…

After installing python-base and then python using zypper it worked!

Thanks everyone for your input. +1 for your help.

Glad to hear you resolved.
The above error is generated because apparently you originally installed from a USB stick and have since removed it.
You can remove the “repo” if you won’t use it any longer using YAST or after listing your repos, remove, eg

# The following lists your repos
zypper lr
# The following can remove a specified repo (or more than one) 
zypper rr *reponumber or reponame*

TSU