ImportError: No module named 'xmltodict'

MattB picture MattB · Apr 30, 2019 · Viewed 7.9k times · Source

Relatively new to Python I've created a project using Pipenv that uses the xmltodict module. I've looked at some similar questions but can't find exactly what I need to do.

I've used pipenv to install the xmltodict module but I'm still getting the following error:

Traceback (most recent call last):
  File "./storagereport.py", line 12, in <module>
    import xmltodict
ImportError: No module named 'xmltodict'

Pipenv shows that the module is installed:

$ pipenv graph
xmltodict==0.12.0

Can anyone help?

Answer

Amine Messaoudi picture Amine Messaoudi · Apr 30, 2019

You might be running Python from another version , which is usually the default version that is installed. If that's the case, in your virtual environment you will find python.exe and pip.exe you have to run pip from the virtual environment