Spyder: RuntimeError while importing (path must be None or a list)

Created on 4 Sep 2017  路  8Comments  路  Source: spyder-ide/spyder

Description of your problem

What steps will reproduce the problem?

  1. Install newest version of Anaconda (Python 3.6).
  2. conda update conda & conda update spyder
  3. pip install telegram_send
  4. Start spyder and import telegram_send
Traceback (most recent call last):
  File "<ipython-input-1-4a435a0249ac>", line 1, in <module>
    import telegram_send
  File "C:\Anaconda3\lib\site-packages\telegram_send.py", line 28, in <module>
    import telegram
  File "C:\Anaconda3\lib\site-packages\telegram\__init__.py", line 94, in <module>
    from .bot import Bot
  File "C:\Anaconda3\lib\site-packages\telegram\bot.py", line 34, in <module>
    from telegram.utils.request import Request
  File "C:\Anaconda3\lib\site-packages\telegram\utils\request.py", line 34, in <module>
    import telegram.vendor.ptb_urllib3.urllib3.contrib.appengine as appengine
  File "C:\Anaconda3\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\contrib\appengine.py", line 63, in <module>
    from google.appengine.api import urlfetch
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 946, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 881, in _find_spec
  File "<frozen importlib._bootstrap>", line 855, in _find_spec_legacy

  File "C:\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 254, in find_module
    fp, pathname, (ext,mode,ty) = imp.find_module(fullname,package_path)

  File "C:\Anaconda3\lib\imp.py", line 270, in find_module
    "not {}".format(type(path)))

RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>

This works fine in the regular python or iPython console.

Version and main components

  • Spyder Version: 3.2.1
  • Python Version: 3.6.1
  • Qt Versions: 5.6.2, PyQt5 5.6 on Windows

Dependencies

pyflakes >=0.6.0 :  1.5.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.20.1 (OK)
numpy >=1.7      :  1.12.1 (OK)
sphinx >=0.6.6   :  1.5.6 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
nbconvert >=4.0  :  5.1.1 (OK)
sympy >=0.7.3    :  1.0 (OK)
cython >=0.21    :  0.25.2 (OK)
qtconsole >=4.2.0:  4.3.0 (OK)
IPython >=4.0    :  5.3.0 (OK)
pylint >=0.25    :  1.6.4 (OK)
Invalid

All 8 comments

There's not a single line related to Spyder code in your error report. Sorry, but I fail to see how this can be solved in our side.

But why does this error only appear when using Spyder and not within a regular iPython console?

I really don't know, but unfortunately we don't have time to help you to debug this.

I have a similar issue with the pyART library. @skjerns : did you solve your problem? If yes, how?

This is a duplicate of issue #5299. There's a workaround in that issue that you need to apply before we solve it for good.

I have same problem when I import tensorflow.contrib.slim as slim with spyder, but it is ok in Jupyter or cmd window. How can I solve it? @ccordoba12 Did you solve your problem? @jegehrin @skjerns

This is a duplicate of issue #5299. Please see that issue for a temporary fix.

Direct link to solution in #5299:
https://stackoverflow.com/questions/46422488/get-rid-of-pyximport
For the anaconda users out there, I found my sitecustomize.py file with the following command...
find ~/anaconda3 -name 'sitecustomize.py'
I then quit and restarted both Anaconda and Spyder and it worked.
PS. Long live Spyder!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

batuhandayioglugil picture batuhandayioglugil  路  72Comments

spyder-bot picture spyder-bot  路  75Comments

jdweaver picture jdweaver  路  77Comments

andreperesnl picture andreperesnl  路  128Comments

joshburnett picture joshburnett  路  53Comments