[Python] Broken PyCharm Interpreter

Discussão em 'Python' iniciado por Stack, Agosto 19, 2025.

  1. Stack

    Stack Membro Participativo

    I've been using PyCharm CE with pretty great success. But I just installed the basemap module (having to compile geos and basemap from source) and it seems to have broken the PyCharm interpreter. All of my modules load properly when I run Python from the terminal, and all of my modules run properly when I run Python from the terminal WITHIN PyCharm, but now when I attempt to load certain packages from the interactive interpreter, I get error messages. For example, now when I try to import pandas in the interactive interpreter, I get this:

    Traceback (most recent call last):
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/IPython/core/interactiveshell.py", line 2827, in run_code
    exec code_obj in self.user_global_ns, self.user_ns
    File "<ipython-input-3-af55e7023913>", line 1, in <module>
    import pandas as pd
    File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 25, in <module>
    import pandas.core.config_init
    File "/Library/Python/2.7/site-packages/pandas/core/config_init.py", line 4, in <module>
    from pandas.core.format import detect_console_encoding
    File "/Library/Python/2.7/site-packages/pandas/core/format.py", line 12, in <module>
    from pandas.core.index import Index, MultiIndex, _ensure_index
    File "/Library/Python/2.7/site-packages/pandas/core/index.py", line 10, in <module>
    import pandas.index as _index
    File "index.pyx", line 34, in init pandas.index (pandas/index.c:14957)
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/pytz/__init__.py", line 31, in <module>
    from pkg_resources import resource_stream
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/pkg_resources.py", line 2717, in <module>
    add_activation_listener(lambda dist: dist.activate())
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/pkg_resources.py", line 682, in subscribe
    callback(dist)
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/pkg_resources.py", line 2717, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/pkg_resources.py", line 2255, in activate
    list(map(declare_namespace, self._get_metadata('namespace_packages.txt')))
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/pkg_resources.py", line 1851, in declare_namespace
    path = sys.modules[parent].__path__
    KeyError: 'dap'


    If I try to import pandas again, in the same session, the error message changes to this:

    Traceback (most recent call last):
    cannot import name hashtable
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/IPython/core/interactiveshell.py", line 2827, in run_code
    exec code_obj in self.user_global_ns, self.user_ns
    File "<ipython-input-6-af55e7023913>", line 1, in <module>
    import pandas as pd
    File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 6, in <module>
    from . import hashtable, tslib, lib
    ImportError: cannot import name hashtable


    What did I do to break the interpreter? I tried reinstalling PyCharm to reset and it didn't seem to work.

    Continue reading...

Compartilhe esta Página