P403n1x87 / austin-vscode

Austin extension for Visual Studio Code
MIT License
21 stars 4 forks source link

Process exited with code -2 #61

Open yeswecan opened 7 months ago

yeswecan commented 7 months ago

Hello there! Here's the error that I get:

 *  Executing task: austin: profile /home/k4/Projects/JingleGenerator/vocalframe_reconstruction_speedtest.py 

Starting Profiler in /home/k4/Projects/JingleGenerator.
Running 'austin' with args '-i 100 --pipe /home/k4/gpu_ml_env/bin/python /home/k4/Projects/JingleGenerator/vocalframe_reconstruction_speedtest.py'.
spawn austin ENOENTaustin process exited with code -2

 *  The terminal process failed to launch (exit code: -2). 
 *  Terminal will be reused by tasks, press any key to close it. 

I tried a lot of stuff with no luck so far, also no more descriptive errors. Austin is installed and seems to run ok (well, it starts and the version is current at 3.6.0, I wish I knew how to test it in command line). I'm on Ubuntu 20.04.

GiraffeReversed commented 7 months ago

Hi, I have nothing in common with this project but I encountered the same problem yesterday. What helped me was to run exactly what the message says, from the command line. (For you, that would be austin -i 100 --pipe /home/k4/gpu_ml_env/bin/python /home/k4/Projects/JingleGenerator/vocalframe_reconstruction_speedtest.py in folder /home/k4/Projects/JingleGenerator.) Then I could see the stderr output, which helped me discover the problem (botched austin installation in my case).

P403n1x87 commented 7 months ago

@yeswecan thanks for reporting this, and thanks @GiraffeReversed for chiming in to help. To reinforce what's already been said in the comments, the ENOENT error seems to point to VS Code not finding the austin binary. In that case, the Austin VS Code extension has an option that allows specifying the full path of the austin binary. You could try pasting there the output of which austin and see if that helps.

etherealite commented 2 months ago

I have the exact same issue. In my case I have python installed as a VENV in Debian 12.7 on Windows WSL.

From inside the VSCODE Bash shell:

me@place:~/project$ echo $PATH | tr ':' '\n' | grep  "\.venv"
/home/etherealite/roadie/.venv/bin
/home/etherealite/roadie/.venv/bin

me@place:~/project$ ls /home/etherealite/roadie/.venv/bin
activate      activate.csh   activate.nu   activate_this.py  austinp     deactivate.bat  g4f   monkeytype  normalizer  python   python3.12  waitress-serve
activate.bat  activate.fish  activate.ps1  austin            chardetect  flask           lute  mss         pydoc.bat   python3  ruff

me@place:~/project$ which austin
/home/etherealite/roadie/.venv/bin/austin

me@place:~/project$ austin
Usage: austin [-bCefgmPs?V] [-h n_mb] [-i n_us] [-o FILE] [-p PID] [-t n_ms]
            [-w PID] [-x n_sec] [--binary] [--children] [--exclude-empty]
            [--full] [--gc] [--heap=n_mb] [--interval=n_us] [--memory]
            [--output=FILE] [--pid=PID] [--pipe] [--sleepless] [--timeout=n_ms]
            [--where=PID] [--exposure=n_sec] [--help] [--usage] [--version]
            command [ARG...]

Yet the plugin cannot discover the path of the bin unless I set it explicitly in

"austin.path": "/home/etherealite/roadie/.venv/bin/austin"
umarbutler commented 2 months ago

@P403n1x87 Are there any updates on when we can expect a fix for this?

P403n1x87 commented 2 months ago

Apologies for the inconvenience caused by this issue, but I don't think there is a way of fixing this (at least that I know of). The Windows installer used by choco should set the binary on the PATH. If that's not the case, either add the PATH manually to your environment variables, or configure the VS Code extension to point to the binary. It seems that installing Austin with austin-dist (system-wise) might work provided the Python scripts folder is already on the PATH. The VS Code extension doesn't have support for virtual environments, so if you install Austin in one you would have to specify the path in the configuration. I don't know if there is a way of querying the Python extension to get venv information to improve this, I would have to look into that.

etherealite commented 2 months ago

Hi, @P403n1x87 I'm very appreciative for you taking the time to respond to our questions.

I think it would greatly improve the user experience if the ##Usage section of the README.md could be amended to include this disclaimer about virtual environments.

**NOTE**: When using a Python Virtual Environment
> You will need to manually add the path of the austin binary to the plugins' 
> settings. You can do so by searching settings for `austin.path` and entering
> the aboslute path to the bin, such as `/home/user/project/.venv/bin/austin` for 
> example.

**NOTE**: MacOS users 
> You should consider the following youadding a rule for Austin to their
> `sudoers` file. This will allow you to run `sudo austin ...` without having to
...