-
Notifications
You must be signed in to change notification settings - Fork 619
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
[AttributeError] module 'wandb' has no attribute 'init' #5950
Comments
My guess is that you have either:
These would cause the import to resolve to the local files instead of the installed |
thanks for your kind help
|
I did another test , it proves code has referential relationship dose not cause the error . crazy!!!!
I did another test , it proves code has referential relationship dose not cause the error . crazy!!!! |
I am sorry I did not make it clear. Do not remove the |
Thank you so much. |
Then I guess the python you used in your project code is not finding wandb correctly. You may try printing You may try moving the If that works, it is a name resolution order issue; if that did not work with 'no module named wandb', then the path to conda is corrupted in your project. In either case you should check for files that modified If that still fails with the same |
I tried everything you said,
Sadly , my project is so coupled it's hard to take out the smallest part of the instances. Anyway thanks so much for your help. As much as this bug is killing me, I feel very lucky to have your answer. P.S.
|
Did you print that |
I do print the
this is the result:
|
See, you are missing You should fix these root causes. If you still cannot figure it out though, a workaround could be: import sys
sys.path.insert(0, 'C:/Users/lyk/.conda/envs/sevenpython36/Lib/site-packages')
import wandb
wandb.init(project="cortex22_anna") |
OMG, I think I found the difference between the correct code and the error code sys.path, in the test code sys.path is correct, but in the error code the path is really the local python environment path. 'F:\python\python36.zip', 'F:\python\DLLs', 'F:\python\lib', 'F:\python', 'F:\python\lib\site-packages'] I find that though my pycharm environment is set up as my conda environment but my project code 's run configuration has been set up as local python interpreter!! |
@eliphatfs Thanks a lot for your help! |
install the 0.15.6 version of wandb in my anaconda python environment , and successfully login my account. Then i wrote a simple test code using wandb. everything was fine, i got the plot.
Question: But when I added wandb code to my project code , An attribute Error was reported.
this is the code that reported error
`from .Enterprise import Enterprise
from .Bank import Bank
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import os
import time
import shutil
from pandas import DataFrame
import wandb
wandb.init(project="cortex22_anna")
plt.rcParams["font.sans-serif"]=["SimHei"] #设置字体
plt.rcParams["axes.unicode_minus"]=False #该语句解决图像中的“-”负号的乱码问题
base_path_default = 'E:\run'
class Logger:{...}
`
The text was updated successfully, but these errors were encountered: