AttributeError: partially initialized module 'wandb' has no attribute 'Api' (most likely due to a circular import)
See original GitHub issuewandb --version && python --version && uname
- Weights and Biases version: 0.9.4
- Python version: 3.8
- Operating System: Ubuntu
Description
wandb
has no attribute Api
when trying to run on my laptop and github actions.
Error message on local (macOS 10.15.6): AttributeError: module 'wandb' has no attribute 'Api'
Error message on github actions: AttributeError: partially initialized module 'wandb' has no attribute 'Api' (most likely due to a circular import)
What I Did
Same code from the docs, modified to my needs
import os
import datetime
import pandas
import wandb
import json
os.environ['WANDB_API_KEY'] = '*******************************'
api = wandb.Api()
projects = api.projects()
project_list = [p.name for p in projects]
entity = [p.entity for p in projects]
summary_list = []
config_list = []
name_list = []
for i, p in enumerate(project_list):
for run in api.runs(f'{entity[i]}/{p}'):
# run.summary are the output key/values like accuracy.
# We call ._json_dict to omit large files
summary_list.append(run.summary._json_dict)
# run.config is the input metrics.
# We remove special values that start with _.
config = {k: v for k, v in run.config.items() if not k.startswith('_')}
config_list.append(config)
# run.name is the name of the run.
name_list.append(run.name)
summary_df = pd.DataFrame.from_records(summary_list)
config_df = pd.DataFrame.from_records(config_list)
name_df = pd.DataFrame({'name': name_list})
df = pd.concat([name_df, config_df, summary_df], axis=1)
d = dict(df.loc[df['epoch_train_loss'].idxmin()])
with open(f'{p}.json', 'w') as f:
json.dump(d, f)
Error trace from github actions ⬇️
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
partially initialized module 'wandb' has no attribute 'Api' (most ...
AttributeError : partially initialized module 'wandb' has no attribute 'Api' (most likely due to a circular import) #1186.
Read more >How to fix AttributeError: partially initialized module? [duplicate]
So my code was actually importing that file and not the actual requests ... "Most likely due to a circular import" refers to...
Read more >attributeerror: module 'wandb' has no attribute 'init' - You.com
... in <module> run = wandb.init( AttributeError: partially initialized module 'wandb' has no attribute 'init' (most likely due to a circular import).
Read more >AttributeError: partially initialized module has no attribute ...
AttributeError : partially initialized module 'MODULE_NAME' has no attribute 'ATTRIBUTE_NAME' (most likely due to a circular import).
Read more >module 'wandb' has no attribute 'init'とでたら - Qiita
AttributeError : module 'wandb' has no attribute 'init'. とエラーがでた。前は動いてたはずなのに... Copied! pip install --upgrade wandb.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
hey @ydcjeff can you please rename the file from wandb.py to something else, and make sure there is no file named wandb.py in the directory, and try running the code again?
Thank you for reporting! Looking into this.