This repository has been archived by the owner. It is now read-only.

Missing lib2to3 module in Python? #268

programatix opened this Issue Apr 30, 2016 · 3 comments


3 participants

programatix commented Apr 30, 2016


I recently installed new packages for python and I get the following errors (snippet),

Traceback (most recent call last):
  File "/opt/lib/python2.7/site-packages/past/translation/", line 41, in <module>
    from lib2to3.pgen2.parse import ParseError
ImportError: No module named lib2to3.pgen2.parse

The error is caused by an attempt to import lib2to3 module,

from lib2to3.pgen2.parse import ParseError
from lib2to3.refactor import RefactoringTool

I was told that Python can be compiled with or without lib2to3. Is it possible to have a python version with lib2to3 module?



This comment has been minimized.


zyxmon commented May 10, 2016

We do not have Python3 and do not include lib2to3 that is beta. Your problem is solved by commenting 2 lines as shown in FlexGet issue you referenced


This comment has been minimized.


zyxmon commented Jul 25, 2016

This package (python3-lib2to3) was added to Entware with Python3.


This comment has been minimized.

ailjushkin commented Nov 7, 2017

I found it interesting and want to report about this here.
Somehow, I got this error because the lib2to3 package is in the Lib/site-packages folder AND (!) in the Lib folder (which as I see is basic and correct package of lib2to3).

How does lib2to3 package got into the site-packages folder - that is the question which I didn't answer yet.

So when I open my windows console and type import lib2to3.refactor it executes correctly.
But when I run my code in Pycharm, which firstly automatically adds Lib/site-packages folder into the PYTHONPATH onto the top then site-packages lib2to3 picked up and there is no refactor module physically.

So you probably note this in future.


After clean installation of python 2.7 (removed python27 folder) I've reinstalled all my dependencies and the lib2to3 folder does not arrived in site-packages. So simple solution is just to remove this folder manually.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.