I'm not sure what the issue is but
check image below for error and code posted for easy copy pasta
from prefect import flow, task
import httpx
@task(retries=3)
def get_stars(repo):
url = f"https://api.github.com/repos/{repo}"
count = httpx.get(url).json()["stargazers_count"]
print(f"{repo} has {count} stars!")
@flow
def github_stars(repos):
for repo in repos:
get_stars(repo)
# call the flow!
github_stars(["PrefectHQ/Prefect", "PrefectHQ/prefect-aws", "PrefectHQ/prefect-dbt"])
I can see that you have not activated your virtualenv that might be the issue, you need to first install virtualenv.
Using this you can install virtualenv in your system:
pip install virtualenv
then you have to create a virtual environment, you can do that by following command.
python -m virtualenv myEnv # ---> whatever name you want here
and then you have to activate the environment by following command:
myEnv\Scripts\activate
and to deactivate, simply use:
deactivate
did you try restarting vscode sometimes it takes a restart?
Do you happen to use venv for virtual environment management? We've seen some users struggling to set it up with venv. Could you try installing with Conda and report back?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.