0

I tried to manually install Python on OpenSuSE Linux, by downloading the source, and run:

configure --prefix=/path/to/my/dir/installed/python

and

make && make install

(I have to do it this way, because I am using the server provided by my institution whereas I do not have root access to it)

This gives me the following warning:

make: warning: Clock skew detected. Your build may be incomplete.

I am not sure if the warning is related to the error I have in the future. (EDIT: This warning is gone now)

I check the installation log, I realize it give me the following error:

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/path/to/my/dir/installed/python/include -I. -IInclude -I./Include -I/usr/local/include -I/path/to/my/dir/setup/Python-2.7.11/Include -I/path/to/my/dir/setup/Python-2.7.11 -c /path/to/my/dir/setup/Python-2.7.11/Modules/_curses_panel.c -o build/temp.linux-x86_64-2.7/path/to/my/dir/setup/Python-2.7.11/Modules/_curses_panel.o
/path/to/my/dir/setup/Python-2.7.11/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.

Now I run python by

/path/to/my/dir/installed/python/bin/python

It give me the following error:

Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python 2.7.13 (default, May 26 2017, 18:16:53) 
[GCC 4.8.5] 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

I tried to fix this error using How can I troubleshoot Python "Could not find platform independent libraries <prefix>" as well as some similar links, and set my environmental variable to be:

export PYTHONPATH='/path/to/my/dir/installed/python/lib/:/path/to/my/dir/installed/python/lib/lib-dynload:/path/to/my/dir/installed/python/lib/python2.7/site-packages'
export PYTHONHOME='/path/to/my/dir/installed/python/lib

Now if I run python, it would give me this error:

ImportError: No module named site

I search on the Stackoverflow for solution for the latter one, but they just tell me to go back to unset the $PYTHONHOME and $PYTHONPATH ...

I've also tried to reset the two path to some other locations, none of it works.

For your information, if I unset the path, and run python, it will still output the previous "could not find dependent libraries" error, and if I try to find the path it provides:

>>>import sys
>>>sys.path
['', '/path/to/my/dir/installed/python/lib/python27.zip',
'/path/to/my/dir/installed/python/lib/python2.7',
'/path/to/my/dir/installed/python/lib/python2.7/plat-linux2', 
'/path/to/my/dir/installed/python/lib/python2.7/lib-tk', 
'/path/to/my/dir/installed/python/lib/python2.7/lib-old', 
'/path/to/my/dir/installed/python/lib/lib-dynload',
'/path/to/my/dir/installed/python/lib/python2.7/site-packages']
Tamaki Sakura
  • 482
  • 5
  • 22
  • 1
    Run `make distclean` or remove and replace the source. Before running `configure` run `find . -type f | xargs touch` then `make && make install`. – Deathgrip May 27 '17 at 22:32
  • @Deathgrip The clock skewed error is gone, but I still have the ImportError... – Tamaki Sakura May 28 '17 at 02:42
  • 1
    Doesn't the server have Python installed already? If not, maybe you can ask the administrator to install it? Most servers have it already. Or maybe this will help? http://software.opensuse.org/package/python3 – John Zwinck May 28 '17 at 02:58
  • @JohnZwinck Yes it does, but I need some extra library which installation will require root because I need a new version of numpy and there is already an old version of numpy installed by the system admin and it is very had to keep them both there... – Tamaki Sakura May 28 '17 at 03:03
  • 1
    Actually, nevermind, I just realize that the numpy for Python3 is the old version but the one for Python2 is fine, I forget to override pip to pip2 which only require installing easy-install from source. The problem is fixed for now as long as no other library the system admin installed for us is out of date. – Tamaki Sakura May 28 '17 at 03:22
  • If you just need a newer NumPy you can use Pip to install it within your own user account. That's much easier than installing Python from source. – John Zwinck May 28 '17 at 03:42

1 Answers1

0

You probably found out the answer for this. But for anyone in the future who needs help with this, I found an answer that worked myself. Open your command prompt / Terminal, Type in the following commands.

$ sudo apt-get update
$ sudo apt-get install python3.6

If you did it correct, python 3.6 should succesfuly install.

  • I totally don't recall how I solved it lol, but that was not the solution, at that time I do not have sudo authorization – Tamaki Sakura Oct 09 '21 at 00:33