Python - Cannot import a module using pip

I’m trying to import the pymssql module using “pip install pymssql”. The output:

Traceback (most recent call last):
File “/usr/local/bin/pip”, line 5, in
from pip._internal.cli.main import main
File “/usr/local/lib/python2.7/dist-packages/pip/_internal/cli/”, line 6, in
import logging
File “/usr/lib/python2.7/logging/”, line 26, in
import sys, os, time, cStringIO, traceback, warnings, weakref, collections
ImportError: No module named collections

How can I fix this?

I recommend not using Python 2. Python 2 is dead.

For this module, it looks like there is an issue with installing dependencies. Do you have collections installed?

Another reason could be missing rights.

1 Like