Import order matters: segmentation fault if PyTorch is imported before bpy #54561
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#54561
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Ubuntu 14.04 and 16.04
Blender Version
2.78, 2.79, 2.79a, 2.79b
Short description of error
Segmentation fault occurs if bpy module is imported first. It does not matter which version of PyTorch I am using; this always occurs.
Exact steps for others to reproduce the error
If I do
import torch
first and themimport bpy
I get a segmentation fault. I'm not picky about importing the other module first and then do import torch but for some reason, I need to doimport torch
first in my work and this has made things a bit complicated for me as I have had to invent ways to get around the segmentation fault issue. My guess is this is that bpy is trying to access some pre-allocated memory locations and this is causing the issue. I wonder if Blender developers can dig more into this issue. Below you can find the backtrace obtained viadgb bt
:However, if I do
import bpy
first and thenimport torch
backtrace would be empty and things work fine.Also, this is how I compile Blender and PyTorch after installing their dependencies:
Added subscriber: @AmirS
This comment was removed by @AmirS
This issue on PyTorch GitHub page might be helpful for the developers: https:*github.com/pytorch/pytorch/issues/6194
Based on one of the comments from one of PyTorch developers, it seems that bpy has some issues when initializing cuda if PyTorch is imported first.
This issue still persists ...
Closed as duplicate of blender/blender#57813