Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run Austin against pyenv python distribution #204

Closed
sihil opened this issue Sep 12, 2023 · 3 comments
Closed

Can't run Austin against pyenv python distribution #204

sihil opened this issue Sep 12, 2023 · 3 comments

Comments

@sihil
Copy link

sihil commented Sep 12, 2023

Description

Struggling to get Austin running against pytest on MacOS due to what I am currently assuming is missing debug symbols in my python. I've reduced this to a minimal test case below.

Steps to Reproduce

  1. Install python via pyenv
  2. Run austin python -c "from time import sleep;sleep(4)"

Expected behavior: Austin starts process and outputs profiling data.

Actual behavior: Austin tells me It looks like you are trying to profile a process that is not a Python process.

Reproduces how often: 100%

Versions

austin 3.5.0 (via homebrew)
macOS 13.4.1 on a 2019 MacBookPro (Intel)
Python (various, all from pyenv)

Additional Information

When installing a version of python the build process seems to pull in libraries from various places so I wonder if this is the variable that is causing this to fail. This is the output from building 3.8.16:

❯ pyenv install 3.8.16
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.16.tar.xz...
-> https://www.python.org/ftp/python/3.8.16/Python-3.8.16.tar.xz
Installing Python-3.8.16...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.8.16 to /Users/sihil/.pyenv/versions/3.8.16

This is an example run:

❯ austin --version
austin 3.5.0

❯ pyenv versions
  system
  3.8.6
  3.8.10
  3.8.10/envs/document-enhancement
* 3.8.16 (set by /Users/sihil/.python-version)
  3.9.11
  3.10.12
  document-enhancement --> /Users/sihil/.pyenv/versions/3.8.10/envs/document-enhancement

❯ python --version
Python 3.8.16

❯ austin python -c "from time import sleep;sleep(4)"
              _   _
 __ _ _  _ __| |_(_)_ _
/ _` | || (_-<  _| | ' \
\__,_|\_,_/__/\__|_|_||_| 3.5.0 [GCC 4.2.1]

👾 It looks like you are trying to profile a process that is not a Python
process. Make sure that you are targeting the right application. If the Python
process is actually a child of the target process then use the -C option to
discover it automatically.

❯ nm -gD /Users/sihil/.pyenv/versions/3.8.16/lib/libpython3.8.dylib
/Library/Developer/CommandLineTools/usr/bin/nm: error: /Users/sihil/.pyenv/versions/3.8.16/lib/libpython3.8.dylib: File format has no dynamic symbol table
@P403n1x87
Copy link
Owner

@sihil thanks for reporting this. What happens if you run this instead?

sudo austin -t 1s python -c "from time import sleep;sleep(4)"

Does it still fail to emit samples?

@sihil
Copy link
Author

sihil commented Sep 13, 2023

Oh no 🤦 that's working now and I can now see where the readme says Austin requires the use of sudo to work on MacOS.

Perhaps that error message could be enhanced on macOS to aide future impatient users 😳

@P403n1x87
Copy link
Owner

@sihil thank you very much for confirming and the feedback! If you have the time, perhaps you can test Austin from the devel branch. It should already have the more informative error message pointing to the use of sudo in this case (#173). It will be part of the 3.6 release, which should land in October, after Python 3.12 is released 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants