Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

pytorch doesn't import using pythonnet

Discussion in 'Formats & External Tools Previews' started by jaejun_sim, Dec 5, 2022.

  1. jaejun_sim


    Nov 4, 2022
    i have a Issue for using pytorch with pythonnet

    First, I introduce my env.
    OS: windows10
    Unity version : 2019.4.24f1
    pythonnet version :
    cuda version : 10.1

    Second, Here is the Problem
    when i run python script(import torch) in empty unityproject, it is success
    but if i tried to run python script(import torch-gpu version) in my own unity project, it is fail

    and if i tried to run python script(import torch-cpu version) in my own unity project, it is success

    So i suspect that pytorch-gpu version can't load. but i need to load pytorch-gpu version for speed

    I wonder if some package or setting in Unity can make a crash when i load torch

    One more Thing is
    when i use python-unity with socket communication, python script(import torch-gpu version) run
  2. unity_28main28


    Feb 27, 2018
    Hey, I'm trying to do something similar. Did you ever figure out how to get it to work?