KeyError when deploying Python Function App on Azure - python-3.x

I'm new to azure and I'm getting this KeyError when deploying my python function on Azure portal, not sure what is the reason.
I have added just one package, "tweepy == 3.8.0" in my requirements.txt and it seems like it is crashing mostly right during it's installation during deployment, And the PySocks package is probably just a dependency for tweepy package.
I have no such issues when the debug it locally. The function runs absolutely fine locally.
How can I resolve this deployment issue?
Error:
There was an error restoring dependencies. Traceback (most recent call last):
File "C:\Users\anjan\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\anjan\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\anjan\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\tools\python\packapp\__main__.py", line
234, in <module>
main()
File "C:\Users\anjan\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\tools\python\packapp\__main__.py", line
60, in main
find_and_build_deps(args)
File "C:\Users\anjan\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\tools\python\packapp\__main__.py", line
142, in find_and_build_deps
wheel.install(paths, maker)
File "C:\Users\anjan\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\tools\python\packapp\distlib\wheel.py",
line 519, in install
row = records[u_arcname]
KeyError: 'PySocks-1.7.0.dist-info/'

"func: pack" task has been a common problem for users. I could solve it by trying a preview feature that is meant to address this: https://github.com/microsoft/vscode-azurefunctions/wiki/Server-Side-Build

Related

SerpentAI Error: The Plugin definition specifies an invalid pluggable

I recently installed SerpentAI and I'm having an issue when creating a game plugin.
When running the command:
'''
serpent generate game
'''
It throws errors like SerpentAI Error When Creating a Game Plugin The inside is the same, and I tried the inside method, but it didn't work. Someone can help me
What is the name of the game? (Titleized, No Spaces i.e. AwesomeGame):
THProject
How is the game launched? (One of: 'steam', 'executable', 'web_browser'):
executable
c:\users\28734\.conda\envs\serpent\lib\site-packages\offshoot\base.py:38: UserWarning: 'offshoot.yml' not found! Using default configuration.
warnings.warn("'offshoot.yml' not found! Using default configuration.")
c:\users\28734\.conda\envs\serpent\lib\site-packages\offshoot\base.py:38: UserWarning: 'offshoot.yml' not found! Using default configuration.
warnings.warn("'offshoot.yml' not found! Using default configuration.")
OFFSHOOT: Attempting to install SerpentTHProjectGamePlugin...
c:\users\28734\.conda\envs\serpent\lib\site-packages\offshoot\base.py:38: UserWarning: 'offshoot.yml' not found! Using default configuration.
warnings.warn("'offshoot.yml' not found! Using default configuration.")
OFFSHOOT PLUGIN INSTALL: Verifying that plugin dependencies are installed...
OFFSHOOT PLUGIN INSTALL: Installing files...
There was a problem during installation... Reverting!
Traceback (most recent call last):
File "c:\users\28734\.conda\envs\serpent\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\28734\.conda\envs\serpent\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\28734\.conda\envs\serpent\plugins\SerpentTHProjectGamePlugin\plugin.py", line 28, in <module>
offshoot.executable_hook(SerpentTHProjectGamePlugin)
File "c:\users\28734\.conda\envs\serpent\lib\site-packages\offshoot\base.py", line 185, in executable_hook
plugin_class.install()
File "c:\users\28734\.conda\envs\serpent\lib\site-packages\offshoot\plugin.py", line 35, in install
cls.install_files()
File "c:\users\28734\.conda\envs\serpent\lib\site-packages\offshoot\plugin.py", line 118, in install_files
raise e
File "c:\users\28734\.conda\envs\serpent\lib\site-packages\offshoot\plugin.py", line 91, in install_files
is_valid, messages = cls._validate_file_for_pluggable(plugin_file_path, file_dict["pluggable"])
File "c:\users\28734\.conda\envs\serpent\lib\site-packages\offshoot\plugin.py", line 235, in _validate_file_for_pluggable
raise PluginError("The Plugin definition specifies an invalid pluggable: %s => %s" % (file_path, pluggable))
offshoot.plugin.PluginError: The Plugin definition specifies an invalid pluggable: plugins\SerpentTHProjectGamePlugin\files\serpent_THProject_game.py => Game
I solved the problem myself. Installed 'serpent.game'.
All third-party libraries in the agent are sufficient. Some libraries are not installed

AWS SAM giving error Unsupported Lambda runtime nodejs18.x

