最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ios - For image analysis on mac, how do I prevent this error: Python[19607:217577] +[IMKInputSession subclass]: chose IMKInputSe

programmeradmin5浏览0评论

For multiple image analysis projects in python, I keep getting these two errors below:

Error 1: Python[19607:217577] +[IMKClient subclass]: chose IMKClient_Legacy Error 2: Python[19607:217577] +[IMKInputSession subclass]: chose IMKInputSession_Legacy

I want to use mac, and have tried using jupyter notebook, pycharm, and python in terminal to work around it.

Below is one example of program that gives such error (other programs I have also give such errors).

from skimage.io import imread
import matplotlib.pyplot as plt

f = imread('house.png', as_gray=True)

imgplot = plt.imshow(f)
plt.show()

For multiple image analysis projects in python, I keep getting these two errors below:

Error 1: Python[19607:217577] +[IMKClient subclass]: chose IMKClient_Legacy Error 2: Python[19607:217577] +[IMKInputSession subclass]: chose IMKInputSession_Legacy

I want to use mac, and have tried using jupyter notebook, pycharm, and python in terminal to work around it.

Below is one example of program that gives such error (other programs I have also give such errors).

from skimage.io import imread
import matplotlib.pyplot as plt

f = imread('house.png', as_gray=True)

imgplot = plt.imshow(f)
plt.show()
Share Improve this question edited Apr 3 at 10:37 Christoph Rackwitz 15.8k5 gold badges39 silver badges51 bronze badges asked Mar 24 at 12:25 Gad11ngGad11ng 231 silver badge6 bronze badges 4
  • Can you make this more of a minimal reproducible example? I am seeing imread() at least twice here in your shared Python script code. Do you need one or both to give the issue? And in that vein, posting the full traceback that comes from exactly code you are sharing would also probably help in general. What line is causing the error is not apparent from the little you have provided? Why is this tagged with 'Mobile Develpment Collective'? – Wayne Commented Mar 24 at 15:25
  • I'm betting this is related to matplotlib, because that error sounds like a GUI thing. – Christoph Rackwitz Commented Mar 24 at 21:21
  • Its not from matplotlib.pyplot works fine. – Gad11ng Commented Mar 26 at 13:28
  • minimal reproducible example required. I see that you edited the code. are you now saying every line in that snippet is required to provoke the issue? you said matplotlib works fine, so removing it shouldn't affect the issue, or does it? – Christoph Rackwitz Commented Mar 26 at 16:39
Add a comment  | 

1 Answer 1

Reset to default 0

Someone on reddit found this working solution, it is a backend problem on some Macs (source https://www.reddit/r/learnpython/comments/1jnz2wf/mac_error_when_doing_image_analysis/):

import matplotlib
import matplotlib.pyplot as plt
from skimage.io import imread

matplotlib.use('TkAgg')
f = imread('house.png', as_gray=True)
plt.imshow(f)

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论