[Tutor] ImportError: No module named '_sysconfigdata_m'

Steven D'Aprano steve at pearwood.info
Tue Sep 24 02:25:34 CEST 2013


On Mon, Sep 23, 2013 at 12:28:10PM -0700, Albert-Jan Roskam wrote:
> Hi,
> 
> I just wanted to type "git status" in my Linux terminal but I made a 
> typo and I got a long Python 3.3 traceback message. Just curious: What 
> does it mean?

Unless this was at the Python prompt, it's not really a Python question. 
It's a question about your Linux installation, and why "gigt" ends up 
calling Python. Start with:

man gigt

which gigt

locate gigt


to try to identify what it is. If nothing relevant comes up, that 
suggests that your Linux system is set up to try to help when you 
mistype a command. E.g. on one Ubuntu system, I get this:

steve at flora:~$ gigt
No command 'gigt' found, did you mean:
 Command 'gitg' from package 'gitg' (universe)
 Command 'gist' from package 'yorick' (universe)
 Command 'gift' from package 'gnuift' (universe)
 Command 'git' from package 'git-core' (main)
gigt: command not found


I don't know the technology behind this feature, but it may be built 
using Python. That explains why you're going a Python traceback. Which 
implies that you've broken the system Python.

Very few Linux distros use Python 3.3 as their system Python. Your error 
suggests that you've replaced the expected Python installation, probably 
2.7, with 3.3 instead of installing in parallel. That's not a good idea.

You can test this by su'ing to some user other than yourself, to ensure 
you have a clean environment, and then run python -V to see the version. 
If I do this as both the "steve" and "root" users, you can see I get two 
different versions:


[steve at ando ~]$ python -V
Python 2.7.2
[steve at ando ~]$ su -
Password:
[root at ando ~]# python -V
Python 2.4.3


That's because the "steve" user has a line in my .bashrc file that sets 
an alias python=python2.7, while the system Python on this machine is 
Python 2.4.


Last but not least, the error message you get hints that your Python 3.3 
installation may be broken. What happens if you try to run it normally? 
The error ends with:

>   File "/usr/lib/python3.3/sysconfig.py", line 403, in _init_posix
>     from _sysconfigdata import build_time_vars
>   File "/usr/lib/python3.3/_sysconfigdata.py", line 6, in <module>
>     from _sysconfigdata_m import *
> ImportError: No module named '_sysconfigdata_m'

If you can reliably reproduce this error, it should be reported as a 
bug. Assuming you didn't break it yourself :-)

I note that in my version of Python 3.3, line 6 of _sysconfigdata is not 
an import, and the line "from _sysconfigdata_m import *" does not exist 
anywhere in the file.



-- 
Steven


More information about the Tutor mailing list