stark-t / PAI

Pollination_Artificial_Intelligence
5 stars 1 forks source link

YOLOv7 error "wandb: ERROR api_key not configured (no-tty)" #32

Closed valentinitnelav closed 2 years ago

valentinitnelav commented 2 years ago

I tried to set up YOLOv7 on the Clara cluster, but I get this annoying wandb login error:

wandb: ERROR api_key not configured (no-tty). call wandb.login(key=[your_api_key])
Traceback (most recent call last):
  File "~/PAI/detectors/yolov7/train.py", line 609, in <module>
    train(hyp, opt, device, tb_writer)
  File "~/PAI/detectors/yolov7/train.py", line 72, in train
    wandb_logger = WandbLogger(opt, Path(opt.save_dir).stem, run_id, data_dict)
  File "~/PAI/detectors/yolov7/utils/wandb_logging/wandb_utils.py", line 95, in __init__
    self.wandb_run = wandb.init(config=opt,
  File "~/.local/lib/python3.9/site-packages/wandb/sdk/wandb_init.py", line 867, in init
    wi.setup(kwargs)
  File "~/.local/lib/python3.9/site-packages/wandb/sdk/wandb_init.py", line 167, in setup
    wandb_login._login(
  File "~/.local/lib/python3.9/site-packages/wandb/sdk/wandb_login.py", line 274, in _login
    wlogin.prompt_api_key()
  File "~/.local/lib/python3.9/site-packages/wandb/sdk/wandb_login.py", line 209, in prompt_api_key
    raise UsageError("api_key not configured (no-tty). call " + directive)
wandb.errors.UsageError: api_key not configured (no-tty). call wandb.login(key=[your_api_key])

I tried to look into this, but not sure how to fix it. This doesn't happen with YOLOv5. wandb is not installed in the environment as it is commented out in yolov7/requirements.txt. wandb is a 3rd party API service for monitoring the runs in the browser, but I do not need this when running from the cluster, especially since sometimes nodes do not have internet access.

Any ideas?

valentinitnelav commented 2 years ago

A bit strange, but this is what I did on the cluster below. Installing and then uninstalling wandb in the yolov7 environment fixed this.

The pip uninstall wandb idea was suggested here: https://github.com/wandb/client/issues/764#issuecomment-726029795

[user@galaxy138 ~]$ source ~/venv/yolov7/bin/activate

(yolov7) [user@galaxy138 ~]$ module load Python/3.9.6-GCCcore-11.2.0

(yolov7) [user@galaxy138 ~]$ pip install wandb

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: wandb in ./.local/lib/python3.9/site-packages (0.12.6)
Requirement already satisfied: six>=1.13.0 in /software/all/Python/3.9.6-GCCcore-11.2.0/lib/python3.9/site-packages (from wandb) (1.16.0)
Requirement already satisfied: sentry-sdk>=1.0.0 in ./.local/lib/python3.9/site-packages (from wandb) (1.4.3)
Requirement already satisfied: Click!=8.0.0,>=7.0 in /software/all/Python/3.9.6-GCCcore-11.2.0/lib/python3.9/site-packages (from wandb) (8.0.1)
Requirement already satisfied: python-dateutil>=2.6.1 in /software/all/Python/3.9.6-GCCcore-11.2.0/lib/python3.9/site-packages (from wandb) (2.8.2)
Requirement already satisfied: shortuuid>=0.5.0 in ./.local/lib/python3.9/site-packages (from wandb) (1.0.1)
Requirement already satisfied: pathtools in ./.local/lib/python3.9/site-packages (from wandb) (0.1.2)
Requirement already satisfied: PyYAML in ./.local/lib/python3.9/site-packages (from wandb) (6.0)
Requirement already satisfied: yaspin>=1.0.0 in ./.local/lib/python3.9/site-packages (from wandb) (2.1.0)
Requirement already satisfied: requests<3,>=2.0.0 in /software/all/Python/3.9.6-GCCcore-11.2.0/lib/python3.9/site-packages (from wandb) (2.26.0)
Requirement already satisfied: configparser>=3.8.1 in ./.local/lib/python3.9/site-packages (from wandb) (5.0.2)
Requirement already satisfied: promise<3,>=2.0 in ./.local/lib/python3.9/site-packages (from wandb) (2.3)
Requirement already satisfied: subprocess32>=3.5.3 in ./.local/lib/python3.9/site-packages (from wandb) (3.5.4)
Requirement already satisfied: GitPython>=1.0.0 in ./.local/lib/python3.9/site-packages (from wandb) (3.1.24)
Requirement already satisfied: psutil>=5.0.0 in /software/all/Python/3.9.6-GCCcore-11.2.0/lib/python3.9/site-packages (from wandb) (5.8.0)
Requirement already satisfied: docker-pycreds>=0.4.0 in ./.local/lib/python3.9/site-packages (from wandb) (0.4.0)
Requirement already satisfied: protobuf>=3.12.0 in ./.local/lib/python3.9/site-packages (from wandb) (3.19.1)
Requirement already satisfied: gitdb<5,>=4.0.1 in ./.local/lib/python3.9/site-packages (from GitPython>=1.0.0->wandb) (4.0.9)
Requirement already satisfied: typing-extensions>=3.7.4.3 in ./.local/lib/python3.9/site-packages (from GitPython>=1.0.0->wandb) (3.10.0.2)
Requirement already satisfied: smmap<6,>=3.0.1 in ./.local/lib/python3.9/site-packages (from gitdb<5,>=4.0.1->GitPython>=1.0.0->wandb) (5.0.0)
Requirement already satisfied: certifi>=2017.4.17 in /software/all/Python/3.9.6-GCCcore-11.2.0/lib/python3.9/site-packages (from requests<3,>=2.0.0->wandb) (2021.5.30)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /software/all/Python/3.9.6-GCCcore-11.2.0/lib/python3.9/site-packages (from requests<3,>=2.0.0->wandb) (1.26.6)
Requirement already satisfied: charset-normalizer~=2.0.0 in /software/all/Python/3.9.6-GCCcore-11.2.0/lib/python3.9/site-packages (from requests<3,>=2.0.0->wandb) (2.0.4)
Requirement already satisfied: idna<4,>=2.5 in /software/all/Python/3.9.6-GCCcore-11.2.0/lib/python3.9/site-packages (from requests<3,>=2.0.0->wandb) (3.2)
Requirement already satisfied: termcolor<2.0.0,>=1.1.0 in ./.local/lib/python3.9/site-packages (from yaspin>=1.0.0->wandb) (1.1.0)
WARNING: You are using pip version 21.2.2; however, version 22.1.2 is available.
You should consider upgrading via the '/software/all/Python/3.9.6-GCCcore-11.2.0/bin/python3.9 -m pip install --upgrade pip' command.

(yolov7) [user@galaxy138 ~]$ pip uninstall wandb

Found existing installation: wandb 0.12.6
Uninstalling wandb-0.12.6:
  Would remove:
    /home/sc.uni-leipzig.de/user/.local/bin/wandb
    /home/sc.uni-leipzig.de/user/.local/bin/wb
    /home/sc.uni-leipzig.de/user/.local/lib/python3.9/site-packages/wandb-0.12.6.dist-info/*
    /home/sc.uni-leipzig.de/user/.local/lib/python3.9/site-packages/wandb/*
Proceed (Y/n)? y
  Successfully uninstalled wandb-0.12.6

(yolov7) [user@galaxy138 ~]$ deactivate