Search code examples
pythonpython-3.xpippython-venvmodulenotfounderror

ModuleNotFoundError: No module named 'letterboxdpy'


I am encountering an issue while attempting to use the letterboxdpy module within a Python virtual environment. Despite successfully installing the module using pip, confirming its presence in the virtual environment's site-packages, and ensuring the correct Python binary is used, I am unable to import the letterboxdpy module in my script.

Steps

  1. Created a virtual environment using python3 -m venv myenv.
  2. Installed the letterboxdpy module within the virtual environment using pip install letterboxdpy.
  3. Attempted to import the letterboxdpy module in a script within the virtual environment.

Expected Behavior:

I expect to be able to import the letterboxdpy module without encountering any errors within my virtual environment.

Actual Behavior:

I receive a ModuleNotFoundError when trying to import the letterboxdpy module within the virtual environment. The Python script is unable to locate the module despite it being installed.

Environment:

Python Version: 3.9.6
MacOS Sonoma 14.1.1

Additional Information

Output of pip list within the virtual environment:

Package      Version
------------ -------
letterboxdpy 4.0
pip          21.2.4
setuptools   58.0.4

Output of pip show letterboxdpy within the virtual environment:

Name: letterboxdpy
Version: 4.0
Summary: A letterboxd webscraper
Home-page: 
Author: 
Author-email: Nicholas Cassarino <[email protected]>
License: 
Location: /Users/userOne/Desktop/Env/myenv/lib/python3.9/site-packages
Requires: 
Required-by: 

Notes

I have verified that the correct Python binary within the virtual environment is being used (/Users/userOne/Desktop/Env/myenv/bin/python). Additionally, I attempted to explicitly include the letterboxdpy module path in sys.path within the script, but the issue persists.

I appreciate any insights or suggestions on resolving this issue.


Solution

  • The wheel for letterboxdpy 4.0 is buggy — it installs src/letterboxdpy instead of letterboxdpy and it doesn't contain __init__.py. Install an older version this way:

    pip install -U "letterboxdpy < 4"
    

    Please note double quotes.

    Upd. I reported the bug and the author promptly fixed it in version 4.2.

    pip install -U letterboxdpy
    

    or

    pip install -U "letterboxdpy >= 4.2"