:wave: I am having trouble logging into Prefect cl...
# ask-community
s
👋 I am having trouble logging into Prefect cloud with the CLI. When I login in I get:
Copy code
✗ 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:
Copy code
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
What version of Prefect are you in?
s
Tried with 2.0.2 and latest 2.0.3
k
Could you try this without using poetry? Like using a virtual environment?
s
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
glad you got it solved!