Hello All, Thanks in advance . I am getting an err...
# ask-community
k
Hello All, Thanks in advance . I am getting an error while using flow.from_source with Git repo. Module not found.
Copy code
Flow could not be retrieved from deployment.
Traceback (most recent call last):
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/tmp/tmpwp9f0k88prefect/branch/src/flows/simpletest_git_p2/simpletest_git_p2.py", line 12, in <module>
    from botocore.exceptions import ClientError
ModuleNotFoundError: No module named 'botocore'
Its running fine once I commented out the package botocore . I saw an option env, but i don't know how / where to write. Dockerfile is also in the git repo. I do have a docker image with all required pip list. Below is the code used .
Copy code
if __name__ == "__main__":
    simpletest_git_p2.from_source(
        source=GitRepository(
        url="<https://github.cms.gov/gitrepo.git>",
        branch="branch",
        credentials={
            "access_token": Secret.load("github-access-token")
        }
    ),
    entrypoint=f"src/flows/{flow_name}/{flow_name}.py:{flow_name}",
    ).deploy(
        name="private-git-storage-deployment",
        work_pool_name="workpool",
        build=False 
    )
@Jeff Hale
@Raffaele Scarano How you resolved Module not found error
n
Copy code
build=False
if you're not building an image that has your dependencies, where is your image that's used at runtime coming from?
k
i have an image
but i don't know where to mention
next to work_pool , i mentioned image="image_name:tag"
but still getting same error
n
its gonna be something like
Copy code
from prefect.deployments import DeploymentImage

if __name__ == "__main__":
    simpletest_git_p2.from_source(
        source=GitRepository(
        url="<https://github.cms.gov/gitrepo.git>",
        branch="branch",
        credentials={
            "access_token": Secret.load("github-access-token")
        }
    ),
    entrypoint=f"src/flows/{flow_name}/{flow_name}.py:{flow_name}",
    ).deploy(
        name="private-git-storage-deployment",
        work_pool_name="workpool",
        build=True,
        image=DeploymentImage(dockerfile="Dockerfile.mine", image="repo/image_name:tag")
    )
k
ok let me try
still getting same error
n
sorry, in the above I meant
Copy code
build=True,
k
ok... let me try
n
yeah build False means we dont do anything to build or push the image, so at runtime you probably still had the prefect base image
r
@Kamal I did not solved at all
still looking for advice, but my problem is related to conda docker image, it cannot find prefect module, seems like it's not activating the right environment
k
for me issue resolved. by configuring workpool and work space properly . Thanks to my Devops team
r
Can you please share how you managed to do that? Thanks
k
we are using Kubernetes type of work pool, 1. gave the image name under image 2. gave the name space name under namespace 3. gave service account name 4. We also had a prefect agent workpool, which we turned off/deleted i am not sure my Devops created the workspace , but please refer the below document for reference. https://docs.prefect.io/latest/concepts/work-pools/#:~:text=the%20PREFECT_WORKER_HEARTBEAT_SECONDS%20setting.-,Starting%20a%20worker,%2D%2Dtype%20flag%20is%20used.