I am trying to run a simple lambda function using AWS sam, version(1.57.0)
I've installed in my ubuntu system nodejs version 14.18.3
When I try to run the project it gives errorUnsupported Lambda runtime nodejs18.x
Below is the full stacktrace
Invoking index.handler (nodejs18.x)
Traceback (most recent call last):
File "samcli/__main__.py", line 12, in <module>
File "click/core.py", line 829, in __call__
File "click/core.py", line 782, in main
File "click/core.py", line 1259, in invoke
File "click/core.py", line 1259, in invoke
File "click/core.py", line 1066, in invoke
File "click/core.py", line 610, in invoke
File "click/decorators.py", line 73, in new_func
File "click/core.py", line 610, in invoke
File "samcli/lib/telemetry/metric.py", line 176, in wrapped
File "samcli/lib/telemetry/metric.py", line 126, in wrapped
File "samcli/lib/utils/version_checker.py", line 41, in wrapped
File "samcli/cli/main.py", line 86, in wrapper
File "samcli/commands/local/invoke/cli.py", line 106, in cli
File "samcli/commands/local/invoke/cli.py", line 183, in do_cli
File "samcli/commands/local/lib/local_lambda.py", line 144, in invoke
File "samcli/lib/telemetry/metric.py", line 240, in wrapped_func
File "samcli/local/lambdafn/runtime.py", line 177, in invoke
File "samcli/local/lambdafn/runtime.py", line 88, in create
File "samcli/local/docker/lambda_container.py", line 91, in __init__
ValueError: Unsupported Lambda runtime nodejs18.x
[43955] Failed to execute script __main__
I did have node version 18 installed in the system prior to this. I thought that may be giving the issue so I uninstalled that version and installed version 14.
I don't have any idea why sam is running it on node version 18
I just recently looked into this as well since Node 18 is the current LTS. If you go to the Serverless Image Repository you'll see that AWS SAM doesn't currently have an image for Node 18. There's an explanation about this in this Github issue.

Spyder: An error ocurred while starting the kernel [duplicate]

I have a problem with the Spyder software of Python(version 4.0.1) regarding the running kernels in the IPython Console. Accordingly, I have tried many ways to resolve the issue like running some commands in Anaconda prompt or set the settings to the default mode. I even updated the version of my anaconda and the spyder. Nevertheless, nothing has been changed and the issue still exists.
This is the error I am receiving:
Traceback (most recent call last): File
"C:\ProgramData\Anaconda3\lib\runpy.py", line 193, in
_run_module_as_main "main", mod_spec) File "C:\ProgramData\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals) File
"C:\ProgramData\Anaconda3\lib\site‑packages\spyder_kernels\console__main__.py",
line 11, in start.main() File
"C:\ProgramData\Anaconda3\lib\site‑packages\spyder_kernels\console\start.py",
line 287, in main import_spydercustomize() File
"C:\ProgramData\Anaconda3\lib\site‑packages\spyder_kernels\console\start.py",
line 39, in import_spydercustomize import spydercustomize File
"C:\ProgramData\Anaconda3\lib\site‑packages\spyder_kernels\customize\spydercustomize.py",
line 24, in from IPython.core.getipython import get_ipython File
"C:\ProgramData\Anaconda3\lib\site‑packages\IPython__init__.py", line
56, in from .terminal.embed import embed File
"C:\ProgramData\Anaconda3\lib\site‑packages\IPython\terminal\embed.py",
line 14, in from IPython.core.magic import Magics, magics_class,
line_magic File
"C:\ProgramData\Anaconda3\lib\site‑packages\IPython\core\magic.py",
line 20, in from . import oinspect File
"C:\ProgramData\Anaconda3\lib\site‑packages\IPython\core\oinspect.py",
line 30, in from IPython.lib.pretty import pretty File
"C:\ProgramData\Anaconda3\lib\site‑packages\IPython\lib\pretty.py",
line 82, in import datetime File "C:\Users\mahkam\datetime.py", line
4 ^ SyntaxError: EOF while scanning triple‑quoted string literal
(Spyder maintainer here) You need to rename or remove this file
C:\Users\mahkam\datetime.py
That's because that file is using the same name of Python internal module and that confuses other modules that depend on it.
Looks like you have a quoting error
File "C:\Users\mahkam\datetime.py", line 4 ^ SyntaxError: EOF while scanning triple‑quoted string literal
Check out your datetime.py

How to port a tf.Session to a tf.train.MonitoredSession call while allowing graph modifications

