NSight Systems With Anaconda on Windows


I’m trying to profile the training/inference of a CNN using Nsight. The issue is that the script runs within a conda environment. How can I configure the Nsight to run the script in the designated environment?

So far I tried inserting the python interpreter in Nsight GUI but that doesn’t work

What’s the right solution? running nsys as CLI from the environment terminal?


Hi Yuval,

Thanks for reaching out.

I tested the scenario you described and have concluded there is a bug in Nsight Systems 2021.1.1 that prevents the tracing of this scenario on Windows.
The bug fix will be included in the next NVIDIA Nsight Systems public release.
Note: to trace anaconda python with Nsight Systems, use a simple batch file similar to the one below. You can designate the batch file as the target app that Nsight Systems will launch for profiling. Either the CLI or the host GUI can be used to launch this batch file.


Sample batch file for launching Anaconda python scripts:

call f:\anaconda3\condabin\conda_hook.bat
call conda activate base
f:\anaconda3\python.exe main.py

Hi, Thanks for the answer!
I modified the suggested batch file to fit my environment but still Nsight Systems can’t handle it (something crashes during profiling…). On the other hand, running the my script from the default CLI works well. One minor difference between us might be that you are using the “base” environment while I’m using a regular conda environment. For comparison, my batch file is as follows:

call C:\Users\Yuval\Anaconda3\condabin\conda_hook.bat
call conda activate pyTorch
C:\Users\Yuval\Anaconda3\envs\pyTorch\python.exe D:\pythonProjects\PytorchProfile\main.py

Can you please try profiling inside a standard environment?
Is there any information about my system I can provide that will help debugging? Any other advice?


Hi Yuval,
This bug is fixed in the upcoming Nsight Systems release 2021.3.1. Thanks for reporting it.

I have the same problem in Linux right now. Even though I changed the default environment of conda, still when I use nsys command line, it does not recognize my conda environment. How can I solve this problem?

now I experience the same issue, the program runs well, but once I profile with nsight-system, error like “module not found” occered, so have you ever solved the problem?

@tcourtney can you lend a hand here?

@lylyly6666 could you give more details about your error? What was the full command line that you ran? Which version of nsys are you using? What python application are you running?

It would be great if you could provide enough details so that we could try to reproduce the problem here.

This is the batch file I used:

call C:\Users\User\Anaconda3\condabin\conda_hook.bat
call conda activate matmulopt
C:\Users\User\Anaconda3\envs\matmulopt\python.exe C:\matmulopt\quicktest.py

I tried running the batch file from the GUI. The batch file is in C:/, same as working dir. This is what I got:

I doubt it got far enough to attempt running the python script, since changing the name to one that isn’t present doesn’t change the error.
Program versions are as follows: Conda 23.5.0, python 3.9.6 (in conda env), Nsight Systems 2023.1.2
This might be the same issue lylyly6666 is experiencing. Hope it was helpful