0

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?

4
  • Try to check which interpreter you are using when executing the script. OR Create a venv and install packages in that venv then activate and use that venv to run your script... This is best practice to avoid conflicts with multiple libraries or python installs Commented Sep 21, 2024 at 16:47
  • 1
    You should include the full command you used to install your module, the full command you used to see if the package was installed, and full command you used to run your script. For each of these steps you should say whether you had a venv activated at the time or not. Another useful command is python -m site. It will tell you where python will look for packages. In IDLE you can get the same by doing import sys; print(sys.path). You should check which version of python you are running from the command line with python --version. Commented Sep 21, 2024 at 17:09
  • How exactly do you run your code? Commented Sep 21, 2024 at 17:39
  • Thank you all, I solved it by uninstalling every Python version and reinstalling the v3.12. I also used the [py -m pip install] command instead of just [pip install] and it worked :) Commented Sep 22, 2024 at 12:10

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

3 Comments

Hi Mark, thank you so much for your comprehensive reply. In the end I solved it by uninstalling all the Python versions on my PC and reinstalling the latest version from the official installer. It works fine now, although I'm struggling with understanding how to make the camelot package function the way I want but that's for another time
Cool - glad you get it working . . . if my answer helped, feel free to mark it appropriately. Thanks!
haven't got the reputation to upvote but I gave it a check mark :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.