1

Basic problem: Spyder-Py2 2.3.3 running can't import cv (commonly known as opencv). When I attempt to "import cv" (or cv2) in a python console, the console doesn't throw an error but just becomes unresponsive. When I attempt to "import cv" in the ipython console, I get "It seems the kernel died unexpectedly. Use 'Restart kernel' to continue using this console." repeatedly.

Please note this is after I have added /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages to PYTHONPATH using PYTHONPATH manager. If I don't do that, the error simply says the module isn't recognized.

However, in the terminal (OSX 10.9.4) I am able to import cv and use it just fine. Spyder was installed as a .dmg and opencv was installed using Homebrew. Each has been installed and reinstalled a number of times so the order of installation is probably not the problem.

I am pretty sure that terminal and Spyder are using different python sources. In the terminal, "which python" returns /usr/local/bin/python. However, by inspecting sys.version and sys.maxint, you can see both are Python 2.7.8 and 64bit.

The only difference I can find is that in the terminal I get: [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin

Whereas in spyder I get

'2.7.8 (default, Aug 15 2014, 13:43:01) \n[GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.61)]'

when i use sys.version.

This question looks most similar, but the error message is totally different, so I think it is of a different nature.

Please. Any help would be very much appreciated. Chris


Following Carlos' suggestion, I changed the default Python interpreter to /usr/local/bin/python. However, I get a new error message upon starting up Spyder. (Sorry I can't post Images for Rep reasons)

An error ocurred while starting the kernel

Either:

  1. Your IPython frontend and kernel versions are incompatible or
  2. You don't have IPython installed in your external interpreter.

In any case, we're sorry but we can't create a console for you.

I couldn't resolve this by picking a different Python interpreter or by "pip install ipython"

Community
  • 1
  • 1
user3391229
  • 798
  • 9
  • 17
  • (*Spyder dev here*) Please see the answer provided in the link below. Although it's not directly related to opencv, it describes how to solve your problem: http://stackoverflow.com/a/19813292/438386 – Carlos Cordoba Dec 24 '14 at 17:46
  • I followed up on your edit and I ran into a new problem. Wasn't sure if I should make it into a new post. – user3391229 Dec 31 '14 at 17:36
  • Don't worry, post the error here first to see what it is about. – Carlos Cordoba Jan 01 '15 at 21:37

1 Answers1

0

Again install Anaconda and try the following code in Anaconda Prompt to install opencv

conda install --channel https://conda.anaconda.org/menpo opencv3

Then it will work in spyder.

Sathsara AM
  • 69
  • 1
  • 4