user1993
user1993

Reputation: 107

ImportError: No module named parse in installing pymongo, python 2.7

I am installing pymongo in windows in python 2.7.

but I get this error:

ImportError: No module named parse

What should I do?

I do not have python 3 installed on my machine.

I installed pymongo before and it was working but suddenly when again I run my program it gave me this error.

Upvotes: 0

Views: 3778

Answers (2)

user1993
user1993

Reputation: 107

My problem was that I had my script named urllib.py and it intefered with default files. I renamed it and the problem solved.

Upvotes: 0

David Deprost
David Deprost

Reputation: 5110

Apparently your are running Python 3 modules with Python 2.7.

Python 2.7 imports parse like this:

from urlparse import urlparse

While Python 3 uses:

from urllib.parse import urlparse

So this results in an ImportError, because the parse your Python 3 Pymongo is trying to import, does not exist in the Python 2.7 you are using.

Upvotes: 1

Related Questions