AttributeError with sweep

When I activated my sweep agent, I got AttributeError as following:

Thread HandlerThread:
Traceback (most recent call last):
File “/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/internal_util.py”, line 50, in run
self._run()
File “/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/internal_util.py”, line 101, in _run
self._process(record)
File “/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/internal.py”, line 263, in _process
self._hm.handle(record)
File “/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/handler.py”, line 130, in handle
handler(record)
File “/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/handler.py”, line 140, in handle_request
handler(record)
File “/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/handler.py”, line 666, in handle_request_run_start
self._system_stats = stats.SystemStats(
File “/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/stats.py”, line 76, in init
self._pid = settings._stats_pid
AttributeError: ‘SettingsStatic’ object has no attribute ‘_stats_pid’

However, the code ‘main.py’ is ran correctly without sweep…
How can I fix this issue so I can use sweep agent?
I do really appreciate your help.

Hi SeungHwan! This issue could be probably related to wandb.init(). Using if __name__ == __main__ or setting start_method='thread' should help out here. If you’re still running into issues after trying this, can you send me your debug logs found in your wandb run directory please?

1 Like

Thank you for your prompt response and your suggestion.

I already used if name == main, so I tried to set settings=dict(start_method="thread") in wandb.init(). However, the same issue happens to me…

Debug log is:

2022-10-10 10:51:21,749 INFO    StreamThr :85970 [internal.py:wandb_internal():88] W&B internal server running at pid: 85970, started at: 2022-10-10 10:51:21.715580
2022-10-10 10:51:21,750 DEBUG   HandlerThread:85970 [handler.py:handle_request():138] handle_request: status
2022-10-10 10:51:21,751 DEBUG   SenderThread:85970 [sender.py:send_request():315] send_request: status
2022-10-10 10:51:21,752 DEBUG   SenderThread:85970 [sender.py:send():301] send: header
2022-10-10 10:51:21,752 DEBUG   SenderThread:85970 [sender.py:send():301] send: run
2022-10-10 10:51:21,753 INFO    WriterThread:85970 [datastore.py:open_for_write():75] open: /home1/prof/jeon/an/causal_vae/wandb/run-20221010_105121-ear9tkf4/run-ear9tkf4.wandb
2022-10-10 10:51:22,310 DEBUG   HandlerThread:85970 [handler.py:handle_request():138] handle_request: check_version
2022-10-10 10:51:22,313 INFO    SenderThread:85970 [dir_watcher.py:__init__():216] watching files in: /home1/prof/jeon/an/causal_vae/wandb/run-20221010_105121-ear9tkf4/files
2022-10-10 10:51:22,313 INFO    SenderThread:85970 [sender.py:_start_run_threads():912] run started: ear9tkf4 with start time 1665366681.0
2022-10-10 10:51:22,313 DEBUG   SenderThread:85970 [sender.py:send():301] send: summary
2022-10-10 10:51:22,354 INFO    SenderThread:85970 [sender.py:_save_file():1155] saving file wandb-summary.json with policy end
2022-10-10 10:51:22,355 DEBUG   SenderThread:85970 [sender.py:send_request():315] send_request: check_version
2022-10-10 10:51:22,455 DEBUG   HandlerThread:85970 [handler.py:handle_request():138] handle_request: run_start
2022-10-10 10:51:22,756 INFO    WriterThread:85970 [datastore.py:close():279] close: /home1/prof/jeon/an/causal_vae/wandb/run-20221010_105121-ear9tkf4/run-ear9tkf4.wandb
2022-10-10 10:51:23,314 INFO    Thread-14 :85970 [dir_watcher.py:_on_file_created():275] file/dir created: /home1/prof/jeon/an/causal_vae/wandb/run-20221010_105121-ear9tkf4/files/wandb-summary.json
2022-10-10 10:51:23,445 INFO    SenderThread:85970 [sender.py:finish():1315] shutting down sender
2022-10-10 10:51:23,445 INFO    SenderThread:85970 [dir_watcher.py:finish():362] shutting down directory watcher
2022-10-10 10:51:24,315 INFO    SenderThread:85970 [dir_watcher.py:finish():392] scan: /home1/prof/jeon/an/causal_vae/wandb/run-20221010_105121-ear9tkf4/files
2022-10-10 10:51:24,315 INFO    SenderThread:85970 [dir_watcher.py:finish():406] scan save: /home1/prof/jeon/an/causal_vae/wandb/run-20221010_105121-ear9tkf4/files/config.yaml config.yaml
2022-10-10 10:51:24,316 INFO    SenderThread:85970 [dir_watcher.py:finish():406] scan save: /home1/prof/jeon/an/causal_vae/wandb/run-20221010_105121-ear9tkf4/files/wandb-summary.json wandb-summary.json
2022-10-10 10:51:24,316 INFO    SenderThread:85970 [file_pusher.py:finish():168] shutting down file pusher
2022-10-10 10:51:24,316 INFO    SenderThread:85970 [file_pusher.py:join():173] waiting for file pusher
2022-10-10 10:51:25,062 INFO    Thread-17 :85970 [upload_job.py:push():139] Uploaded file /home1/prof/jeon/an/causal_vae/wandb/run-20221010_105121-ear9tkf4/files/config.yaml
2022-10-10 10:51:25,069 INFO    Thread-18 :85970 [upload_job.py:push():139] Uploaded file /home1/prof/jeon/an/causal_vae/wandb/run-20221010_105121-ear9tkf4/files/wandb-summary.json
2022-10-10 10:51:25,519 ERROR   StreamThr :85970 [internal.py:wandb_internal():163] Thread HandlerThread:
Traceback (most recent call last):
  File "/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/internal_util.py", line 50, in run
    self._run()
  File "/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/internal_util.py", line 101, in _run
    self._process(record)
  File "/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/internal.py", line 263, in _process
    self._hm.handle(record)
  File "/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/handler.py", line 130, in handle
    handler(record)
  File "/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/handler.py", line 140, in handle_request
    handler(record)
  File "/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/handler.py", line 666, in handle_request_run_start
    self._system_stats = stats.SystemStats(
  File "/home1/prof/jeon/anaconda3/envs/deep/lib/python3.10/site-packages/wandb/sdk/internal/stats.py", line 76, in __init__
    self._pid = settings._stats_pid
AttributeError: 'SettingsStatic' object has no attribute '_stats_pid'

Thank you for the debug log! Can you also send me the link to your workspace so I can see if I can find anything there since the error is still the same as in the previous message? Also, for good measure, if you’re not using our most recent version, can you upgrade to it and see if that’s able to help?

Hi Seunghwan, do you still need help here?

Hi Seunghwan, since we have not heard back from you we are going to close this request. If you would like to re-open the conversation, please let us know!