Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

itk, swig, and Spyder don't play nice? #6749

Closed
ysumath1 opened this issue Mar 13, 2018 · 5 comments
Closed

itk, swig, and Spyder don't play nice? #6749

ysumath1 opened this issue Mar 13, 2018 · 5 comments

Comments

@ysumath1
Copy link

Problem Description

Importing ITK package works properly in Terminal but not Spyder.
Specifically:

import itk
itk.Image[itk.UC, 2]

Throws this error in Spyder: TypeError: coercing to Unicode: need string or buffer, list found
(Spyder 2.7 in Anaconda 2.7 root environment)

Works properly in Terminal.

What steps will reproduce the problem?

  1. Install itk either from source or via Anaconda (on my machine error persists regardless of how itk is installed).
  2. enter commands above
  3. ensure $ echo $PYTHONPATH gives same python path in os.environ in Spyder

What is the expected output? What do you see instead?

Expectation (from terminal)

import itk
itk.Image[itk.UC, 2]
# <class 'itkImagePython.itkImageUC2'>

Instead in Spyder: TypeError

Paste Traceback/Error Below (if applicable)

import itk

itk.Image[itk.UC, 2]

Traceback (most recent call last):

  File "<ipython-input-2-5f5da1089460>", line 1, in <module>
    itk.Image[itk.UC, 2]

  File "/home/sumathipalaya/ITK4.11_WithPythonShared/lib/python2.7/dist-packages/itkLazy.py", line 44, in __getattribute__
    itkBase.LoadModule(module, namespace)

  File "/home/sumathipalaya/ITK4.11_WithPythonShared/lib/python2.7/dist-packages/itkBase.py", line 118, in LoadModule
    LoadModule(dep, namespace)

  File "/home/sumathipalaya/ITK4.11_WithPythonShared/lib/python2.7/dist-packages/itkBase.py", line 128, in LoadModule
    module = loader.load(swigModuleName)

  File "/home/sumathipalaya/ITK4.11_WithPythonShared/lib/python2.7/dist-packages/itkBase.py", line 250, in load
    return imp.load_module(name, fp, pathname, description)

  File "/home/sumathipalaya/ITK4.11_WithPythonShared/lib/python2.7/dist-packages/itk/Configuration/../ITKPyBasePython.py", line 21, in <module>
    _ITKPyBasePython = swig_import_helper()

  File "/home/sumathipalaya/ITK4.11_WithPythonShared/lib/python2.7/dist-packages/itk/Configuration/../ITKPyBasePython.py", line 18, in swig_import_helper
    return importlib.import_module(mname)

  File "/home/sumathipalaya/anaconda2/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)

  File "/home/sumathipalaya/anaconda2/lib/python2.7/site-packages/pyximport/pyximport.py", line 302, in find_module
    elif os.path.isfile(path):

  File "/home/sumathipalaya/anaconda2/lib/python2.7/genericpath.py", line 37, in isfile
    st = os.stat(path)

TypeError: coercing to Unicode: need string or buffer, list found

N.B. This link seems to have some helpful information, but I don't understand how to interpret it. Any help or guidance would be appreciated.

Package Versions

  • Spyder: 3.2.7
  • Python: 2.7
  • Qt: 5.6.2
  • PyQt: 5.6.0
  • Operating System: Ubuntu 14.04

Dependencies

IPython >=4.0;<6.0:  5.4.1 (OK)
cython >=0.21     :  0.26.1 (OK)
jedi >=0.9.0      :  0.10.2 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
numpy >=1.7       :  1.13.3 (OK)
pandas >=0.13.1   :  0.20.3 (OK)
psutil >=0.3      :  5.4.0 (OK)
pycodestyle >=2.3 :  2.3.1 (OK)
pyflakes >=0.5.0  :  1.6.0 (OK)
pygments >=2.0    :  2.2.0 (OK)
pylint >=0.25     :  1.7.4 (OK)
qtconsole >=4.2.0 :  4.3.1 (OK)
rope >=0.9.4      :  0.10.5 (OK)
sphinx >=0.6.6    :  1.6.3 (OK)
sympy >=0.7.3     :  1.1.1 (OK)
@CAM-Gerlach
Copy link
Member

Thanks for the detailed report. The solution referred to is under this answer on Stack Overflow. However, the problem is already fixed in the forthcoming release of Spyder, due out tomorrow, so if its too difficult then I suggest you just be patient. In any case, as this is a bug tracker, not a help forum, and it is already fixed and a duplicate of #5299 as the linked post states, this issue will be closed. Best of luck!

@ysumath1
Copy link
Author

Thanks. Looked like the issue was closed in Sept. 2017; as there's been a couple of releases of Spyder since then; I had presumed the issue was fixed and thus wanted to report what I thought was a bug. Glad to see a proper solution is coming out in the newest release. I will wait for it and update accordingly.

@CAM-Gerlach
Copy link
Member

Not sure if you're referring to #5299 or another related/duplicate issue, but the former was opened in late September and finally closed 8 days ago, going by the github issue thread.

@ysumath1
Copy link
Author

You know, I think I misread when it was closed; I mistakenly took the date Carlos added the tags as the date this was closed. Thanks so much for clarifying. I'm always impressed by how responsive your team is to improving this IDE!

@CAM-Gerlach
Copy link
Member

Thanks @ysumath1 , your kind words really mean a lot. I'm just the new guy; its really people like Carlos who do most of the work. Its especially tough since we're unfunded at the moment and depending on the community for support, so we really appreciate the positive feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants