Python3 Hopelessly Broken and breaks everything else

Hi Everyone!

I am running into the problem with Python3. When I run it, I get the following error:


$ python3Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>:<exec_prefix>]
Python 3.8.5 (default, Aug  6 2020, 12:00:00) 
[GCC 10.2.0] 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'

I tried all kinds of things that I could find, but nothing seems to help. This also breaks many other applications which rely on python3 (e.g., Dropbox).

These are the contents of my /use/lib/python:


ls /usr/lib/python
python2.7/ python3.6/ python3.8

Please, kindly, help! It is seriously is killing my work.

Hi,
You’ll find questions like yours asked more often and answered in the Development forums…

Here is a running thread in the Programming/Scripting forum…

https://forums.opensuse.org/showthread.php/546157-Python-latest-version

The Python that’s included in default openSUSE installs is mainly to ease running python apps.

If you wish to become a serious Python developer,
It’s essential you learn how to set up Python virtual environments… The current “more official” tool is venv, but there’s maybe 4 often used utilities that do this with different features.
When you develop in python virtual environments (not to be confused with virtualization), you have the ability to specify and confine different python versions for each python app’s directory tree, ensuring that the right python modules and path are used for that app. You should realize this means you can also deploy python versions side by side on your machine which can be important if you develop your app for distribution because different distros and systems will be running on different versions of python.

Beyond that, the error that’s thrown should be self-explanatory…
Your code is looking for the python module that provides “readline” and can’t find it. You’ll either need to correct the environment to find the library or install it if necessary.

Lastly,
Here’s a hint
You didn’t say how/where you installed your various Python, but even if you’re using python from openSUSE and not PyPi, developers have a need for more packages than ordinary Users so should intall the special openSUSE python repositories. Do you know how to find them? If you need help, post again.

TSU

Thank you! I actually did develop python programs and have an idea of the language. However, I am new to the venv thing.

I tried running Dropbox and got that error. Later I found that python3 is not running at all because of the above. I did not do anything that I can think of as it worked before.

Is there a way to completely reinstall it?

Please help.

Running any app should not affect (much less damage) any installed python. At most, it might have made some unauthorized or improper change to your system environment, but that would be improper and not to be expected.
If you made a change to your system recently including installing apps that place files in the root partition and are installed on BTRFS, you can undo the changes easily by rolling back to a date before the change (and you can undo your rollback too if you wish). Just use Snapper (I’m pretty sure for this operation the command line is better but can also be done using the YaST snapper module).

More likely your error is caused by something else…

TSU

ls /usr/lib/python python2.7/ python3.6/ python3.8

Where do you get python 3.8?

Not in the Repos for openSUSE Leap 15.2.

Post:

zypper lr -d

Thank you. Not quite sure how python3.8 came to be.

Below is the output of the command requested


└──╼ $zypper lr -d
#  | Alias                                | Name                                        | Enabled | GPG Check | Refresh | Priority | Type   | URI                                                                                                             | Service
---+--------------------------------------+---------------------------------------------+---------+-----------+---------+----------+--------+-----------------------------------------------------------------------------------------------------------------+--------
 1 | http-download.opensuse.org-d7b068fd  | openSUSE:Leap:15.2:Update                   | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.2/oss/                                                              | 
 2 | http-download.opensuse.org-e2a4cc06  | openSUSE:Leap:15.2:Update                   | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.2/oss/                                                              | 
 3 | https-download.opensuse.org-00b84128 | home:AndnoVember:XFCE                       | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/AndnoVember:/XFCE/openSUSE_Leap_15.2/                          | 
 4 | https-download.opensuse.org-0fecfad4 | X11:RemoteDesktop                           | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/X11:/RemoteDesktop/openSUSE_Leap_15.2/                               | 
 5 | https-download.opensuse.org-1173dd50 | home:Herbster0815:HTPC                      | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/Herbster0815:/HTPC/openSUSE_Leap_15.2/                         | 
 6 | https-download.opensuse.org-1305aa44 | home:AndnoVember:test                       | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/AndnoVember:/test/openSUSE_Leap_15.2/                          | 
 7 | https-download.opensuse.org-19118493 | home:ithod:signal                           | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/ithod:/signal/openSUSE_Leap_15.2/                              | 
 8 | https-download.opensuse.org-2195d0ec | home:aevseev                                | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/aevseev/openSUSE-15.2/                                         | 
 9 | https-download.opensuse.org-2ad46fc6 | home:ithod:signal                           | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/ithod:/signal/openSUSE_Leap_15.2/                              | 
