Ansible failing to run Terraform Plan - python-3.x

I have automated ansible playbook to generate Terraform files required to create AWS resources in a folder. Once the files are generated, ansible tasks runs terraform plan(using below plan code) but it is failing with below error(error)
Ansible Version:
ansible [core 2.11.2]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
Terraform Version:
Terraform v0.12.31
plan code:
- name: Create Terraform plan
check_mode: true
community.general.terraform:
project_path: "{{ terraform_dir }}"
plan_file: "{{ terraform_dir }}/tfplan"
state: "planned"
force_init: true
register: plan
tags:
- build
- plan
- never
error:
**fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):
File \"/root/.ansible/tmp/ansible-tmp-1625160772.6764412-713-181137940992596/AnsiballZ_terraform.py\", line 100, in <module>
_ansiballz_main()
File \"/root/.ansible/tmp/ansible-tmp-1625160772.6764412-713-181137940992596/AnsiballZ_terraform.py\", line 92, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File \"/root/.ansible/tmp/ansible-tmp-1625160772.6764412-713-181137940992596/AnsiballZ_terraform.py\", line 40, in invoke_module
runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.terraform', init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.terraform', _modlib_path=modlib_path),
File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code
exec(code, run_globals)
File \"/tmp/ansible_community.general.terraform_payload_xnzkbjkr/ansible_community.general.terraform_payload.zip/ansible_collections/community/general/plugins/modules/terraform.py\", line 497, in <module>
File \"/tmp/ansible_community.general.terraform_payload_xnzkbjkr/ansible_community.general.terraform_payload.zip/ansible_collections/community/general/plugins/modules/terraform.py\", line 393, in main
File \"/tmp/ansible_community.general.terraform_payload_xnzkbjkr/ansible_community.general.terraform_payload.zip/ansible_collections/community/general/plugins/modules/terraform.py\", line 238, in get_version
File \"/usr/lib/python3.8/json/__init__.py\", line 357, in loads
return _default_decoder.decode(s)
File \"/usr/lib/python3.8/json/decoder.py\", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File \"/usr/lib/python3.8/json/decoder.py\", line 355, in raw_decode
raise JSONDecodeError(\"Expecting value\", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
", "module_stdout": "", "msg": "MODULE FAILURE
See stdout/stderr for the exact error", "rc": 1}**
not sure if I missed to install any required modules or if I need to make code changes.
Any idea how to fix the above error?
Please let me know if any further information needed.
Thanks in Advance.

Fixed the above error by changing the ansible-galaxy collection version(ansible-galaxy collection install community.general:1.3.9).
ansible-galaxy versions causing the above error are >1.3.9 as versions greater than 1.3.9 are not compatible with terraform version v0.12.31
Previously I have ansible-galaxy collection version 2.2.0 installed, degrading the version to 1.3.9 fixed my issue.

Related

DBT workflow on Databricks fails: AttributeError in object SeedNode

Today our DBT workflow in databricks failed. The workflow runs as:
dbt run --target workflow --project-dir dbt/projectdir/ --profiles-dir dbt/
Any suggestions what could be wrong or how to fix it?
Version reported in Databricks logs:
Running with dbt=1.4.1
The error message below:
'SeedNode' object has no attribute 'depends_on'
09:59:17 Traceback (most recent call last):
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/main.py", line 135, in main
results, succeeded = handle_and_check(args)
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/main.py", line 198, in handle_and_check
task, res = run_from_args(parsed)
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/main.py", line 245, in run_from_args
results = task.run()
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/task/runnable.py", line 454, in run
self._runtime_initialize()
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/task/runnable.py", line 165, in _runtime_initialize
super()._runtime_initialize()
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/task/runnable.py", line 94, in _runtime_initialize
self.load_manifest()
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/task/runnable.py", line 81, in load_manifest
self.manifest = ManifestLoader.get_full_manifest(self.config)
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/parser/manifest.py", line 203, in get_full_manifest
manifest = loader.load()
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/parser/manifest.py", line 339, in load
self.parse_project(
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/parser/manifest.py", line 467, in parse_project
parser.parse_file(block)
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/parser/base.py", line 425, in parse_file
self.parse_node(file_block)
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/parser/base.py", line 386, in parse_node
self.render_update(node, config)
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/parser/base.py", line 363, in render_update
self.update_parsed_node_config(node, config, context=context)
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/parser/base.py", line 336, in update_parsed_node_config
get_rendered(hook.sql, context, parsed_node, capture_macros=True)
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/clients/jinja.py", line 590, in get_rendered
return render_template(template, ctx, node)
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/clients/jinja.py", line 545, in render_template
return template.render(ctx)
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "", line 1, in top-level template code
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/clients/jinja.py", line 328, in call
with self.track_call():
File "/usr/lib/python3.9/contextlib.py", line 117, in enter
return next(self.gen)
File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/dbt/clients/jinja.py", line 319, in track_call
self.node.depends_on.add_macro(unique_id)
AttributeError: 'SeedNode' object has no attribute 'depends_on'
Got the same issue but I am on snowflake
Seems this was a version issue. Explicitly setting the task to use an older version seems to have solved it:
dbt-core<=1.3.1
dbt-databricks<=1.3.1
This can be set in the Databricks workflow task settings.
I'm not sure which is the last version that would work, but 1.3.1 at least works in our case.

JupyterLab/Elyra: pipeline run on Kubeflow Pipelines fails with "No host specified" in local deployment

I have Kubeflow Pipelines running in my local environment, along with JupyterLab and the Elyra extensions. I've created a notebook pipeline and configured the runtime configuration as follows, setting api_endpoint to http://localhost:31380/pipeline (with security disabled). Trying to run the pipeline the following error message is displayed:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 1703, in _execute
result = await result
File "/usr/local/lib/python3.8/site-packages/elyra/pipeline/handlers.py", line 89, in post
response = await PipelineProcessorManager.instance().process(pipeline)
File "/usr/local/lib/python3.8/site-packages/elyra/pipeline/processor.py", line 70, in process
res = await asyncio.get_event_loop().run_in_executor(None, processor.process, pipeline)
File "/usr/local/Cellar/python#3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.8/site-packages/elyra/pipeline/processor_kfp.py", line 100, in process
raise lve
File "/usr/local/lib/python3.8/site-packages/elyra/pipeline/processor_kfp.py", line 89, in process
client.upload_pipeline(pipeline_path,
File "/usr/local/lib/python3.8/site-packages/kfp/_client.py", line 720, in upload_pipeline
response = self._upload_api.upload_pipeline(pipeline_package_path, name=pipeline_name, description=description)
File "/usr/local/lib/python3.8/site-packages/kfp_server_api/api/pipeline_upload_service_api.py", line 83, in upload_pipeline
return self.upload_pipeline_with_http_info(uploadfile, **kwargs) # noqa: E501
File "/usr/local/lib/python3.8/site-packages/kfp_server_api/api/pipeline_upload_service_api.py", line 177, in upload_pipeline_with_http_info
return self.api_client.call_api(
File "/usr/local/lib/python3.8/site-packages/kfp_server_api/api_client.py", line 378, in call_api
return self.__call_api(resource_path, method,
File "/usr/local/lib/python3.8/site-packages/kfp_server_api/api_client.py", line 195, in __call_api
response_data = self.request(
File "/usr/local/lib/python3.8/site-packages/kfp_server_api/api_client.py", line 421, in request
return self.rest_client.POST(url,
File "/usr/local/lib/python3.8/site-packages/kfp_server_api/rest.py", line 279, in POST
return self.request("POST", url,
File "/usr/local/lib/python3.8/site-packages/kfp_server_api/rest.py", line 196, in request
r = self.pool_manager.request(
File "/usr/local/lib/python3.8/site-packages/urllib3/request.py", line 79, in request
return self.request_encode_body(
File "/usr/local/lib/python3.8/site-packages/urllib3/request.py", line 171, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/usr/local/lib/python3.8/site-packages/urllib3/poolmanager.py", line 325, in urlopen
conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
File "/usr/local/lib/python3.8/site-packages/urllib3/poolmanager.py", line 231, in connection_from_host
raise LocationValueError("No host specified.")
urllib3.exceptions.LocationValueError: No host specified.
The root cause is an issue in the Kubeflow Pipelines kfp package version 1.0.0 that is distributed with Elyra v1.4.1 (and lower). To work around the issue, replace localhost with 127.0.0.1 in your runtime configuration, e.g. http://127.0.0.1:31380/pipeline.
Edit: With the availability of Elyra v1.5+, which requires a more recent version of the kfp package, you can also upgrade Elyra to resolve the issue.

poetry install fails with [CalledProcessError] while installing github submodule

I'm new to python and github. when I'm trying to install few submodules getting below error.
I'm using git bash on windows
pip is at latest version 20.2.3.
able to install other submodules using poetry successfully
$ poetry install -vvv
Using virtualenv: E:\Dev\venv\venv_test
Installing dependencies from lock file
[CalledProcessError]
Command '['C:\\Users\\88810\\AppData\\Local\\Temp\\tziwqwewd56\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 3221226505.
Traceback (most recent call last):
File "C:\Users\88810\.poetry\lib\poetry\_vendor\py3.6\clikit\console_application.py", line 131, in run
status_code = command.handle(parsed_args, io)
File "C:\Users\88810\.poetry\lib\poetry\_vendor\py3.6\clikit\api\command\command.py", line 120, in handle
status_code = self._do_handle(args, io)
File "C:\Users\88810\.poetry\lib\poetry\_vendor\py3.6\clikit\api\command\command.py", line 171, in _do_handle
return getattr(handler, handler_method)(args, io, self)
File "C:\Users\88810\.poetry\lib\poetry\_vendor\py3.6\cleo\commands\command.py", line 92, in wrap_handle
return self.handle()
File "C:\Users\88810\.poetry\lib\poetry\console\commands\install.py", line 69, in handle
return_code = installer.run()
File "C:\Users\88810\.poetry\lib\poetry\installation\installer.py", line 74, in run
self._do_install(local_repo)
File "C:\Users\88810\.poetry\lib\poetry\installation\installer.py", line 225, in _do_install
ops = solver.solve(use_latest=whitelist)
File "C:\Users\88810\.poetry\lib\poetry\puzzle\solver.py", line 36, in solve
packages, depths = self._solve(use_latest=use_latest)
File "C:\Users\88810\.poetry\lib\poetry\puzzle\solver.py", line 181, in _solve
self._package, self._provider, locked=locked, use_latest=use_latest
File "C:\Users\88810\.poetry\lib\poetry\mixology\__init__.py", line 7, in resolve_version
return solver.solve()
File "C:\Users\88810\.poetry\lib\poetry\mixology\version_solver.py", line 80, in solve
next = self._choose_package_version()
File "C:\Users\88810\.poetry\lib\poetry\mixology\version_solver.py", line 388, in _choose_package_version
version = self._provider.complete_package(version)
File "C:\Users\88810\.poetry\lib\poetry\puzzle\provider.py", line 601, in complete_package
self.search_for_vcs(r)
File "C:\Users\88810\.poetry\lib\poetry\puzzle\provider.py", line 175, in search_for_vcs
name=dependency.name,
File "C:\Users\88810\.poetry\lib\poetry\puzzle\provider.py", line 213, in get_package_from_vcs
package = cls.get_package_from_directory(tmp_dir, name=name)
File "C:\Users\88810\.poetry\lib\poetry\puzzle\provider.py", line 361, in get_package_from_directory
cls._execute_setup()
File "C:\Users\88810\.poetry\lib\poetry\puzzle\provider.py", line 872, in _execute_setup
EnvManager.build_venv(tmp_dir)
File "C:\Users\88810\.poetry\lib\poetry\utils\env.py", line 688, in build_venv
builder.create(str(path))
File "E:\python36\lib\venv\__init__.py", line 67, in create
self._setup_pip(context)
File "E:\python36\lib\venv\__init__.py", line 245, in _setup_pip
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
File "E:\python36\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "C:\Users\88810\.poetry\lib\poetry\utils\_compat.py", line 206, in run
retcode, process.args, output=stdout, stderr=stderr
(venv_test)
I was able to resolve the issue after following these steps:
Upgraded python 3.6 to 3.7.4.
I had earlier installed python on E drive, installed it on C drive.

AttributeError: module 'dateutil.tz' has no attribute 'UTC' on Zappa Deploy

On trying to deploy my AWS Lambda function get this error on my Stacktrace
(python-dateutil 2.8.1 (/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages), Requirement.parse('python-dateutil<2.7.0'), {'zappa'})
Calling deploy for stage development..
Oh no! An error occurred! :(
==============
Traceback (most recent call last):
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/zappa/cli.py", line 2778, in handle
sys.exit(cli.handle())
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/zappa/cli.py", line 512, in handle
self.dispatch_command(self.command, stage)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/zappa/cli.py", line 549, in dispatch_command
self.deploy(self.vargs['zip'])
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/zappa/cli.py", line 709, in deploy
self.zappa.create_iam_roles()
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/zappa/core.py", line 2557, in create_iam_roles
role, credentials_arn = self.get_credentials_arn()
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/zappa/core.py", line 2536, in get_credentials_arn
self.credentials_arn = role.arn
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/boto3/resources/factory.py", line 339, in property_loader
self.load()
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/boto3/resources/factory.py", line 505, in do_action
response = action(self, *args, **kwargs)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/boto3/resources/action.py", line 83, in __call__
response = getattr(parent.meta.client, operation_name)(**params)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/client.py", line 316, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/client.py", line 613, in _make_api_call
operation_model, request_dict, request_context)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/client.py", line 632, in _make_request
return self._endpoint.make_request(operation_model, request_dict)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/endpoint.py", line 102, in make_request
return self._send_request(request_dict, operation_model)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/endpoint.py", line 135, in _send_request
request, operation_model, context)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/endpoint.py", line 167, in _get_response
request, operation_model)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/endpoint.py", line 218, in _do_get_response
response_dict, operation_model.output_shape)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/parsers.py", line 242, in parse
parsed = self._do_parse(response, shape)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/parsers.py", line 509, in _do_parse
parsed = self._parse_shape(shape, start)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/parsers.py", line 302, in _parse_shape
return handler(shape, node)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/parsers.py", line 377, in _handle_structure
member_shape, member_node)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/parsers.py", line 302, in _parse_shape
return handler(shape, node)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/parsers.py", line 377, in _handle_structure
member_shape, member_node)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/parsers.py", line 302, in _parse_shape
return handler(shape, node)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/parsers.py", line 175, in _get_text_content
return func(self, shape, text)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/parsers.py", line 462, in _handle_timestamp
return self._timestamp_parser(text)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/utils.py", line 626, in parse_timestamp
return _parse_timestamp_with_tzinfo(value, tzinfo)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/botocore/utils.py", line 607, in _parse_timestamp_with_tzinfo
return dateutil.parser.parse(value, tzinfos={'GMT': tzutc()})
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/dateutil/parser/_parser.py", line 1374, in parse
return DEFAULTPARSER.parse(timestr, **kwargs)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/dateutil/parser/_parser.py", line 660, in parse
ret = self._build_tzaware(ret, res, tzinfos)
File "/Users/supratik/.local/share/virtualenvs/api_sourcer-sM-JSZy3-/Users/supratik/.pyenv/shims/python/lib/python3.6/site-packages/dateutil/parser/_parser.py", line 1201, in _build_tzaware
aware = naive.replace(tzinfo=tz.UTC)
AttributeError: module 'dateutil.tz' has no attribute 'UTC'
==============```
python -m pip install --upgrade python-dateutil
Upgrading python-dateutil solve the problem for me. On my machine, 2.5.3 to 2.8.1.
Skimming the source code, I found out that UTC variable is added in 2.7.0. So, I think any version >= 2.7.0 will solve the issue.
#: Convenience constant providing a :class:`tzutc()` instance
#:
#: .. versionadded:: 2.7.0
UTC = tzutc()
Got a similar issue while trying to copy files from AWS S3 using aws cli. Running pip install python-dateutil updated the python-dateutil to 2.8.1 and it works well now.
Try to specify the python-dateutil version and install it before the package which has a error, in your case zappa
exempla:
pip install python-dateutil==2.8.1 zappa
my case the package which i was getting a erro was freezegun, so i ran
pip install python-dateutil==2.8.1 freezegun==0.3.15
and it worked
I had this issue where trying to run eb deploy for AWS Elastic Beanstalk.
What worked for me was: sudo pip3 install python-dateutil --upgrade
(note: running this without sudo did not fix the issue)
For reference this was the error I was getting prior to this:
eb deploy projectFoo
Deploying to development environment
Deploying to AWS
Creating application version archive "app-200711_113503".
Uploading projectFoo/app-200711_113503.zip to S3. This may take a while.
Upload Complete.
ERROR: AttributeError - module 'dateutil.tz' has no attribute 'UTC'

Scm Uri Error in Python function deployment from Bitbucket pipeline to Azure using microsoft/azure-functions-deploy:1.0.1

I have created a Bitbucket pipeline using the image python3.7.2 and I compressed the python function and pass to deployment as per the documentation in Bitbucket.But when I tried to deployed it using - pipe: microsoft/azure-functions-deploy:1.0.1,It shows some error ValueError: Failed to retrieve Scm Uri
- step:
name: build and test
image: python:3.7.2
script:
- cat /etc/os-release
- ls
- apt-get update && apt-get install zip
- zip -r sample-azure-python-func.zip ./*
artifacts:
- sample-azure-python-func.zip
- step:
name: "deploy to dev function"
deployment: Staging
trigger: manual
script:
- pipe: microsoft/azure-functions-deploy:1.0.1
variables:
AZURE_APP_ID: $AZURE_APP_ID
AZURE_PASSWORD: $AZURE_PASSWORD
AZURE_TENANT_ID: $AZURE_TENANT_ID
FUNCTION_APP_NAME: 'readfromip-sell-py-dev-fnap'
ZIP_FILE: 'sample-azure-python-func.zip'
INFO: Deploying zip file
ERROR: Failed to retrieve Scm Uri
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/knack/cli.py", line 206, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 328, in execute
raise ex
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 386, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 379, in _run_job
six.reraise(*sys.exc_info())
File "/usr/local/lib/python3.6/site-packages/six.py", line 693, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 356, in _run_job
result = cmd_copy(params)
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 171, in call
return self.handler(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/init.py", line 452, in default_command_handler
return op(**command_args)
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/appservice/custom.py", line 273, in enable_zip_deploy
scm_url = _get_scm_url(cmd, resource_group_name, name, slot)
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/appservice/custom.py", line 1374, in _get_scm_url
raise ValueError('Failed to retrieve Scm Uri')
ValueError: Failed to retrieve Scm Uri

Resources