I am trying to launch a simple python code as a node in node-red, I installed pynodered and made a .py file including the following code
from pynodered import node_red
#node_red(category="pyfuncs")
def lower_case(node, msg):
msg['payload'] = str(msg['payload']).lower()
return msg
I tried launching the pynodered server but I got a syntax error (I tried on windows10/Ubuntu16.04 still the same error)
C:\Users\omara\Downloads\Cyber Physical Systems>pynodered test.py
Traceback (most recent call last):
File "c:\users\omara\appdata\local\programs\python\python35\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\omara\appdata\local\programs\python\python35\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\omara\AppData\Local\Programs\Python\Python35\Scripts\pynodered.exe\__main__.py", line 5, in <module>
File "c:\users\omara\appdata\local\programs\python\python35\lib\site-packages\pynodered\server.py", line 93
print(f"From {name} register {obj.name}")
^
SyntaxError: invalid syntax
Related
I'm trying to run training of the following model: https://github.com/Atten4Vis/ConditionalDETR
by using a script conddetr_r50_epoch50.sh, just like it is said in README. It looks like this:
script_name1=`basename $0`
script_name=${script_name1:0:${#script_name1}-3}
python -m torch.distributed.launch \
--nproc_per_node=8 \
--use_env \
main.py \
--coco_path ../data/coco \
--output_dir output/$script_name
But I am getting the following errors:
NOTE: Redirects are currently not supported in Windows or MacOs.
[W C:\cb\pytorch_1000000000000\work\torch\csrc\distributed\c10d\socket.cpp:601] [c10d] The client socket has failed to connect to [DESKTOP-16DB4TE]:29500 (system error: 10049 - The requested address is not valid in its context.).
[W C:\cb\pytorch_1000000000000\work\torch\csrc\distributed\c10d\socket.cpp:601] [c10d] The client socket has failed to connect to [DESKTOP-16DB4TE]:29500 (system error: 10049 - The requested address is not valid in its context.).
Traceback (most recent call last):
File "C:\DETR\ConditionalDETR\main.py", line 258, in <module>
main(args)
File "C:\DETR\ConditionalDETR\main.py", line 116, in main
utils.init_distributed_mode(args)
File "C:\DETR\ConditionalDETR\util\misc.py", line 429, in init_distributed_mode
torch.cuda.set_device(args.gpu)
File "C:\ProgramData\Anaconda3\envs\conditional_detr\lib\site-packages\torch\cuda\__init__.py", line 326, in set_device
torch._C._cuda_setDevice(device)
AttributeError: module 'torch._C' has no attribute '_cuda_setDevice'
C:\ProgramData\Anaconda3\envs\conditional_detr\lib\site-packages\torch\distributed\launch.py:180: FutureWarning: The module torch.distributed.launch is deprecated
and will be removed in future. Use torchrun.
Note that --use_env is set by default in torchrun.
If your script expects `--local_rank` argument to be set, please
change it to read from `os.environ['LOCAL_RANK']` instead. See
https://pytorch.org/docs/stable/distributed.html#launch-utility for
further instructions
warnings.warn(
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 55928) of binary: C:\ProgramData\Anaconda3\envs\conditional_detr\python.exe
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\conditional_detr\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\ProgramData\Anaconda3\envs\conditional_detr\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\envs\conditional_detr\lib\site-packages\torch\distributed\launch.py", line 195, in <module>
main()
File "C:\ProgramData\Anaconda3\envs\conditional_detr\lib\site-packages\torch\distributed\launch.py", line 191, in main
launch(args)
File "C:\ProgramData\Anaconda3\envs\conditional_detr\lib\site-packages\torch\distributed\launch.py", line 176, in launch
run(args)
File "C:\ProgramData\Anaconda3\envs\conditional_detr\lib\site-packages\torch\distributed\run.py", line 753, in run
elastic_launch(
File "C:\ProgramData\Anaconda3\envs\conditional_detr\lib\site-packages\torch\distributed\launcher\api.py", line 132, in __call__
return launch_agent(self._config, self._entrypoint, list(args))
File "C:\ProgramData\Anaconda3\envs\conditional_detr\lib\site-packages\torch\distributed\launcher\api.py", line 246, in launch_agent
raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
I am very new to PyTorch I do not quite understand why I'm getting this errors and what should I do to fix this?
I write a simple jupyter notebook script to block some cells running when need to UI input, such as follows;
when I enter the button, there come out some exceptions like follows;
Traceback (most recent call last):
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\site-packages\ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\site-packages\traitlets\config\application.py", line 846, in launch_instance
app.start()
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\site-packages\ipykernel\kernelapp.py", line 677, in start
self.io_loop.start()
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\site-packages\tornado\platform\asyncio.py", line 199, in start
self.asyncio_loop.run_forever()
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\asyncio\base_events.py", line 541, in run_forever
self._run_once()
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\asyncio\base_events.py", line 1771, in _run_once
handle = self._ready.popleft()
IndexError: pop from an empty deque
I don't know how to solve this exception. Do anyone also meet this problem, thanks!
In my project, the three following paths refer to the same location:
os.environ["TFHUB_CACHE_DIR"] = "~/my_repos/my_project/data/tfhub_cache/"
os.environ["TFHUB_CACHE_DIR"] = os.path.normpath("./data/tfhub_cache/")
os.environ["TFHUB_CACHE_DIR"] = os.path.normpath(os.path.dirname(__file__) + "../data/tfhub_cache/")
and they are used by the following code:
import tensorflow_hub as hub
embed = hub.load("https://tfhub.dev/google/universal-sentence-encoder/3")
However, the first one works correctly, while the other two, cause the following error:
Downloading pre-trained embeddings from tensorflow hub...
Traceback (most recent call last):
File "/home/my_username/.pyenv/versions/3.7.5/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/my_username/.pyenv/versions/3.7.5/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/my_username/my_repos/my_project/my_script.py", line 229, in <module>
embed = hub.load("https://tfhub.dev/google/universal-sentence-encoder/3")
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_hub/module_v2.py", line 90, in load
module_path = resolve(handle)
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_hub/module_v2.py", line 52, in resolve
return registry.resolver(handle)
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_hub/registry.py", line 42, in __call__
return impl(*args, **kwargs)
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_hub/compressed_module_resolver.py", line 88, in __call__
self._lock_file_timeout_sec())
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_hub/resolver.py", line 414, in atomic_download
tf_v1.gfile.Rename(tmp_dir, module_dir)
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_core/python/lib/io/file_io.py", line 504, in rename
rename_v2(oldname, newname, overwrite)
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_core/python/lib/io/file_io.py", line 521, in rename_v2
compat.as_bytes(src), compat.as_bytes(dst), overwrite)
tensorflow.python.framework.errors_impl.PermissionDeniedError: /home/my_username/my_repos/my_project/data/tfhub_cache/42480c3c7f42bf87d36d4c58fc4374b08dae2909.dcfe9db0c4ea456b9d3c97359f57ec1a.tmp; Permission denied
Any ideas what is causing this? (I have already chmod -R 777 on the directory!)
The script is ran using pipenv ie. pipenv run python -m scripts.my_script
Ideally, I would like the second one to work, so that other devs who have their repo in different locations are still able to just run the script.
I have tried to initialise the tensorboard debugger via the following command
tensorboard --logdir summarytrain/ --debugger_port 7000
The output from this command is:
Traceback (most recent call last): File "c:\users\krisb\appdata\local\programs\python\python36\lib\site-packages\tensorboard\plugins\debugger\debugger_plugin_loader.py", line 79, in _ConstructDebuggerPluginWithGrpcPort from tensorboard.plugins.debugger import debugger_plugin as debugger_plugin_lib File "c:\users\krisb\appdata\local\programs\python\python36\lib\site-packages\tensorboard\plugins\debugger\debugger_plugin.py", line 36, in from tensorboard.plugins.debugger import debugger_server_lib File "c:\users\krisb\appdata\local\programs\python\python36\lib\site-packages\tensorboard\plugins\debugger\debugger_server_lib.py", line 33, in from tensorflow.python.debug.lib import grpc_debug_server File "c:\users\krisb\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\debug\lib\grpc_debug_server.py", line 27, in import grpc ModuleNotFoundError: No module named 'grpc' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "c:\users\krisb\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\krisb\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\krisb\AppData\Local\Programs\Python\Python36\Scripts\tensorboard.exe__main__.py", line 9, in File "c:\users\krisb\appdata\local\programs\python\python36\lib\site-packages\tensorboard\main.py", line 36, in run_main tf.app.run(main) File "c:\users\krisb\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run _sys.exit(main(argv)) File "c:\users\krisb\appdata\local\programs\python\python36\lib\site-packages\tensorboard\main.py", line 45, in main default.get_assets_zip_provider()) File "c:\users\krisb\appdata\local\programs\python\python36\lib\site-packages\tensorboard\program.py", line 165, in main tb = create_tb_app(plugins, assets_zip_provider) File "c:\users\krisb\appdata\local\programs\python\python36\lib\site-packages\tensorboard\program.py", line 199, in create_tb_app window_title=FLAGS.window_title) File "c:\users\krisb\appdata\local\programs\python\python36\lib\site-packages\tensorboard\backend\application.py", line 126, in standard_tensorboard_wsgi plugin_instances = [constructor(context) for constructor in plugins] File "c:\users\krisb\appdata\local\programs\python\python36\lib\site-packages\tensorboard\backend\application.py", line 126, in plugin_instances = [constructor(context) for constructor in plugins] File "c:\users\krisb\appdata\local\programs\python\python36\lib\site-packages\tensorboard\plugins\debugger\debugger_plugin_loader.py", line 87, in _ConstructDebuggerPluginWithGrpcPort err.message + AttributeError: 'ModuleNotFoundError' object has no attribute 'message'
I have tried to install GPRC via pip install gprc but i get the following error too
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\krisb\AppData\Local\Temp\pip-install-h7zjk7ly\grpc\
Totally stuck - anyone have any solutions?
Turns out the solution to this problem is to install
grpcio
Therefore enter
pip install grpcio
Here is the doc
When I use the Command-Line Interface on Windows cmd, I got this error:
C:\Windows\system32>
C:\Windows\system32>python3 -m timeit '"-".join(str(n) for n in range(100))'
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Program Files\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python36\lib\timeit.py", line 362, in <module>
sys.exit(main())
File "C:\Program Files\Python36\lib\timeit.py", line 315, in main
t = Timer(stmt, setup, timer)
File "C:\Program Files\Python36\lib\timeit.py", line 123, in __init__
compile(stmtprefix + stmt, dummy_src_name, "exec")
File "<timeit-src>", line 2
'-.join(str(n)
^
SyntaxError: EOL while scanning string literal
C:\Windows\system32>
Can anyone help me please?
Use the double quotes on the outside and the single quotes inside the expression.
python -m timeit "'-'.join(str(n) for n in range(100))"
You must likely need to escape the python code line. On the last line of the provided stack trace you can see that cmd has stripped away the double quotes.