MattB
MattB

Reputation: 155

ImportError: No module named 'xmltodict'

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?

Upvotes: 7

Views: 27084

Answers (4)

sauravjoshi23
sauravjoshi23

Reputation: 877

I downloaded the file from here- https://pypi.org/project/xmltodict/#files and after extraction placed the .py file in the directory where I was importing xmltodict. Then it worked fine.

Upvotes: 0

Bhavesh Odedra
Bhavesh Odedra

Reputation: 11141

Try with following command:

sudo pip install xmltodict

or

sudo pip install xmltodict --upgrade

Upvotes: 5

Amine Messaoudi
Amine Messaoudi

Reputation: 2299

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

Upvotes: 3

mauve
mauve

Reputation: 2763

I run into this regularly, I believe because I'm behind a firewall. I download the package that I need to my computer and then I install it. If that doesn't work, I navigate to the download folder where it is and install it from there. You can download this package here:

https://pypi.org/project/xmltodict/

Upvotes: 0

Related Questions