Python Forum
ImportError: No module named 'lib2to3' - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: ImportError: No module named 'lib2to3' (/thread-170.html)



ImportError: No module named 'lib2to3' - j.crater - Sep-27-2016

Hello all,
I have a problem when trying to install packages with Pip... I get this error:
ImportError: No module named 'lib2to3'

I have Python 3.5 installed on a Linux system. I browsed entire forum manually and couldn't find any similar topic :D
On a more serious note, I found some topics online regarding lib2to3 missing but I couldn't figure how to solve it in my case. Any hint would be appreciated, thanks!
Regards, JC


RE: ImportError: No module named 'lib2to3' - Crimson King - Sep-27-2016

Didn't know about this program, but according to PyPI 2to3 has been part of the standard library since 2.6

Try typing 2to3 --help in your terminal and see if you get any output from it. You should have it installed already.

Cheers


RE: ImportError: No module named 'lib2to3' - metulburr - Sep-27-2016

What linux distro and did you compile python yourself?


RE: ImportError: No module named 'lib2to3' - j.crater - Sep-27-2016

Thank you for your reply. I tried what you suggested, but all I get is:
2to3: command not found
=/ I see that 2to3 should be built into Python, or rather be part of Python as a library. I don't know how but it seems that the Python version I have doesn't have 2to3 included.


RE: ImportError: No module named 'lib2to3' - metulburr - Sep-27-2016

1) What linux distro are you using?
2) Are you using the default python that came with the distro or some modified version such as one you compiled or Anaconda, etc.?


RE: ImportError: No module named 'lib2to3' - sparkz_alot - Sep-27-2016

Not sure if it will help, but on opensuse 42.1, 2to3 is located in /usr/bin,  also have /usr/bin/2to3-3.4.

The directory for lib2to3 is located in: /usr/lib64/python2.7/lib2to3
and also in /usr/lib64/python3.4/lib2to3

if you have 'locate' on your system, you could just use 'locate 2to3' from the command line.


RE: ImportError: No module named 'lib2to3' - wavic - Sep-27-2016

which 2to3
should print the location of the binary


RE: ImportError: No module named 'lib2to3' - j.crater - Sep-28-2016

Thanks for suggestions. I am using a Buildroot version of Linux, so Python came with the image and I really don't know how it was compiled.
Anyway, solution was just copying the lib2to3 directory from Python resources website into /usr/lib/python3.5/ =)