ImportError: No module named configobj

YoavShe picture YoavShe · Aug 20, 2018 · Viewed 8k times · Source

I created .exe file using pyinstaller 3.3.1 and I got this message

Traceback (most recent call last):
File "install.py", line 14, in <module>
ImportError: No module named configobj
[8468] Failed to execute script install

I'm working with python 2.7 using conda environment. Lately I had updated pyinstaller to version 3.3.1 so this happened to me while I'm checking that the update is safe.

I have also created another .exe file from different script that uses also this import and its went well, so any help will be welcome.

Answer

Stephen Ostermiller picture Stephen Ostermiller · Dec 17, 2020

I got this error from certbot on Ubuntu 20.04 (focal). On this version of Ubuntu, python 2 seems to be mostly deprecated and many things don't work when using it. Everything needs to be configured to use python3.

When I ran certbot, it was still using python 2.

File "/usr/local/lib/python2.7/dist-packages/certbot/main.py", line 9, in <module>
    import configobj
ImportError: No module named configobj

Python 2 pip is no longer available from apt on this version of Ubuntu, so I was not able to install the proper libraries for python 2 using pip.

The version of certbot in apt is supposed to be for python3. (python3-certbot). The executable for certbot gets installed at /usr/bin/certbot.

After further investigating, I found that I had an older python 2 version of certbot hanging around at /usr/local/bin/certbot. Once I removed that (sudo rm /usr/local/bin/certbot), the python3 version of certbot runs just fine and is able to find all its libraries.