I have installed the package prettytable and I'm getting the message saying Requirement already satisfied: prettytable <>
Still I am getting the the error
ModuleNotFoundError: No module named 'prettytable'
Did I made a mistake here?
Any suggestions?
I have installed the package 'prettytable' with the command pip install prettytable and tried to to use the PrettyTable class.
I should not get any error right? But I'm getting that error.
I can reproduce your issue:
If your project is python application, then please make sure the package has been installed to this place:
I notice you have a tag named 'nuget-package' of your question, but in your situation, there is no relationship with nuget package. Python package is another thing.
When you encounter this issue, you need to make sure the package has been installed to target environment. 99.99% situation is the package is not in the correct place.
The situation maybe caused by multiple python versions, virtual environment, etc.
My local environment is very pure, only version python11, and no virtual environment. So when I use pip to successfully install the package prettytable, I can run the python script immediately.
Troubleshooting steps:
If you have multiple Python environments or if you installed
prettytablein a virtual environment, make sure that you have activated the correct environment whereprettytableis installed when you run your script.Check the Python version you're using to run the script and the Python version you used to install
prettytable. They should be the same. You can check the Python version by runningpython --versionin your command line.Confirm that
prettytablewas installed successfully by running the following command:This will give you information about the
prettytableinstallation including the version and the location where it is installed:In your script, you can print out the Python path to see the directories where Python is looking for modules:
Make sure the directory where
prettytableis installed is listed in the output.Sometimes, reinstalling the package can help resolve installation issues. You can do this with the following commands:
Anyway, if you provide more information of this issue, we could give more detailed suggestions/solution. The above steps are the common troubleshooting steps.