Search code examples
pythonpippython-modulepython-camelot

Installed Python module is not found in either IDLE and command prompt


I am trying to write a simple script that should include a library for working with PDFs that I found online called Camelot. I installed it with pip and the module displays in the site-packages folder alongside the other pip-installed modules, but when I try to import it I get this: ModuleNotFoundError: No module named 'camelot'

To be noted:

  • I have 2 verisons of Python installed, 3.10 and 3.12, but I checked and the module is in the 3.10 folder where IDLE operates (C:\Users[...]\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages)

  • Other modules and preinstalled libraries work fine, but Camelot and some other pip-installed modules, such as Pandas, won't. All modules are installed in the same folder.

  • I checked the pip version and restarted my PC (I'm using Windows)

  • I updated the sys.path list to include the module's path, as suggested under a different question on a similar topic

I'm clearly missing something here. Any ideas?


Solution

  • Here are the steps that I would take to explore this issue:

    • From the command line directly execute the python 3.10 interpreter with a full path (e.g. c:\python310\bin\python3 - or whatever it is) and then from the python command line manually import the missing package:
    import camelot
    

    if that module is found execute the command 'dir' against the newly imported modules to ensure it import successfully with all required attributes present.

    dir(camelot)
    

    If this doesn't work, then execute the python interpreter directly using a full path as above for the 3.12 and see what results you get.

    • My next suggestions is that you host the absolute minimum number of python versions on your box. Keeping things simple does have its advantage in my view.

    Questions: Are you using pip or pip3? Do you have a python 2.x installation? When you execute the following command, does the originating path make sense for your installation:

    c:\> where pip3
    

    This will ensure that your pip3 installation is installing where you believe it is.

    Running the first command will indicate all of the python installations that the launcher could find. When you execute py -2 it will either indicate that there is no python 2 install and the python installations it can find or it will indicate which python 2 installations you have.

    c:\> py -3 --version 
    c:\> py -2 --version
    

    This should tell you all the python versions your windows machine has installed.

    -Mark