2

I am trying to import basemap and am getting the error below. I looked into the issue on stackoverflow and tried the suggestion provided here:

Why do I get "UserWarning: Module dap was already imported from None ..."

When I tried to import using the console it worked fine, but importing in ipython seems to have an issue

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-8-696228d030c9> in <module>()
----> 1 import mpl_toolkits.basemap

/usr/lib/pymodules/python2.7/mpl_toolkits/__init__.py in <module>()
      1 try:
----> 2     __import__('pkg_resources').declare_namespace(__name__)
      3 except ImportError:
      4     pass # must not have setuptools

/usr/lib/python2.7/dist-packages/pkg_resources.py in <module>()
   2823 # all distributions added to the working set in the future (e.g. by
   2824 # calling ``require()``) will get activated as well.
-> 2825 add_activation_listener(lambda dist: dist.activate())
   2826 working_set.entries=[]; map(working_set.add_entry,sys.path) # match order
   2827 

/usr/lib/python2.7/dist-packages/pkg_resources.py in subscribe(self, callback)
    708         self.callbacks.append(callback)
    709         for dist in self:
--> 710             callback(dist)
    711 
    712 

/usr/lib/python2.7/dist-packages/pkg_resources.py in <lambda>(dist)
   2823 # all distributions added to the working set in the future (e.g. by
   2824 # calling ``require()``) will get activated as well.
-> 2825 add_activation_listener(lambda dist: dist.activate())
   2826 working_set.entries=[]; map(working_set.add_entry,sys.path) # match order
   2827 

/usr/lib/python2.7/dist-packages/pkg_resources.py in activate(self, path)
   2258         if path is sys.path:
   2259             fixup_namespace_packages(self.location)
-> 2260             map(declare_namespace, self._get_metadata('namespace_packages.txt'))
   2261 
   2262 

/usr/lib/python2.7/dist-packages/pkg_resources.py in declare_namespace(packageName)
   1834                 __import__(parent)
   1835             try:
-> 1836                 path = sys.modules[parent].__path__
   1837             except AttributeError:
   1838                 raise TypeError("Not a package:", parent)

KeyError: 'dap'

Any suggestions one how to import in ipython.

Community
  • 1
  • 1
maverick
  • 129
  • 1
  • 3
  • 14

0 Answers0