Hey. Having an issue with a simple deployment- whe...
# data-tricks-and-tips
d
Hey. Having an issue with a simple deployment- when I attempt to "deployment create" I encounter a ModuleNotFoundError for any local imports. Even though the flow runs successfully when executed locally. Is this a bug or a property of the DeploymentSpec that I need to work around?
1
a
You need to package your dependencies It will get easier with the next release this week
d
Ah ok, thanks for the quick response! That's really helpful to know.
🙌 1
s
@Anna Geller does prefect 2 still use cloudpickle under the hood? Because v2 of cloudpickle has the
register_pickle_by_value
, and you can use that to tell cloudpickle that the entire module/package of your choice should be treated like a local function and included in the seriailsation
🙌 1
👀 1
a
I don't to spoil to much but just watch the release 2.0b8 today - it's gonna support many serialization options
t
I'm having the same problem - getting ModuleNotFoundError. But I'm confused about @Anna Geller comment to package the dependency. I'm running Prefect 2.0 on prem version. Am I supposed to add something like this to the Deployment:
Copy code
packager=OrionPackager(serializer=ImportSerializer()),
If so that didn't work.
a
support for serializing modules is upcoming, but I'd recommend packaging it as part of your CI/CD instead (building Docker image, conda env or Python package as needed)
t
@Anna Geller If we decide to use a Docker image, we would host it in our private registry. Are there attributes for specifying the credentials to access the docker registry in DockerFlowRunner?
a
no, the machine from which you create deployments would need to have the AWS CLI configured with an IAM user that has access to ECR if you experience any bugs in the process, feel free to open a GitHub issue
e
@Anna Geller running into this also (and very new to Prefect, so apologies if I’m being obtuse). I’m trying to run a flow locally, with a local agent and server. Are you saying I have to build a docker image or python package in order to create/run a deployment locally? That seems like it’ll really slow down the development process. Is there a workflow you recommend to smooth that out?
update: I was able to get this working by setting
PYTHONPATH
to include my working directory.
a
Thanks for the update