ModuleNotFoundError, even though I can see module in dist-packages folder, Setuptools / EGG issue?
John Ladasky
john_ladasky at sbcglobal.net
Wed Apr 8 14:01:27 EDT 2020
On Wednesday, April 8, 2020 at 10:47:42 AM UTC-7, John Ladasky wrote:
> Hi folks,
>
> Something broke in my Python installation in the past two or three days. I'm working in Ubuntu 19.10 and Python 3.7, without virtual environments.
>
> I have two modules of Python source code that I am developing. I regularly change this code and "distribute" it to myself using setuptools. From the command prompt in the module's base folder, I execute:
>
> python3 setup.py sdist
> sudo python3 setup.py install
>
> That process has been working for me for years. But after recent rebuilds, when I try to import those modules today, I get ModuleNotFoundErrors for each of them. I tried importing other modules that were installed by pip3. They work fine.
>
> I looked in /usr/local/lib/python3.7/dist-packages. The one thing that is unique to my two packages is the .egg extension at the end of the file names. Oddly, one of the two modules is a single .egg archive file, and the other is a normal folder with folders inside it, despite the .egg extension in the name.
>
> A third package of mine which I did not build recently appears as a normal sub-folder within dist-packages, and it imports correctly.
>
> What is setuptools supposed to do? Why has its behavior apparently changed? Hope someone can offer some advice. Thanks.
Followup observation:
One of the two Python packages I'm building using setuptools depends on argparse 1.4. The default version of argparse in my Python 3.7 distro is 1.1.
I watched setuptools fetch argparse 1.4 from the Net when I built it.
When I start my Python interpreter and import argparse, I get version 1.1.
I found an argparse 1.4 sub-folder in my site-packages folder. It was built yesterday. It has a .egg extension, just like my two modules that won't import.
More information about the Python-list
mailing list