10 | https-download.opensuse.org-3a2a04e4 | windows:mingw:win64                         | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_Leap_15.2/                            | 
11 | https-download.opensuse.org-3dd1989b | multimedia:apps                             | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/multimedia:/apps/openSUSE_Leap_15.2/                                 | 
12 | https-download.opensuse.org-4248314c | home:rhabacker:branches:windows:mingw:win32 | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/rhabacker:/branches:/windows:/mingw:/win32/openSUSE_Leap_15.2/ | 
13 | https-download.opensuse.org-43b59b98 | home:Simmphonie                             | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/Simmphonie/openSUSE_Leap_15.2/                                 | 
14 | https-download.opensuse.org-62b87d00 | windows:mingw                               | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/windows:/mingw/openSUSE_Leap_15.2/                                   | 
15 | https-download.opensuse.org-6678333e | devel:languages:rust                        | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/devel:/languages:/rust/openSUSE_Leap_15.2/                           | 
16 | https-download.opensuse.org-6b37e2ee | home:ahjolinna                              | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/ahjolinna/openSUSE_Leap_15.2/                                  | 
17 | https-download.opensuse.org-7f1bdf29 | home:computersalat:lap                      | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/computersalat:/lap/openSUSE_15.2/                              | 
18 | https-download.opensuse.org-7fdb2786 | home:Dastingo                               | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/Dastingo/openSUSE_Leap_15.2/                                   | 
19 | https-download.opensuse.org-8261616e | home:derselbst                              | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/derselbst/openSUSE_Leap_15.2/                                  | 
20 | https-download.opensuse.org-8519e578 | multimedia:libs                             | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/multimedia:/libs/openSUSE_Leap_15.2/                                 | 
21 | https-download.opensuse.org-869269eb | home:rhabacker:branches:windows:mingw       | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/rhabacker:/branches:/windows:/mingw/openSUSE_Leap_15.2/        | 
22 | https-download.opensuse.org-98c2f59b | windows:mingw:win32                         | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_15.2/                            | 
23 | https-download.opensuse.org-a49862dd | home:geekositalia:daw                       | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/geekositalia:/daw/openSUSE_Leap_15.2/                          | 
24 | https-download.opensuse.org-b5544b2a | home:aevseev:devel                          | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/aevseev:/devel/openSUSE-15.2/                                  | 
25 | https-download.opensuse.org-c5b88c5d | home:aevseev                                | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/aevseev/openSUSE-15.2/                                         | 
26 | https-download.opensuse.org-e4cebefb | Java:packages                               | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/Java:/packages/openSUSE_Leap_15.2/                                   | 
27 | https-download.opensuse.org-e5668fe7 | home:aevseev                                | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/aevseev/openSUSE-15.2/                                         | 
28 | https-download.opensuse.org-f5a40d88 | devel:languages:rust                        | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/devel:/languages:/rust/openSUSE_Leap_15.2/                           | 
29 | https-download.opensuse.org-f959edc1 | home:ahjolinna                              | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/ahjolinna/openSUSE_Leap_15.2/                                  | 
30 | https-download.opensuse.org-fd5a6d19 | home:ozu                                    | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/ozu/openSUSE_Leap_15.2/                                        | 
31 | iridium                              | iridium                                     | Yes     | (r ) Yes  | No      |   99     | rpm-md | https://downloads.iridiumbrowser.de/openSUSE_Leap_15.2/                                                         | 
32 | libdvdcss                            | libdvdcss                                   | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://opensuse-guide.org/repo/openSUSE_Leap_15.2/                                                              | 
33 | ms-teams                             | ms-teams                                    | Yes     | (r ) Yes  | No      |   99     | rpm-md | https://packages.microsoft.com/yumrepos/ms-teams/                                                               | 
34 | nordvpn                              | NordVPN YUM repository - x86_64             | Yes     | (r ) Yes  | No      |   99     | rpm-md | https://repo.nordvpn.com/yum/nordvpn/centos/x86_64                                                              | 
35 | nordvpn-noarch                       | NordVPN YUM repository - noarch             | Yes     | (r ) Yes  | No      |   99     | rpm-md | https://repo.nordvpn.com/yum/nordvpn/centos/noarch                                                              | 
36 | openSUSE-Leap-15.2-1                 | openSUSE-Leap-15.2-1                        | No      | ----      | ----    |   99     | rpm-md | hd:/?device=/dev/disk/by-id/usb-Lexar_USB_Flash_Drive_267QSZI7HPO04YEBT3GT-0:0-part1                            | 
37 | packman                              | packman                                     | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://packman.inode.at/suse/openSUSE_Leap_15.2/                                                                | 
38 | repo-debug                           | Debug Repository                            | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/debug/distribution/leap/15.2/repo/oss/                                             | 
39 | repo-debug-non-oss                   | Debug Repository (Non-OSS)                  | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/debug/distribution/leap/15.2/repo/non-oss/                                         | 
40 | repo-debug-update                    | Update Repository (Debug)                   | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/debug/update/leap/15.2/oss/                                                        | 
41 | repo-debug-update-non-oss            | Update Repository (Debug, Non-OSS)          | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/debug/update/leap/15.2/non-oss/                                                    | 
42 | repo-non-oss                         | Non-OSS Repository                          | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.2/repo/non-oss/                                               | 
43 | repo-oss                             | Main Repository                             | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.2/repo/oss/                                                   | 
44 | repo-source                          | Source Repository                           | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/source/distribution/leap/15.2/repo/oss/                                            | 
45 | repo-source-non-oss                  | Source Repository (Non-OSS)                 | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/source/distribution/leap/15.2/repo/non-oss/                                        | 
46 | repo-update                          | Main Update Repository                      | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.2/oss                                                               | 
47 | repo-update-non-oss                  | Update Repository (Non-Oss)                 | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.2/non-oss/                                                          | 
48 | skype-stable                         | skype (stable)                              | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://repo.skype.com/rpm/stable/                                                                              | 
49 | snappy                               | snappy                                      | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.2       

Wow…

Repos enabled but no refresh, CentOS Repos and too many Repos.
Packman and multimedia:libs together is no good choice, I prefer only Packman.
Do you need them all?

I would say, you should delete many Repos but before that, look what is installed from that Repo and switch the packages to the “normal” one.

And there are several twice in that list (AndnoVember, :ithod:/signal, maybe more). Removing one may make the whole bunch better to interpret.