Python Forum
ImportError: No module named 'lib2to3'
Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ImportError: No module named 'lib2to3'
#1
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
Reply
#2
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
Reply
#3
What linux distro and did you compile python yourself?
Recommended Tutorials:
Reply
#4
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.
Reply
#5
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.?
Recommended Tutorials:
Reply
#6
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.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#7
which 2to3
should print the location of the binary
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#8
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/ =)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  no module named 'docx' when importing docx MaartenRo 1 843 Dec-31-2023, 11:21 AM
Last Post: deanhystad
  Problem with pymodbus - ModuleNotFoundError: No module named 'pymodbus.client.sync' stsxbel 2 23,600 Nov-02-2023, 08:20 AM
Last Post: South_east
  ModuleNotFoundError: No module named 'requests' Serg 18 2,508 Oct-29-2023, 11:33 PM
Last Post: Serg
  Resolving ImportError: No module named gdb (Python in C++) mandaxyz 3 1,416 Oct-04-2023, 02:43 PM
Last Post: mandaxyz
  ModuleNotFoundError: No module named 'PyPDF2' Benitta2525 1 1,482 Aug-07-2023, 05:32 AM
Last Post: DPaul
  ModuleNotFoundError: No module named 'eyed3' Wimpy_Wellington 2 1,311 Jul-10-2023, 03:37 AM
Last Post: Wimpy_Wellington
  How to fix this error: ModuleNotFoundError: No module named 'notears' yaoyao22 2 1,020 Jul-09-2023, 11:24 AM
Last Post: yaoyao22
  Help with pyinstaller "No module named" korenron 9 8,872 Jun-15-2023, 12:20 PM
Last Post: snippsat
  Problem with Pyinstaller. No module named '_tkinter' tonynapoli2309 0 994 May-15-2023, 02:38 PM
Last Post: tonynapoli2309
  ModuleNotFoundError: No module named 'omsdk.sdkproto' donvito7 4 1,819 Oct-20-2022, 02:56 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020