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

[misc] Importing matplotlib.pyplot before importing taichi will be fault on OSX #998

Closed
j20232 opened this issue May 16, 2020 · 5 comments
Closed
Assignees
Labels
mac Mac OS X platform potential bug Something that looks like a bug but not yet confirmed

Comments

@j20232
Copy link

j20232 commented May 16, 2020

Describe the bug

Importing matplotlib.pyplot before importing taichi will be fault on OSX.

I found this bug.

Could you check it?

snippets to reproduce bugs and logs

Environments

  • OS: OSX Catalina 10.15.4
  • Python 3.7.0 64-bit (using poetry)
  • taichi: 0.6.4
  • matplotlib: 3.2.1

Import matplotlib after taichi

  • snippets
import taichi as ti
import matplotlib.pyplot as plt # changed here

pixels = ti.var(dt=ti.f32, shape=(400, 200))

@ti.kernel
def fill():
    for i, j in pixels:
        pixels[i, j] = i * j

fill()
  • Logs
[Taichi] mode=release
[Taichi] version 0.6.4, supported archs: [cpu, metal], commit 562e1f11, python 3.7.0
objc[47064]: Class View is implemented in both ?? (0x7fd6fb58b8e0) and /Users/berry/Library/Caches/pypoetry/virtualenvs/taichi-snippets-lZeOq7r2-py3.7/lib/python3.7/site-packages/matplotlib/backends/_macosx.cpython-37m-darwin.so (0x120eb4820). One of the two will be used. Which one is undefined.

This snippets will work correctly.


Import matplotlib before taichi

  • snippets
import matplotlib.pyplot as plt
import taichi as ti # changed here

pixels = ti.var(dt=ti.f32, shape=(400, 200))

@ti.kernel
def fill():
    for i, j in pixels:
        pixels[i, j] = i * j

fill()
  • Logs
[Taichi] mode=release
[E 05/16/20 17:40:29.846] Received signal 11 (Segmentation fault: 11)



                            * Taichi Core - Stack Traceback *                             
==========================================================================================
|                       Module |  Offset | Function                                      |
|----------------------------------------------------------------------------------------|
*               taichi_core.so |     324 | taichi::signal_handler(int)                   |
*     libsystem_platform.dylib |      29 | (null)                                        |
*                          ??? |   26350 | (null)                                        |
*               taichi_core.so |      94 | initView()                                    |
*                          ??? | 203506147 | (null)                                      |
*                          ??? | 203507182 | (null)                                      |
*                          ??? | 203485195 | (null)                                      |
*                          ??? | 203477012 | (null)                                      |
*                          ??? | 203477172 | (null)                                      |
*                          ??? | 203419184 | (null)                                      |
*                          ??? | 203460091 | (null)                                      |
*                libdyld.dylib |     171 | (null)                                        |
*                       python |     134 | (null)                                        |
*                       python |     494 | (null)                                        |
*                       python |     220 | (null)                                        |
*                       python |     122 | (null)                                        |
*                       python |      65 | (null)                                        |
*                       python |   46177 | (null)                                        |
*                       python |     418 | (null)                                        |
*                       python |     195 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45215 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45065 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45705 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45705 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45705 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     248 | (null)                                        |
*                       python |     243 | (null)                                        |
*                       python |    3600 | (null)                                        |
*                       python |   36611 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45705 | (null)                                        |
*                       python |     418 | (null)                                        |
*                       python |     347 | (null)                                        |
*                       python |     122 | (null)                                        |
*                       python |      65 | (null)                                        |
*                       python |   46177 | (null)                                        |
*                       python |     418 | (null)                                        |
*                       python |     195 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45215 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45065 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45705 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45705 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     248 | (null)                                        |
*                       python |     243 | (null)                                        |
*                       python |    3600 | (null)                                        |
*                       python |   36611 | (null)                                        |
*                       python |     418 | (null)                                        |
*                       python |     347 | (null)                                        |
*                       python |     122 | (null)                                        |
*                       python |      65 | (null)                                        |
*                       python |   46177 | (null)                                        |
*                       python |     418 | (null)                                        |
*                       python |     195 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45215 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45065 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45705 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45705 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     248 | (null)                                        |
*                       python |     243 | (null)                                        |
*                       python |    3600 | (null)                                        |
*                       python |   36611 | (null)                                        |
*                       python |     418 | (null)                                        |
*                       python |     347 | (null)                                        |
*                       python |     122 | (null)                                        |
*                       python |      65 | (null)                                        |
*                       python |   46177 | (null)                                        |
*                       python |     418 | (null)                                        |
*                       python |     195 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45215 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45065 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45705 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     181 | (null)                                        |
*                       python |   45705 | (null)                                        |
*                       python |     120 | (null)                                        |
*                       python |     248 | (null)                                        |
*                       python |     243 | (null)                                        |
*                       python |    3600 | (null)                                        |
*                       python |   36611 | (null)                                        |
*                       python |     418 | (null)                                        |
*                       python |     256 | (null)                                        |
*                       python |     388 | (null)                                        |
*                       python |    9148 | (null)                                        |
*                       python |     142 | (null)                                        |
*                libdyld.dylib |       1 | (null)                                        |
==========================================================================================

This snippets won't work.

Could you check it?

regards,

@j20232 j20232 added the potential bug Something that looks like a bug but not yet confirmed label May 16, 2020
@j20232 j20232 changed the title Importing matplotlib.pyplot before importing taichi will be fault on OSX [misc] Importing matplotlib.pyplot before importing taichi will be fault on OSX May 16, 2020
@belkakari
Copy link

belkakari commented May 16, 2020

I also have encountered the same bug on OSX, rearranging the imports have solved the issue

@k-ye k-ye added the mac Mac OS X platform label May 17, 2020
@k-ye k-ye self-assigned this May 17, 2020
@k-ye
Copy link
Member

k-ye commented May 17, 2020

I can probably take a look. My current guess is that there seems to be a conflict in the GUI system..

See https://stackoverflow.com/a/30582486/12003165

@k-ye
Copy link
Member

k-ye commented May 19, 2020

Hi -- 0.6.5 should have solved this problem now. Could you upgrade taichi and verify if it works? Thx

@j20232
Copy link
Author

j20232 commented May 19, 2020

Hi, I tried now and it looks fine!
Thank you for your great work!

@k-ye
Copy link
Member

k-ye commented May 19, 2020

Great thanks!

@k-ye k-ye closed this as completed May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mac Mac OS X platform potential bug Something that looks like a bug but not yet confirmed
Projects
None yet
Development

No branches or pull requests

3 participants