John Kang
07/26/2022, 3:40 PMBianca Hoch
07/26/2022, 4:12 PMJohn Kang
07/26/2022, 4:18 PMDeployment(
name="leonardo-deployment",
flow="./prefect_test.py",
tags=["tutorial", "test"],
parameters={"name": "Leo"},
packager=OrionPackager(serializer=PickleSerializer()),
)
and it throws the error ModuleNotFoundError: No module named 'main_python_files'Deployment(
name="leonardo-deployment",
flow="./prefect_test.py",
tags=["tutorial", "test"],
parameters={"name": "Leo"},
packager=DockerPackager(python_environment=CondaEnvironment.from_environment()),
)
it throws a different error
Traceback (most recent call last):
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "prefect_test_deployment.py", line 32, in <module>
packager=DockerPackager(python_environment=CondaEnvironment.from_environment()),
File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\prefect\software\conda.py", line 126, in from_environment
current_environment_requirements(
File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\prefect\software\pip.py", line 70, in current_environment_requirements
requirements.append(PipRequirement.from_distribution(dist))
File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\prefect\software\pip.py", line 29, in from_distribution
return cls.validate(dist.as_requirement())
File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\pkg_resources\__init__.py", line 2847, in as_requirement
return Requirement.parse(spec)
File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\pkg_resources\__init__.py", line 3134, in parse
req, = parse_requirements(s)
File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\pkg_resources\__init__.py", line 3089, in init
super(Requirement, self).__init__(requirement_string)
File "C:\ProgramData\Anaconda3\envs\Capacity_venv\lib\site-packages\pkg_resources\_vendor\packaging\requirements.py", line 104, in init
raise InvalidRequirement(
pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'-ywinpty'": Expected W:(abcd...)Bianca Hoch
07/26/2022, 4:38 PMJohn Kang
07/26/2022, 4:39 PM__main__
if you call python <your_script.py>
or __prefect_loader__
if we run the script for you. If you move your deployment into a separate file and import the flow, we will be able to use that as the flow's import path:
from my_flows import kubes_flow
Deployment(
flow=kubes_flow,
)
I'll try to find a way to determine the module path when they're in the same file.
Also note, if your module is a relative import rather than an installed module, this will fail while using the CLI. I'll investigate a fix for that, but you can call Deployment(...).create()
directly and run the script with Python to get past it.Anna Geller
07/26/2022, 4:48 PMJohn Kang
07/26/2022, 4:53 PMDeployment(
name="leonardo-deployment",
flow="./prefect_test.py",
tags=["tutorial", "test"],
parameters={"name": "Leo"},
).create()
Using the create() method. I can run it this way! It works. Thanks for the helpJeremiah
07/26/2022, 6:09 PMJohn Kang
07/26/2022, 6:40 PMKhuyen Tran
07/27/2022, 9:56 PM