Python rpy2 and matplotlib conflict when using multiprocessing

前端 未结 5 1812
误落风尘
误落风尘 2021-02-07 14:14

I am trying to calculate and generate plots using multiprocessing. On Linux the code below runs correctly, however on the Mac (ML) it doesn\'t, giving the error below:



        
5条回答
  •  你的背包
    2021-02-07 15:13

    Try to upgrade matplotlib to 3.0.3:

    pip3 install matplotlib --upgrade
    

    Then everything goes fine.

    =======================================================================

    No need to read below anymore.

    Yesterday, my multiprocess plot works on my MacBook Air. But not working on my MacBook Pro tomorrow morning with the same code, displaying many:

    The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
    Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
    The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
    

    They are all using 4th gen i intel CPU (i5-4xxx with air and i7-4xxx with pro). So if there are no difference on hardware, it must be on software.

    So I just tried update matplot to 3.0.3 on MacBook Pro( was 3.0.1), every thing goes fine.

    Also, no need to do pool.apply_async anymore.

提交回复
热议问题