question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

api_key not configured OSX Big Sur - PyCharm

See original GitHub issue

Describe the bug

Unable to run wandb.init() from PyCharm - macOS Big Sur

To Reproduce [in PyCharm**]

import wandb
wandb.init(name='name', project='project')

OUT:

Traceback (most recent call last):
  File "/Users/emadboctor/Desktop/DeepRL-TensorFlow2/DQN/DQN_Discrete.py", line 23, in <module>
    wandb.init(name='name', project='project')
  File "/usr/local/lib/python3.8/site-packages/wandb/sdk/wandb_init.py", line 572, in init
    wi.setup(kwargs)
  File "/usr/local/lib/python3.8/site-packages/wandb/sdk/wandb_init.py", line 138, in setup
    wandb_login._login(anonymous=anonymous, force=force, _disable_warning=True)
  File "/usr/local/lib/python3.8/site-packages/wandb/sdk/wandb_login.py", line 202, in _login
    wlogin.prompt_api_key()
  File "/usr/local/lib/python3.8/site-packages/wandb/sdk/wandb_login.py", line 144, in prompt_api_key
    raise UsageError("api_key not configured (no-tty).  Run wandb login")
wandb.errors.error.UsageError: api_key not configured (no-tty).  Run wandb login

It runs fine from the terminal (same interpreter python 3.8.6)

>>> import wandb
>>> wandb.init(name='name, project='project')
wandb: (1) Create a W&B account
wandb: (2) Use an existing W&B account
wandb: (3) Don't visualize my results
wandb: Enter your choice: 

Expected behavior

Same behavior as the terminal.

Screenshots If applicable, add screenshots to help explain your problem.

Operating System

  • OS: macOS 11.0.1 (Big Sur)
  • Version [e.g. 22]

Additional context wandb v0.10.12

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
xbbkokcommented, Mar 28, 2021

Hey @emadboctorx Thanks for the ticket. We will get into this as soon as possible. Until then, the workaround would be to run wandb login in your terminal and authorize yourself. This will add a ~/.netrc file in your system that has your api-key. After this, wandb.init() would work as required.

Let us know if this solves the issue. Your concern about the different behaviours in the script and terminal is taken under consideration.

CC: @cvphelps @vanpelt could you look into this?

Thanks! Today I encountered the same problem,and this way solved it!!

1reaction
nialloh23commented, Feb 23, 2021

@ariG23498 This workaround of manually logging in from the terminal worked for me. This got a little frustrating after a while as you end up having to do it quite often. I found a better fix which involved using the API to explicitly login at the start of my script. Some context: this issue started affecting my runs around Dec and I just got it sorted with this solution today. Not sure if it is linked to the Big Sur/Pycharm reason in this issue but this matches my OS and ENV directly . Hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

api_key not configured OSX Big Sur - PyCharm · Issue #1596
Describe the bug Unable to run wandb.init() from PyCharm - macOS Big Sur To Reproduce [in PyCharm**] import wandb wandb.init(name='name', ...
Read more >
Problems running Python programs on PyCharm on new Mac ...
I've installed PyCharm on my Mac Book Air (m1/apple silicon, latest build of Big Sur) PyCharm (Community Edition 2021.2, Apple Silicon...
Read more >
Cannot set up SSH Interpreter on Mac OS X Big Sur to ...
In PyCharm Terminal window I am able to "ssh pi@192.168.1.111" without any problem. Attach a code sample as text, a screenshot or screencast...
Read more >
Unable to open pycharm-professional-2020.2.3.dmg on mac ...
Had to go back to 2019.3 to install pycharm and that version works. Clicking on the pycharm icon has no effect. Can you...
Read more >
Mac OSX BigSur PyCharm run program on docker-compose ...
I follow the official tutorial to set up the docker-compose interpreter, but it not worked. The output of Solver.py not display on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found