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

ModuleNotFoundError: When running RFSwarm-Agent on Python 3.12 #177

Closed
damies13 opened this issue Feb 16, 2024 · 11 comments
Closed

ModuleNotFoundError: When running RFSwarm-Agent on Python 3.12 #177

damies13 opened this issue Feb 16, 2024 · 11 comments
Labels
Agent Issue Affects the Agent bug Something isn't working
Milestone

Comments

@damies13
Copy link
Owner

damies13 commented Feb 16, 2024

ModuleNotFoundError: When running RFSwarm-Agent on Python 3.12

Occurs on Windows, MacOS & Ubuntu github actions, but interestingly though the help and version screens fail it appears the agent will actually run robots with this error.


Traceback (most recent call last):
File "/Users/runner/work/rfswarm/rfswarm/rfswarm_agent/rfswarm_agent.py", line 34, in
import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'


@damies13 damies13 added potential bug Might be a bug, requires further clarification bug Something isn't working Agent Issue Affects the Agent and removed potential bug Might be a bug, requires further clarification labels Feb 16, 2024
@damies13
Copy link
Owner Author

https://stackoverflow.com/questions/49923671/are-there-any-function-replacement-for-pip-get-installed-distributions-in-pip

This works on Python 3.9.10

import importlib.metadata
>>> dists = importlib.metadata.distributions()
>>> for dist in dists:
...     if "robot" in dist.metadata["Name"]:
...             print(dist.metadata["Name"], dist.version)
... 
robotframework-sshlibrary 3.8.0
robotframework-browser 11.1.1
robotframework-seleniumlibrary 6.0.0
robotframework-jsonvalidator 2.0.0
robotframework 6.0.2
robotframework-imagehorizonlibrary 1.0
robotframework-listenerlibrary 1.0.3
robotframework-SikuliLibrary 2.0.0
robotframework-pythonlibcore 3.0.0
robotframework-faker 5.0.0
robotframework-datadriver 1.7.0
robotframework-perfmon 0.1
robotframework-requests 0.9.4
robotframework-assertion-engine 0.2.0
>>> 

@damies13
Copy link
Owner Author

https://docs.python.org/3.11/library/importlib.metadata.html#module-importlib.metadata

module importlib.metadata

New in version 3.8.
Changed in version 3.10: importlib.metadata is no longer provisional.

damies13 added a commit that referenced this issue Feb 17, 2024
And also as give a little performance boost to python versions 3.8 - 3.11
@damies13
Copy link
Owner Author

Now the agent appears fixed on 3.12, the manager is getting errors when trying to run the test case

Turning this issue into a general any python 3.12 related issues until test case I created for Issue #171 can run sucessfully under python 3.12

New Error (repeats over and over:

-----stderr_manager.txt-----
----------------------------------------
Exception occurred during processing of request from ('127.0.0.1', 42518)
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/socketserver.py", line 318, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/socketserver.py", line 706, in process_request
    t.start()
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/threading.py", line 9[92](https://github.com/damies13/rfswarm/actions/runs/7943062028/job/21687004766#step:5:93), in start
    _start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown
----------------------------------------

@damies13
Copy link
Owner Author

Maybe related

getsentry/sentry-python#2299

@damies13
Copy link
Owner Author

damies13 added a commit that referenced this issue Feb 18, 2024
Attempts to resolve RuntimeError: can't create new thread at interpreter shutdown
Issue #177
@damies13
Copy link
Owner Author

Also probbaly related

https://stackoverflow.com/questions/2846653/how-do-i-use-threading-in-python

This is begining to look like a bigger issue than I expected

@damies13
Copy link
Owner Author

I think I'm being impacted by this bug:
python/cpython#115533

@damies13
Copy link
Owner Author

This is interesting, looks like the is a workaround with sleep?
python/cpython#113964

damies13 added a commit that referenced this issue Feb 18, 2024
Workaround in python/cpython#113964 worked
Now just tuned from 300 sec to 10 sec in the loop, no need to wait 5 min after base.run_dbthread is set false, 10 sec should be plenty, actually 1 would probably be enough.
Cut debugging in test back to level 1
Issue #177
@damies13
Copy link
Owner Author

Fixes for Issue #177 merged into release branch v1.2.1

@damies13
Copy link
Owner Author

All tests and linter passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Agent Issue Affects the Agent bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant