2

Good day,

I recently tried to upgrade to Python 3.6.1 by building from source, and I've had a few issues.The first of which had to do with the $PYTHONHOME environment variable, which I have now (seemingly) solved, whereas the second - and most persistent - has to do with me not being able to access many modules.

For instance, when I launch the python3 interpreter, I immediately encounter an error that states:

Traceback (most recent call last): File "/etc/pythonstart", line 7, in import readline ModuleNotFoundError: No module named 'readline'

Similar errors occur with other modules that are imported by other scripts, such as 'encodings'

ImportError: No module named 'encodings'

and '_socket'

ModuleNotFoundError: No module named '_socket'

I'm not used to building from source, so I just used the instructions in the readme file that comes with the Python 3.6.1 tar ball, without much understanding of what's going on. I performed this procedure over and over again, (hopefully that didn't add to the problems), and here's the latest error output from the make test command:

Traceback (most recent call last): File "./Tools/scripts/run_tests.py", line 12, in import test.support
File "/usr/local/lib/python3.6/test/support/init.py", line 15, in import logging.handlers
File "/usr/local/lib/python3.6/logging/handlers.py", line 26, in import logging, socket, os, pickle, struct, time, re
File "/usr/local/lib/python3.6/socket.py", line 49, in import _socket ModuleNotFoundError: No module named '_socket' Makefile:1018: recipe for target 'test' failed make: *** [test] Error 1

I've searched all over the web frantically and I can't seem to find anything that really captures my problem, as the many other problems I've seen often involve people not being able to access only one module, or the solutions provided are extremely specific and seem difficult to generalise from (such as solutions that make use of lengthy Debian-based commands). I sincerely apologise if there are general solutions to this problem that I just haven't found.

Additionally, when I try to launch the Python 2 interpreter, I just get this error (and it fails completely):

ImportError: No module named site

My system information:

  1. OS: Opensuse Leap 42.2
  2. Previous Python3 version: 3.4.5 Current
  3. Python3 version: 3.6.1

Your help with this matter would be greatly, greatly appreciated!

austvaedi
  • 21
  • 1
  • Where did you build Python from source, and where did you take the source? Was it a distro-provided source package? Did you replace system-provided Python? – 9000 May 26 '17 at 14:45
  • I hope you didn't do a sudo make install , that will have clobbered your system-provided python.... – Irmen de Jong May 26 '17 at 15:03
  • @irmen-de-jong Oh boy, this is exactly what I did. I just followed the instructions in the readme file :/ – austvaedi May 27 '17 at 20:25
  • Hi @9000, I take it you're speaking about the directories? I initially just built it in my Downloads directory (where I had downloaded and extracted the tarball), and then I repeated the process in a new directory called "source" in my home folder. I did replace the system-provided Python, and this version of Python is one I downloaded from python.org - I think distro-provided only has 3.4.5 as the latest available version. – austvaedi May 27 '17 at 20:29
  • 1
    @armnod ouch. Glancing over the readme I think it could be well improved on this matter. You should have read on though, there's a section about installing multiple versions https://github.com/python/cpython/blob/master/README.rst#installing-multiple-versions – Irmen de Jong May 27 '17 at 20:49

0 Answers0