7

When building and installing Python 3.7.0 from source on openSUSE Leap 42.3 there are serious python errors with the default ./configure which installs to /usr/local .

(openSUSE Leap 42.3 Python3 package is only up to Python 3.4.6, and virtualenv does not yet have the release version 3.7.)

$ python3
Python 3.7.0 (default, Jul  5 2018, 15:55:09) 
[GCC 4.8.5] on linux
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
  File "/etc/pythonstart", line 7, in <module>
    import readline
ModuleNotFoundError: No module named 'readline'
>>> 

pip is broken as well:

$ pip3
Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 7, in <module>
    from pip._internal import main
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/__init__.py", line 20, in <module>
    from pip._vendor.urllib3.exceptions import DependencyWarning
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/__init__.py", line 8, in <module>
    from .connectionpool import (
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/connectionpool.py", line 7, in <module>
    from socket import error as SocketError, timeout as SocketTimeout
  File "/usr/local/lib/python3.7/socket.py", line 49, in <module>
    import _socket
ModuleNotFoundError: No module named '_socket'

edit: one possible solution:

$ sudo ln -s /usr/local/lib64/python3.7/lib-dynload/ /usr/local/lib/python3.7/lib-dynload

(where /usr/local/ is the default PYTHONHOME)

The question then is there any generic fix to the Python 3.7.0 install from https://www.python.org/? Everyone must be having the same problem, at least for openSUSE Leap 42.3.

The experimental openSUSE python 3.7.0 (devel:languages:python:Factory) breaks the dependencies for apparmor and python(abi), so this can't be installed.

Ted Kandell
  • 71
  • 1
  • 1
  • 3
  • python 3.7 is marked as [experimental](https://build.opensuse.org/package/show/devel%3Alanguages%3Apython%3AFactory/python3) by openSuse. If you still want to use it, you would be better installing from Suse site. – LMC Jul 06 '18 at 00:23
  • Yes, but there are features in python 3.7, such as breakpoint(), that aren't available in the openSUSE 3.4.6 python package. python 3.7.0 is now the latest release version. In any case, the distro packages are usually pretty far behind, so many people may want to build and install Python from source. – Ted Kandell Jul 06 '18 at 00:57
  • 1
    What I'm saying is that you can install python 3.7 from [opensuse site](https://software.opensuse.org/package/python3), click on experimental packages. – LMC Jul 06 '18 at 00:59
  • python3-apparmor-2.10.3-16.1.x86_64 requires python3 = 3.4, so I guess I'll have to ignore that dependency. – Ted Kandell Jul 06 '18 at 01:10
  • Also, python3.3.7.0-240-1.x86_64 requires python(abi) = 3.7, but this requirement cannot be provided, so the dependencies for the experimental python 3.7.0 package are broken. – Ted Kandell Jul 06 '18 at 01:18
  • 3
    In my experience the adding the symbolic link `$ sudo ln -s /usr/local/lib64/python3.7/lib-dynload/ /usr/local/lib/python3.7/lib-dynload` is always required when building python with `make altinstall` on OpenSuse – snakecharmerb Jul 07 '18 at 08:29
  • 1
    Thanks, @snakecharmerb! Creating a soft link pointing from `[...]/lib/python3.7/lib-dynload` to `[...]/lib64/python3.7/lib-dynload` did help with my Leap 15.0 system. Great tip! – pklaus Oct 02 '18 at 12:28

1 Answers1

6

This should fix your problem:

ln -s /usr/local/lib64/python3.7/lib-dynload/ /usr/local/lib/python3.7/lib-dynload
ralhei
  • 756
  • 6
  • 5