https://prefect.io logo
Title
s

Soren Daugaard

08/10/2022, 2:41 PM
👋 I am having trouble logging into Prefect cloud with the CLI. When I login in I get:
✗ poetry run prefect cloud login -k my-key
Traceback (most recent call last):
  File "/Users/username/Library/Caches/pypoetry/virtualenvs/prefect-eval-ZjHwTZGp-py3.9/lib/python3.9/site-packages/prefect/cli/_utilities.py", line 41, in wrapper
    return fn(*args, **kwargs)
  File "/Users/username/Library/Caches/pypoetry/virtualenvs/prefect-eval-ZjHwTZGp-py3.9/lib/python3.9/site-packages/prefect/utilities/asyncutils.py", line 193, in wrapper
    return run_async_in_new_loop(async_fn, *args, **kwargs)
  File "/Users/username/Library/Caches/pypoetry/virtualenvs/prefect-eval-ZjHwTZGp-py3.9/lib/python3.9/site-packages/prefect/utilities/asyncutils.py", line 140, in run_async_in_new_loop
    return anyio.run(partial(__fn, *args, **kwargs))
  File "/Users/username/Library/Caches/pypoetry/virtualenvs/prefect-eval-ZjHwTZGp-py3.9/lib/python3.9/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/Users/username/Library/Caches/pypoetry/virtualenvs/prefect-eval-ZjHwTZGp-py3.9/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/Users/username/.pyenv/versions/3.9.13/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Users/username/.pyenv/versions/3.9.13/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/Users/username/Library/Caches/pypoetry/virtualenvs/prefect-eval-ZjHwTZGp-py3.9/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/Users/username/Library/Caches/pypoetry/virtualenvs/prefect-eval-ZjHwTZGp-py3.9/lib/python3.9/site-packages/prefect/cli/cloud.py", line 264, in login
    current_workspace = get_current_workspace(workspaces)
  File "/Users/username/Library/Caches/pypoetry/virtualenvs/prefect-eval-ZjHwTZGp-py3.9/lib/python3.9/site-packages/prefect/cli/cloud.py", line 64, in get_current_workspace
    current_workspace_id = re.match(
AttributeError: 'NoneType' object has no attribute 'groups'
An exception occurred.
I also get an error if I manually set the key via:
prefect config set PREFECT_API_URL="<https://api.prefect.cloud/api/accounts/[our-account-id]/workspace/[our-workspace-id]>"
prefect config set PREFECT_API_KEY="mykey"
And then use
prefect profile use my-profile
to login. How do I get my CLI setup to work against our cloud workspace?
k

Khuyen Tran

08/10/2022, 2:56 PM
What version of Prefect are you in?
s

Soren Daugaard

08/10/2022, 2:59 PM
Tried with 2.0.2 and latest 2.0.3
k

Khuyen Tran

08/10/2022, 3:03 PM
Could you try this without using poetry? Like using a virtual environment?
s

Soren Daugaard

08/10/2022, 3:25 PM
I am able to get it to work in a completely vanilla ubuntu container where I installed python3 and pip and then prefect.
So I guess the question is what about my virtual environment is breaking it.
Okay I think know what the problem was now. I had previously setup a profile using the same key and workspace. This was setup manually via
config set
When I tried to login Prefect would change to that profile and show the failure about. If I manually delete the profile (
profile delete abc
) before logging it now works.
k

Khuyen Tran

08/10/2022, 5:49 PM
glad you got it solved!