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

[Bug] [Python] Outdated python lib used on agent startup #13030

Closed
3 tasks done
henriquemeca opened this issue Feb 12, 2025 · 6 comments
Closed
3 tasks done

[Bug] [Python] Outdated python lib used on agent startup #13030

henriquemeca opened this issue Feb 12, 2025 · 6 comments
Assignees
Labels
feature New feature python Python agent related

Comments

@henriquemeca
Copy link

Search before asking

  • I had searched in the issues and found no similar issues.

Apache SkyWalking Component

OAP server (apache/skywalking)

What happened

I tried to start the django server with sw-python, but it failed in a setup step:

uv run sw-python run python -m manage runserver 0.0.0.0:8000

2025-02-12 09:03:40 skywalking-loader [pid:28] [MainThread] [ERROR] SkyWalking Python Agent failed to start, please inspect your package installation.Report issue if you think this is a bug, along with the log produced by specifying the -d debug flag.
2025-02-12 09:03:40 Traceback (most recent call last):
2025-02-12 09:03:40 File "/src/.venv/lib/python3.13/site-packages/skywalking/bootstrap/loader/sitecustomize.py", line 168, in
2025-02-12 09:03:40 agent.start() # CHECK: Not sure what happens when supervisor + gunicorn is used? Will it even work?
2025-02-12 09:03:40 ~~~~~~~~~~~^^
2025-02-12 09:03:40 File "/src/.venv/lib/python3.13/site-packages/skywalking/agent/init.py", line 244, in start
2025-02-12 09:03:40 plugins.install()
2025-02-12 09:03:40 ~~~~~~~~~~~~~~~^^
2025-02-12 09:03:40 File "/src/.venv/lib/python3.13/site-packages/skywalking/plugins/init.py", line 44, in install
2025-02-12 09:03:40 plugin = importer.find_module(modname).load_module(modname)
2025-02-12 09:03:40 ^^^^^^^^^^^^^^^^^^^^
2025-02-12 09:03:40 AttributeError: 'FileFinder' object has no attribute 'find_module'
2025-02-12 09:03:40 Watching for file changes with StatReloader

What you expected to happen

Apparently a the find_module was removed in python 3.12.
I believe the python agent needs an updated to newer python versions

How to reproduce

https://github.com/henriquemeca/skywalking-python-agent-issue
Follow the readme for setup

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

@henriquemeca henriquemeca added the bug Something isn't working and you are sure it's a bug! label Feb 12, 2025
@henriquemeca henriquemeca changed the title [Bug] [Python] [Bug] [Python] Outdated python lib used on agent startup Feb 12, 2025
@wu-sheng wu-sheng added the python Python agent related label Feb 12, 2025
@kezhenxu94 kezhenxu94 removed the bug Something isn't working and you are sure it's a bug! label Feb 12, 2025
@henriquemeca
Copy link
Author

Hi @kezhenxu94, I've seen you removed the the bug tag. Have you found any workarround on the error ?

@kezhenxu94
Copy link
Member

Hi @kezhenxu94, I've seen you removed the the bug tag. Have you found any workarround on the error ?

Python 3.12 is not in our supported list so this is basically a feature request not a bug in my opinion. We will need some time to investigate how to deal with the removal of the method in 3.12

@wu-sheng wu-sheng added the feature New feature label Feb 12, 2025
@henriquemeca
Copy link
Author

I'm having issues to fill all the PR requirements due to architecture incompatibilities.
But if I may suggest a solution, a change in the skywalking/plugins/__init__.py file was enough to solve the issue locally.

        if sys.version_info < (3, 12):
            plugin = importer.find_module(modname).load_module(modname)
        else: 
            plugin = importlib.util.module_from_spec(importer.find_spec(modname))

Does it make sense to continue with it ?

@kezhenxu94
Copy link
Member

I'm having issues to fill all the PR requirements due to architecture incompatibilities. But if I may suggest a solution, a change in the skywalking/plugins/__init__.py file was enough to solve the issue locally.

        if sys.version_info < (3, 12):
            plugin = importer.find_module(modname).load_module(modname)
        else: 
            plugin = importlib.util.module_from_spec(importer.find_spec(modname))

Does it make sense to continue with it ?

Thanks for the detail. Yes can you please file a pull request with the change?

@henriquemeca
Copy link
Author

@kezhenxu94
Copy link
Member

Done @kezhenxu94 apache/skywalking-python#366

thanks, will take a look soon

@wu-sheng wu-sheng added this to the Python - 1.2.0 milestone Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature python Python agent related
Projects
None yet
Development

No branches or pull requests

3 participants