The code I'm working on is this.
The code uses tf.session call to take in a graph for object detection tasks. Link
My aim here is to profile this code for Nvidia GPUs using the nvtx-plugins-tf to analyze the time taken for different ops. Link to docs
The plugin library provides a function hook for a tf.train.MonitoredSession as given in their example code here.
The code linked above uses tf.session along with a tf.config and when I try to modify the tf.session call to a tf.train.MonitoredSession call, I can't get my code to work and it fails with an error that graph can't be modified. I went through the tensorflow APIs and it turns out that tf.session doesn't support hook callbacks and tf.train.MonitoredSession doesn't support tf_config as a function argument.
Traceback (most recent call last):
File "/home/mayroy13/anaconda3/envs/trt-py36/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/mayroy13/anaconda3/envs/trt-py36/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/mayroy13/Mayank/Mayank/test/tensorrt/tftrt/examples/object_detection/test.py", line 105, in <module>
test(args.test_config_path)
File "/home/mayroy13/Mayank/Mayank/test/tensorrt/tftrt/examples/object_detection/test.py", line 81, in test
**test_config['benchmark_config'])
File "/home/mayroy13/Mayank/Mayank/test/tensorrt/tftrt/examples/object_detection/object_detection.py", line 608, in benchmark_model
tf.import_graph_def(frozen_graph, name='')
File "/home/mayroy13/anaconda3/envs/trt-py36/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/mayroy13/anaconda3/envs/trt-py36/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 443, in import_graph_def
_ProcessNewOps(graph)
File "/home/mayroy13/anaconda3/envs/trt-py36/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 236, in _ProcessNewOps
for new_op in graph._add_new_tf_operations(compute_devices=False): # pylint: disable=protected-access
File "/home/mayroy13/anaconda3/envs/trt-py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3751, in _add_new_tf_operations
for c_op in c_api_util.new_tf_operations(self)
File "/home/mayroy13/anaconda3/envs/trt-py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3751, in <listcomp>
for c_op in c_api_util.new_tf_operations(self)
File "/home/mayroy13/anaconda3/envs/trt-py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3640, in _create_op_from_tf_operation
self._check_not_finalized()
File "/home/mayroy13/anaconda3/envs/trt-py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3225, in _check_not_finalized
raise RuntimeError("Graph is finalized and cannot be modified.")
RuntimeError: Graph is finalized and cannot be modified.
Any directions to go in would be appreciated. If there are ways in tensorflow to use hooks in conjunction with tf.session, that will also work for me.
The Reason might be is MonitoredTrainingSession is finalizing(frozen) the graph, you might require to initialize the graph on loop, you can use the function to create new graph on top of loop.
import tensorflow as tf
tf.reset_default_graph()
tf.Graph().as_default()

Tensorflow Object detection training job fails on Google cloud

I have my Google Storage Bucket in the following manner:
-data
--labels.pbtxt
--train.record
--test.record
-training
--config file
--packages
And my local machine has the data in /tensorflow/models/research/object_detection in the same manner, additionally
-training
--cloud.yml
And I'm running the following command to start job on google cloud ML engine
gcloud ml-engine jobs submit training object_detection_0.1 --job-
dir=gs://{BUCKET NAME}/training --packages dist/object_detection-
0.1.tar.gz,slim/dist/slim-0.1.tar.gz --module-name object_detection.train --
region us-central1 --config /##/##/models/research/object_detection/training
-- --train_dir=gs://{BUCKET NAME}/training --
pipeline_config_path=gs://{BUCKET NAME}/training/config_file.config
Google cloud logs show me the following error.
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/root/.local/lib/python2.7/site-packages/object_detection/train.py",
line 49, in <module>
from object_detection import trainer
File "/root/.local/lib/python2.7/site-
packages/object_detection/trainer.py", line 33, in <module>
from deployment import model_deploy
ImportError: No module named deployment
replica worker 0,1,2,3 - same error
The replica worker 4 exited with a non-zero status of 1. Termination reason:
Error.
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/root/.local/lib/python2.7/site-packages/object_detection/train.py",
line 49, in <module>
from object_detection import trainer
File "/root/.local/lib/python2.7/site-
packages/object_detection/trainer.py", line 33, in <module>
from deployment import model_deploy
ImportError: No module named deployment
replica ps 0,1 -same error
The replica ps 2 exited with a non-zero status of 1. Termination reason:
Error.
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/root/.local/lib/python2.7/site-packages/object_detection/train.py",
line 49, in <module>
from object_detection import trainer
File "/root/.local/lib/python2.7/site-
packages/object_detection/trainer.py", line 33, in <module>
from deployment import model_deploy
ImportError: No module named deployment
I am having the same problem with the deeplab model. It seems they refer to this folder, because it works for me if I placed were it should to be called properly
By the way...I let me know how you solved it.

Resources