I'm not sure what the issue is but
- I already pip installed prefect and confirmed it's installed: Prefect 2.0
- Using VsCode
- Python 3.10.6
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"])
Edit: Found the solution:
CodePudding user response:
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
CodePudding user response:
did you try restarting vscode sometimes it takes a restart?
CodePudding user response:
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?