有没有考虑升级一下,在python=3.10中有些运行出错,python3.6太老了

Author: rhfuCreated Feb 26, 2025Updated Feb 26, 2025

(my_torch) root@/mac 4_viewer # python 1_tensorboardX_demo.py

A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.3 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last): File "/Users/rhf/Documents/robot/my_torch/PyTorch_Tutorial/Code/4_viewer/1_tensorboardX_demo.py", line 3, in import torch File "/my_torch/lib/python3.10/site-packages/torch/init.py", line 1477, in from .functional import * # noqa: F403 File "/my_torch/lib/python3.10/site-packages/torch/functional.py", line 9, in import torch.nn.functional as F File "/my_torch/lib/python3.10/site-packages/torch/nn/init.py", line 1, in from .modules import * # noqa: F403 File "/my_torch/lib/python3.10/site-packages/torch/nn/modules/init.py", line 35, in from .transformer import TransformerEncoder, TransformerDecoder,
File "/my_torch/lib/python3.10/site-packages/torch/nn/modules/transformer.py", line 20, in device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), /my_torch/lib/python3.10/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/utils/tensor_numpy.cpp:84.) device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), /my_torch/lib/python3.10/site-packages/torchvision/models/_utils.py:135: UserWarning: Using 'weights' as positional parameter(s) is deprecated since 0.13 and may be removed in the future. Please use keyword parameter(s) instead. warnings.warn( /my_torch/lib/python3.10/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or None for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing weights=None. warnings.warn(msg) Traceback (most recent call last): File "/Users/rhf/Documents/robot/my_torch/PyTorch_Tutorial/Code/4_viewer/1_tensorboardX_demo.py", line 27, in writer.add_scalar(os.path.join("data", "scalar_systemtime"), s1[0], n_iter) File "/my_torch/lib/python3.10/site-packages/tensorboardX/writer.py", line 456, in add_scalar scalar(tag, scalar_value, display_name, summary_description), global_step, walltime) File "/my_torch/lib/python3.10/site-packages/tensorboardX/summary.py", line 152, in scalar scalar = make_np(scalar) File "/my_torch/lib/python3.10/site-packages/tensorboardX/x2num.py", line 28, in make_np return check_nan(prepare_pytorch(x)) File "/my_torch/lib/python3.10/site-packages/tensorboardX/x2num.py", line 43, in prepare_pytorch x = x.cpu().numpy() RuntimeError: Numpy is not available (my_torch) root@/mac 4_viewer #

Source: TingsongYu/PyTorch_Tutorial