清理 Anaconda 的 pkgs并修复自己被误伤的M3DM的环境-修复失败

文章目录


清理缓存方法: 参考 一篇文章教你清理 Anaconda 的 pkgs

conda clean -p

Will remove 304 (14.89 GB) package(s).
Proceed ([y]/n)? y

conda clean -t

Will remove 464 (8.31 GB) tarball(s).
Proceed ([y]/n)? y

查看 df -h

修复

(被清缓存后,一直在用的环境突然不行了)
发现 报错1,不知道为什么需要降低版本。

  File "fusion_pretrain.py", line 11, in <module>
    from torch.utils.tensorboard import SummaryWriter
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/tensorboard/__init__.py", line 12, in <module>
    from .writer import FileWriter, SummaryWriter  # noqa: F401
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/tensorboard/writer.py", line 9, in <module>
    from tensorboard.compat.proto.event_pb2 import SessionLog
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/compat/proto/event_pb2.py", line 17, in <module>
    from tensorboard.compat.proto import summary_pb2 as tensorboard_dot_compat_dot_proto_dot_summary__pb2
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/compat/proto/summary_pb2.py", line 16, in <module>
    from tensorboard.compat.proto import tensor_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__pb2
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/compat/proto/tensor_pb2.py", line 16, in <module>
    from tensorboard.compat.proto import resource_handle_pb2 as tensorboard_dot_compat_dot_proto_dot_resource__handle__pb2
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/compat/proto/resource_handle_pb2.py", line 16, in <module>
    from tensorboard.compat.proto import tensor_shape_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__shape__pb2
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/compat/proto/tensor_shape_pb2.py", line 36, in <module>
    _descriptor.FieldDescriptor(
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 621, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

按提示2把设置那句复制在命令前面就可以

不过这两个提示是妥协,考虑问题起因大概是缓存被清,需要重新生成_pb2.py文件

卸载重新装一下protobuf 就没事了

pip uninstall protobuf
  Successfully uninstalled protobuf-5.26.1
  
pip install protobuf
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
ERROR: Could not find a version that satisfies the requirement protobuf (from versions: none)
ERROR: No matching distribution found for protobuf

conda install protobuf                                                             
Channels:
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done
  environment location: /home/cszx/miniconda3/envs/zgp_m3dm_main
  added / updated specs:
    - protobuf
The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    libprotobuf-3.20.3         |       he621ea3_0         2.4 MB
    protobuf-3.20.3            |   py38h6a678d5_0         326 KB
    ------------------------------------------------------------
                                           Total:         2.7 MB
The following NEW packages will be INSTALLED:

  libprotobuf        pkgs/main/linux-64::libprotobuf-3.20.3-he621ea3_0 
  protobuf           pkgs/main/linux-64::protobuf-3.20.3-py38h6a678d5_0 
The following packages will be UPDATED:

  openssl                                 3.0.13-h7f8727e_0 --> 3.0.13-h7f8727e_2 
Proceed ([y]/n)? y
Downloading and Extracting Packages:                                                                                                                                                                                                 
Preparing transaction: done                                                                                                                                                                                                             
Verifying transaction: done
Executing transaction: done                                  

又报错2。
在这里插入图片描述
按之前自己在博客中记录的笔记12-远程服务器上配置linux深度学习C++环境全过程记录(笔记1和2的同样环境第3次配置)
重装,

pip install torch1.12.1+cu113 torchvision0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113 -i https://pypi.tuna.tsinghua.edu.cn/simple(失败)

不知道为什么之前这样可以的,现在报错了ERROR: Invalid requirement: ‘torch1.12.1+cu113’

修改pip install torch1.12.1+cu113 torchvision0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113 -i https://pypi.tuna.tsinghua.edu.cn/simple(可以安装,但不能成功运行)

不知道为什么卸载的是1.4.0而不是之前安装的版本,误清缓存难道会改变版本吗,还是我不经意安装的
Installing collected packages: torch, torchvision, torchaudio
Attempting uninstall: torch
Found existing installation: torch 1.4.0
Uninstalling torch-1.4.0:
Successfully uninstalled torch-1.4.0
不过成功了
Attempting uninstall: torchvision
Found existing installation: torchvision 0.5.0
Uninstalling torchvision-0.5.0:
Successfully uninstalled torchvision-0.5.0
Attempting uninstall: torchaudio
Found existing installation: torchaudio 2.3.0
Uninstalling torchaudio-2.3.0:
Successfully uninstalled torchaudio-2.3.0
Successfully installed torch-1.12.1+cu113 torchaudio-0.12.1+cu113 torchvision-0.13.1+cu113

(zgp_m3dm_main) ~ conda list                  
# packages in environment at /home/cszx/miniconda3/envs/zgp_m3dm_main:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             5.1                       1_gnu  
_sysroot_linux-64_curr_repodata_hack 3                   haa98f57_10  
absl-py                   2.1.0                    pypi_0    pypi
audioread                 3.0.1                    pypi_0    pypi
beautifulsoup4            4.12.3                   pypi_0    pypi
binutils_impl_linux-64    2.38                 h2a08ee3_1  
blas                      1.0                         mkl  
brotli                    1.0.9                h5eee18b_7  
brotli-bin                1.0.9                h5eee18b_7  
bypy                      1.8.5                    pypi_0    pypi
bzip2                     1.0.8                h5eee18b_5  
ca-certificates           2024.3.11            h06a4308_0  
cachetools                4.2.4                    pypi_0    pypi
certifi                   2024.2.2                 pypi_0    pypi
cffi                      1.16.0                   pypi_0    pypi
charset-normalizer        3.3.2                    pypi_0    pypi
contourpy                 1.0.5            py38hdb19cb5_0  
cudatoolkit               11.3.1               h2bc3f7f_2  
cycler                    0.11.0             pyhd3eb1b0_0  
cyrus-sasl                2.1.28               h52b45da_1  
dbus                      1.13.18              hb2f20db_0  
decorator                 5.1.1                    pypi_0    pypi
dill                      0.3.8                    pypi_0    pypi
expat                     2.6.2                h6a678d5_0  
filelock                  3.13.4                   pypi_0    pypi
fontconfig                2.14.1               h4c34cd2_2  
fonttools                 4.51.0           py38h5eee18b_0  
freetype                  2.12.1               h4a9f257_0  
fsspec                    2024.3.1                 pypi_0    pypi
gcc_impl_linux-64         8.4.0               he7ac559_17  
gdown                     5.1.0                    pypi_0    pypi
glib                      2.78.4               h6a678d5_0  
glib-tools                2.78.4               h6a678d5_0  
google-auth               1.35.0                   pypi_0    pypi
google-auth-oauthlib      0.4.6                    pypi_0    pypi
grpcio                    1.62.2                   pypi_0    pypi
gst-plugins-base          1.14.1               h6a678d5_1  
gstreamer                 1.14.1               h5eee18b_1  
gxx_impl_linux-64         8.4.0               h9ce2e92_17  
huggingface-hub           0.22.2                   pypi_0    pypi
icu                       73.1                 h6a678d5_0  
idna                      3.7                      pypi_0    pypi
imageio                   2.34.1                   pypi_0    pypi
imgaug                    0.4.0                    pypi_0    pypi
importlib-metadata        7.1.0                    pypi_0    pypi
importlib_resources       6.1.1            py38h06a4308_1  
intel-openmp              2023.1.0         hdb19cb5_46306  
jinja2                    3.1.4                    pypi_0    pypi
joblib                    1.4.0                    pypi_0    pypi
jpeg                      9e                   h5eee18b_1  
kernel-headers_linux-64   3.10.0              h57e8cba_10  
kiwisolver                1.4.4            py38h6a678d5_0  
knn-cuda                  0.2                      pypi_0    pypi
kornia                    0.5.3                    pypi_0    pypi
krb5                      1.20.1               h143b758_1  
lazy-loader               0.4                      pypi_0    pypi
lcms2                     2.12                 h3be6417_0  
ld_impl_linux-64          2.38                 h1181459_1  
lerc                      3.0                  h295c915_0  
libbrotlicommon           1.0.9                h5eee18b_7  
libbrotlidec              1.0.9                h5eee18b_7  
libbrotlienc              1.0.9                h5eee18b_7  
libclang                  14.0.6          default_hc6dbbc7_1  
libclang13                14.0.6          default_he11475f_1  
libcups                   2.4.2                h2d74bed_1  
libdeflate                1.17                 h5eee18b_1  
libedit                   3.1.20230828         h5eee18b_0  
libffi                    3.4.4                h6a678d5_0  
libgcc-devel_linux-64     8.4.0               hd257e2f_17  
libgcc-ng                 11.2.0               h1234567_1  
libglib                   2.78.4               hdc74915_0  
libgomp                   11.2.0               h1234567_1  
libiconv                  1.16                 h7f8727e_2  
libllvm14                 14.0.6               hdb19cb5_3  
libpng                    1.6.39               h5eee18b_0  
libpq                     12.17                hdbd6064_0  
librosa                   0.7.0                    pypi_0    pypi
libstdcxx-devel_linux-64  8.4.0               hf0c5c8d_17  
libstdcxx-ng              11.2.0               h1234567_1  
libtiff                   4.5.1                h6a678d5_0  
libuuid                   1.41.5               h5eee18b_0  
libwebp-base              1.3.2                h5eee18b_0  
libxcb                    1.15                 h7f8727e_0  
libxkbcommon              1.0.1                h5eee18b_1  
libxml2                   2.10.4               hfdd30dd_2  
llvmlite                  0.31.0                   pypi_0    pypi
lz4-c                     1.9.4                h6a678d5_0  
markdown                  3.6                      pypi_0    pypi
markupsafe                2.1.5                    pypi_0    pypi
matplotlib                3.7.2            py38h06a4308_0  
matplotlib-base           3.7.2            py38h1128e8f_0  
metann                    0.2.5                    pypi_0    pypi
mkl                       2023.1.0         h213fc3f_46344  
mkl-service               2.4.0            py38h5eee18b_1  
mkl_fft                   1.3.8            py38h5eee18b_0  
mkl_random                1.2.4            py38hdb19cb5_0  
mpmath                    1.3.0                    pypi_0    pypi
multiprocess              0.70.16                  pypi_0    pypi
mysql                     5.7.24               h721c034_2  
ncurses                   6.4                  h6a678d5_0  
networkx                  3.1                      pypi_0    pypi
numba                     0.48.0                   pypi_0    pypi
numpy                     1.18.1                   pypi_0    pypi
nvidia-cublas-cu12        12.1.3.1                 pypi_0    pypi
nvidia-cuda-cupti-cu12    12.1.105                 pypi_0    pypi
nvidia-cuda-nvrtc-cu12    12.1.105                 pypi_0    pypi
nvidia-cuda-runtime-cu12  12.1.105                 pypi_0    pypi
nvidia-cudnn-cu12         8.9.2.26                 pypi_0    pypi
nvidia-cufft-cu12         11.0.2.54                pypi_0    pypi
nvidia-curand-cu12        10.3.2.106               pypi_0    pypi
nvidia-cusolver-cu12      11.4.5.107               pypi_0    pypi
nvidia-cusparse-cu12      12.1.0.106               pypi_0    pypi
nvidia-nccl-cu12          2.20.5                   pypi_0    pypi
nvidia-nvjitlink-cu12     12.5.40                  pypi_0    pypi
nvidia-nvtx-cu12          12.1.105                 pypi_0    pypi
oauthlib                  3.2.2                    pypi_0    pypi
opencv-python             4.2.0.32                 pypi_0    pypi
openjpeg                  2.4.0                h3ad879b_0  
openssl                   3.0.13               h7f8727e_0  
packaging                 24.0                     pypi_0    pypi
pandas                    1.0.3                    pypi_0    pypi
pcre2                     10.42                hebb0a14_0  
pillow                    7.0.0                    pypi_0    pypi
pip                       23.3.1           py38h06a4308_0  
ply                       3.11                     py38_0  
plyfile                   1.0.3                    pypi_0    pypi
pointnet2-ops             3.0.0                    pypi_0    pypi
protobuf                  5.26.1                   pypi_0    pypi
ptflops                   0.7.2.2                  pypi_0    pypi
pyasn1                    0.6.0                    pypi_0    pypi
pyasn1-modules            0.4.0                    pypi_0    pypi
pycparser                 2.22                     pypi_0    pypi
pyparsing                 3.0.9            py38h06a4308_0  
pyqt                      5.15.10          py38h6a678d5_0  
pyqt5-sip                 12.13.0          py38h5eee18b_0  
python                    3.8.19               h955ad1f_0  
python-dateutil           2.8.2              pyhd3eb1b0_0  
pytz                      2024.1                   pypi_0    pypi
pywavelets                1.4.1                    pypi_0    pypi
pyyaml                    6.0.1                    pypi_0    pypi
qt-main                   5.15.2              h53bd1ea_10  
readline                  8.2                  h5eee18b_0  
requests                  2.31.0                   pypi_0    pypi
requests-oauthlib         2.0.0                    pypi_0    pypi
requests-toolbelt         1.0.0                    pypi_0    pypi
resampy                   0.3.1                    pypi_0    pypi
rsa                       4.9                      pypi_0    pypi
safetensors               0.4.3                    pypi_0    pypi
scikit-image              0.21.0                   pypi_0    pypi
scikit-learn              1.3.2                    pypi_0    pypi
scipy                     1.8.1                    pypi_0    pypi
setuptools                59.5.0                   pypi_0    pypi
shapely                   2.0.4                    pypi_0    pypi
sip                       6.7.12           py38h6a678d5_0  
six                       1.16.0             pyhd3eb1b0_1  
soundfile                 0.12.1                   pypi_0    pypi
soupsieve                 2.5                      pypi_0    pypi
sqlite                    3.41.2               h5eee18b_0  
sympy                     1.12                     pypi_0    pypi
sysroot_linux-64          2.17                h57e8cba_10  
tabulate                  0.9.0                    pypi_0    pypi
tbb                       2021.8.0             hdb19cb5_0  
tensorboard               2.1.1                    pypi_0    pypi
tensorboard-data-server   0.7.2                    pypi_0    pypi
threadpoolctl             3.4.0                    pypi_0    pypi
tifffile                  2023.7.10                pypi_0    pypi
timm                      0.9.16                   pypi_0    pypi
tk                        8.6.12               h1ccaba5_0  
tomli                     2.0.1            py38h06a4308_0  
torch                     1.12.1+cu113             pypi_0    pypi
torchaudio                0.12.1+cu113             pypi_0    pypi
torchsummary              1.5.1                    pypi_0    pypi
torchvision               0.13.1+cu113             pypi_0    pypi
tornado                   6.3.3            py38h5eee18b_0  
tqdm                      4.66.2                   pypi_0    pypi
triton                    2.3.0                    pypi_0    pypi
typing-extensions         4.11.0                   pypi_0    pypi
tzdata                    2024.1                   pypi_0    pypi
unicodedata2              15.1.0           py38h5eee18b_0  
urllib3                   2.2.1                    pypi_0    pypi
werkzeug                  3.0.2                    pypi_0    pypi
wget                      3.2                      pypi_0    pypi
wheel                     0.41.2           py38h06a4308_0  
xz                        5.4.6                h5eee18b_0  
yacs                      0.1.8                    pypi_0    pypi
zipp                      3.18.1                   pypi_0    pypi
zlib                      1.2.13               h5eee18b_0  
zstd                      1.5.5                hc292b87_0  

可以了。

下一个报错ImportError: numpy.core.multiarray failed to import

(zgp_m3dm_main) ~/zgp/M3DM-repetition pip install numpy
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: numpy in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (1.18.1)

还需要先卸载重新装一下

pip uninstall numpy
 pip install numpy

Successfully installed numpy-1.24.4
因为重装的不是原来的旧版本了,报错

    import pandas as pd
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/pandas/__init__.py", line 180, in <module>
    import pandas.testing
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/pandas/testing.py", line 5, in <module>
    from pandas._testing import (
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/pandas/_testing.py", line 24, in <module>
    import pandas._libs.testing as _testing
  File "pandas/_libs/testing.pyx", line 10, in init pandas._libs.testing
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

requirements.txt加上pandas 重装pip install -r requirements.txt (没有用)
conda list
对比之前安装的笔记12-远程服务器上配置linux深度学习C++环境全过程记录(笔记1和2的同样环境第3次配置)版本安装pandas(可以了)
pip install pandas==2.0.3
Successfully uninstalled pandas-1.0.3
Successfully installed pandas-2.0.3
可以了
conda list

### 
Running coreset for DINO+Point_MAE+Fusion on class bagel...
Traceback (most recent call last):
  File "main.py", line 123, in <module>
    run_3d_ads(args)
  File "main.py", line 20, in run_3d_ads
    model.fit(cls)
  File "/home/cszx/zgp/M3DM-repetition/m3dm_runner.py", line 57, in fit
    method.run_coreset()
  File "/home/cszx/zgp/M3DM-repetition/feature_extractors/multiple_features.py", line 837, in run_coreset
    self.patch_xyz_lib = torch.cat(self.patch_xyz_lib, 0)
RuntimeError: torch.cat(): expected a non-empty list of Tensors

# 但是fusion_pretrain.py报错
  File "fusion_pretrain.py", line 11, in <module>
    from torch.utils.tensorboard import SummaryWriter
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/tensorboard/__init__.py", line 12, in <module>
    from .writer import FileWriter, SummaryWriter  # noqa: F401
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/tensorboard/writer.py", line 12, in <module>
    from tensorboard.plugins.projector.projector_config_pb2 impor  t ProjectorConfig
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/plugins/projector/__init__.py", line 32, in <module>
    from tensorboard.plugins.projector import projector_plugin as _projector_plugin
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/plugins/projector/projector_plugin.py", line 35, in <module>
    from tensorboard.backend.http_util import Respond
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/backend/http_util.py", line 29, in <module>
    import six
ModuleNotFoundError: No module named 'six'
安装conda install matplotlib
Channels:
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/cszx/miniconda3/envs/zgp_m3dm_main

  added / updated specs:
    - matplotlib


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    brotli-1.0.9               |       h5eee18b_8          18 KB
    brotli-bin-1.0.9           |       h5eee18b_8          19 KB
    libbrotlicommon-1.0.9      |       h5eee18b_8          69 KB
    libbrotlidec-1.0.9         |       h5eee18b_8          31 KB
    libbrotlienc-1.0.9         |       h5eee18b_8         286 KB
    libclang-14.0.6            |default_hc6dbbc7_1         137 KB
    matplotlib-3.7.2           |   py38h06a4308_0           8 KB
    pcre2-10.42                |       hebb0a14_1         1.3 MB
    python-dateutil-2.9.0post0 |   py38h06a4308_2         279 KB
    ------------------------------------------------------------
                                           Total:         2.1 MB

The following NEW packages will be INSTALLED:

  blas               pkgs/main/linux-64::blas-1.0-mkl 
  brotli             pkgs/main/linux-64::brotli-1.0.9-h5eee18b_8 
  brotli-bin         pkgs/main/linux-64::brotli-bin-1.0.9-h5eee18b_8 
  bzip2              pkgs/main/linux-64::bzip2-1.0.8-h5eee18b_6 
  contourpy          pkgs/main/linux-64::contourpy-1.0.5-py38hdb19cb5_0 
  cycler             pkgs/main/noarch::cycler-0.11.0-pyhd3eb1b0_0 
  cyrus-sasl         pkgs/main/linux-64::cyrus-sasl-2.1.28-h52b45da_1 
  dbus               pkgs/main/linux-64::dbus-1.13.18-hb2f20db_0 
  expat              pkgs/main/linux-64::expat-2.6.2-h6a678d5_0 
  fontconfig         pkgs/main/linux-64::fontconfig-2.14.1-h4c34cd2_2 
  fonttools          pkgs/main/linux-64::fonttools-4.51.0-py38h5eee18b_0 
  freetype           pkgs/main/linux-64::freetype-2.12.1-h4a9f257_0 
  glib               pkgs/main/linux-64::glib-2.78.4-h6a678d5_0 
  glib-tools         pkgs/main/linux-64::glib-tools-2.78.4-h6a678d5_0 
  gst-plugins-base   pkgs/main/linux-64::gst-plugins-base-1.14.1-h6a678d5_1 
  gstreamer          pkgs/main/linux-64::gstreamer-1.14.1-h5eee18b_1 
  icu                pkgs/main/linux-64::icu-73.1-h6a678d5_0 
  importlib_resourc~ pkgs/main/linux-64::importlib_resources-6.1.1-py38h06a4308_1 
  intel-openmp       pkgs/main/linux-64::intel-openmp-2023.1.0-hdb19cb5_46306 
  kiwisolver         pkgs/main/linux-64::kiwisolver-1.4.4-py38h6a678d5_0 
  krb5               pkgs/main/linux-64::krb5-1.20.1-h143b758_1 
  libbrotlicommon    pkgs/main/linux-64::libbrotlicommon-1.0.9-h5eee18b_8 
  libbrotlidec       pkgs/main/linux-64::libbrotlidec-1.0.9-h5eee18b_8 
  libbrotlienc       pkgs/main/linux-64::libbrotlienc-1.0.9-h5eee18b_8 
  libclang           pkgs/main/linux-64::libclang-14.0.6-default_hc6dbbc7_1 
  libclang13         pkgs/main/linux-64::libclang13-14.0.6-default_he11475f_1 
  libcups            pkgs/main/linux-64::libcups-2.4.2-h2d74bed_1 
  libedit            pkgs/main/linux-64::libedit-3.1.20230828-h5eee18b_0 
  libglib            pkgs/main/linux-64::libglib-2.78.4-hdc74915_0 
  libiconv           pkgs/main/linux-64::libiconv-1.16-h5eee18b_3 
  libllvm14          pkgs/main/linux-64::libllvm14-14.0.6-hdb19cb5_3 
  libpq              pkgs/main/linux-64::libpq-12.17-hdbd6064_0 
  libuuid            pkgs/main/linux-64::libuuid-1.41.5-h5eee18b_0 
  libxcb             pkgs/main/linux-64::libxcb-1.15-h7f8727e_0 
  libxkbcommon       pkgs/main/linux-64::libxkbcommon-1.0.1-h5eee18b_1 
  libxml2            pkgs/main/linux-64::libxml2-2.10.4-hfdd30dd_2 
  matplotlib         pkgs/main/linux-64::matplotlib-3.7.2-py38h06a4308_0 
  matplotlib-base    pkgs/main/linux-64::matplotlib-base-3.7.2-py38h1128e8f_0 
  mkl                pkgs/main/linux-64::mkl-2023.1.0-h213fc3f_46344 
  mkl-service        pkgs/main/linux-64::mkl-service-2.4.0-py38h5eee18b_1 
  mkl_fft            pkgs/main/linux-64::mkl_fft-1.3.8-py38h5eee18b_0 
  mkl_random         pkgs/main/linux-64::mkl_random-1.2.4-py38hdb19cb5_0 
  mysql              pkgs/main/linux-64::mysql-5.7.24-h721c034_2 
  numpy              pkgs/main/linux-64::numpy-1.24.3-py38hf6e8229_1 
  numpy-base         pkgs/main/linux-64::numpy-base-1.24.3-py38h060ed82_1 
  packaging          pkgs/main/linux-64::packaging-23.2-py38h06a4308_0 
  pcre2              pkgs/main/linux-64::pcre2-10.42-hebb0a14_1 
  pillow             pkgs/main/linux-64::pillow-10.3.0-py38h5eee18b_0 
  ply                pkgs/main/linux-64::ply-3.11-py38_0 
  pyparsing          pkgs/main/linux-64::pyparsing-3.0.9-py38h06a4308_0 
  pyqt               pkgs/main/linux-64::pyqt-5.15.10-py38h6a678d5_0 
  pyqt5-sip          pkgs/main/linux-64::pyqt5-sip-12.13.0-py38h5eee18b_0 
  python-dateutil    pkgs/main/linux-64::python-dateutil-2.9.0post0-py38h06a4308_2 
  qt-main            pkgs/main/linux-64::qt-main-5.15.2-h53bd1ea_10 
  setuptools         pkgs/main/linux-64::setuptools-69.5.1-py38h06a4308_0 
  sip                pkgs/main/linux-64::sip-6.7.12-py38h6a678d5_0 
  six                pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_1 
  tbb                pkgs/main/linux-64::tbb-2021.8.0-hdb19cb5_0 
  tomli              pkgs/main/linux-64::tomli-2.0.1-py38h06a4308_0 
  tornado            pkgs/main/linux-64::tornado-6.3.3-py38h5eee18b_0 
  unicodedata2       pkgs/main/linux-64::unicodedata2-15.1.0-py38h5eee18b_0 
  zipp               pkgs/main/linux-64::zipp-3.17.0-py38h06a4308_0 


Proceed ([y]/n)? y


Downloading and Extracting Packages:
                                                                                                                                                                                                                                        
Preparing transaction: done                                                                                                                                                                                                             
Verifying transaction: done                                                                                                                                                                                                             
Executing transaction: done    
报错
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/compat/tensorflow_stub
/dtypes.py:568: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
  (np.object, string),
Traceback (most recent call last):
  File "fusion_pretrain.py", line 11, in <module>
    from torch.utils.tensorboard import SummaryWriter
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/tensorboard/__init__.py", line 12, in <module>
    from .writer import FileWriter, SummaryWriter  # noqa: F401
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/tensorboard/writer.py", line 13, in <module>
    from tensorboard.summary.writer.event_file_writer import EventFileWriter
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/summary/__init__.py", line 25, in <module>
    from tensorboard.summary import v1
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/summary/v1.py", line 26, in <module>
    from tensorboard.plugins.histogram import summary as _histogram_summary
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/plugins/histogram/summary.py", line 38, in <module>
    from tensorboard.plugins.histogram import summary_v2
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/plugins/histogram/summary_v2.py", line 38, in <module>
    from tensorboard.util import tensor_util
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/util/tensor_util.py", line 24, in <module>
    from tensorboard.compat.tensorflow_stub import dtypes, compat, tensor_shape
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/compat/tensorflow_stub/__init__.py", line 25, in <module>
    from .dtypes import as_dtype  # noqa
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py", line 568, in <module>
    (np.object, string),
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe. 
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

改torch版本安装1.9.0

按照笔记1笔记1-Windows10深度学习环境
conda install --offline /home/cszx/zgp/M3DM-repetition/pytorch-1.9.0-py3.8_cuda11.1_cudnn8.0.5_0.tar.bz2

Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

报错变了
Traceback (most recent call last):
File “fusion_pretrain.py”, line 11, in
from torch.utils.tensorboard import SummaryWriter
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/tensorboard/init.py”, line 4, in
LooseVersion = distutils.version.LooseVersion
AttributeError: module ‘distutils’ has no attribute ‘version’
发现有1.9和1.12两个torch
pip uninstall torch
Proceed (Y/n)? Y
Successfully uninstalled torch-1.12.1+cu113
报错
Traceback (most recent call last):
File “fusion_pretrain.py”, line 10, in
import torch.backends.cudnn as cudnn
ModuleNotFoundError: No module named ‘torch.backends’
安装
pip install torch1.12.1+cu113 torchvision0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113 -i https://pypi.tuna.tsinghua.edu.cn/simple
报错ERROR: Invalid requirement: ‘torch1.12.1+cu113’
将1.9也卸载
pip uninstall torch
Found existing installation: torch 1.9.0
Uninstalling torch-1.9.0:
Would remove:
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/caffe2
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch-1.9.0-py3.8.egg-info

再次安装
pip install torch1.12.1+cu113 torchvision0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113 -i https://pypi.tuna.tsinghua.edu.cn/simple

(zgp_m3dm_main) ~/zgp/M3DM-repetition pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113 -i https://pypi.tuna.tsinghua.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://download.pytorch.org/whl/cu113
Collecting torch==1.12.1+cu113
  Using cached https://download.pytorch.org/whl/cu113/torch-1.12.1%2Bcu113-cp38-cp38-linux_x86_64.whl (1837.7 MB)
Requirement already satisfied: torchvision==0.13.1+cu113 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (0.13.1+cu113)
Requirement already satisfied: torchaudio==0.12.1 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (0.12.1+cu113)
Requirement already satisfied: typing-extensions in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from torch==1.12.1+cu113) (4.11.0)
Requirement already satisfied: numpy in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from torchvision==0.13.1+cu113) (1.18.1)
Requirement already satisfied: requests in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from torchvision==0.13.1+cu113) (2.31.0)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from torchvision==0.13.1+cu113) (10.3.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from requests->torchvision==0.13.1+cu113) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from requests->torchvision==0.13.1+cu113) (3.7)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from requests->torchvision==0.13.1+cu113) (2.2.1)
Requirement already satisfied: certifi>=2017.4.17 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from requests->torchvision==0.13.1+cu113) (2024.2.2)
Installing collected packages: torch
Successfully installed torch-1.12.1+cu113

报错
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:568: FutureWarning: In the future np.object will be defined as the corresponding NumPy scalar.
(np.object, string),
Traceback (most recent call last):
File “fusion_pretrain.py”, line 11, in
from torch.utils.tensorboard import SummaryWriter
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/tensorboard/init.py”, line 12, in
from .writer import FileWriter, SummaryWriter # noqa: F401
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/tensorboard/writer.py”, line 13, in
from tensorboard.summary.writer.event_file_writer import EventFileWriter
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/summary/init.py”, line 25, in
from tensorboard.summary import v1
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/summary/v1.py”, line 26, in
from tensorboard.plugins.histogram import summary as _histogram_summary
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/plugins/histogram/summary.py”, line 38, in
from tensorboard.plugins.histogram import summary_v2
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/plugins/histogram/summary_v2.py”, line 38, in
from tensorboard.util import tensor_util
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/util/tensor_util.py”, line 24, in
from tensorboard.compat.tensorflow_stub import dtypes, compat, tensor_shape
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/compat/tensorflow_stub/init.py”, line 25, in
from .dtypes import as_dtype # noqa
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py”, line 568, in
(np.object, string),
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/numpy/init.py”, line 305, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module ‘numpy’ has no attribute ‘object’.
np.object was a deprecated alias for the builtin object. To avoid this error in existing code, use object by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Proceed (Y/n)? Y
Successfully uninstalled numpy-1.18.1
Proceed (Y/n)? Y
Successfully uninstalled numpy-1.24.3
去掉pandas再次python3 -m pip install -r requirements.txt
报错

(zgp_m3dm_main) ~/zgp/M3DM-repetition python3 -m pip install -r requirements.txt
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting numpy (from -r requirements.txt (line 1))
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/98/5d/5738903efe0ecb73e51eb44feafba32bdba2081263d40c5043568ff60faf/numpy-1.24.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)
Requirement already satisfied: Pillow in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 2)) (10.3.0)
Requirement already satisfied: scikit-learn in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 3)) (1.3.2)
Requirement already satisfied: scipy in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (1.8.1)
Requirement already satisfied: timm in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 5)) (0.9.16)
Requirement already satisfied: torch in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 6)) (1.12.1+cu113)
Requirement already satisfied: torchvision in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 7)) (0.13.1+cu113)
Requirement already satisfied: tqdm in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 8)) (4.66.2)
Requirement already satisfied: wget in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 9)) (3.2)
Requirement already satisfied: tifffile in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 10)) (2023.7.10)
ERROR: Ignored the following versions that require a different python version: 1.25.0 Requires-Python >=3.9; 1.25.0rc1 Requires-Python >=3.9; 1.25.1 Requires-Python >=3.9; 1.25.2 Requires-Python >=3.9; 1.26.0 Requires-Python <3.13,>=3.9; 1.26.0b1 Requires-Python <3.13,>=3.9; 1.26.0rc1 Requires-Python <3.13,>=3.9; 1.26.1 Requires-Python <3.13,>=3.9; 1.26.2 Requires-Python >=3.9; 1.26.3 Requires-Python >=3.9; 1.26.4 Requires-Python >=3.9; 2.0.0b1 Requires-Python >=3.9; 2.0.0rc1 Requires-Python >=3.9; 2.0.0rc2 Requires-Python >=3.9
ERROR: Could not find a version that satisfies the requirement scikit-imagec (from versions: none)
ERROR: No matching distribution found for scikit-imagec

卸载torch重来

改torch版本安装1.10.0参考《Multimodal Industrial Anomaly Detection via Hybrid Fusion》论文学习及代码复现

由于提示有冲突

The conflict is caused by:
    The user requested torch==1.10.0+cu113
    torchvision 0.11.1+cu113 depends on torch==1.10.0
    torchaudio 0.12.1+cu113 depends on torch==1.12.1
    The user requested torch==1.10.0+cu113
    torchvision 0.11.1+cu113 depends on torch==1.10.0
    torchaudio 0.12.1 depends on torch==1.12.1

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

先pip uninstall torch torchvision torchaudio

  Successfully uninstalled torchvision-0.13.1+cu113
Found existing installation: torchaudio 0.12.1+cu113
Uninstalling torchaudio-0.12.1+cu113:
  Would remove:
    /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torchaudio-0.12.1+cu113.dist-info/*
    /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torchaudio/*
Proceed (Y/n)? Y
  Successfully uninstalled torchaudio-0.12.1+cu113·

pip install torch1.10.0+cu113 torchvision0.11.1+cu113 torchaudio --extra-index-url https://download.pytorch.org/whl/cu113 -i https://pypi.tuna.tsinghua.edu.cn/simple(能成功安装)

Successfully installed numpy-1.24.4 torch-1.10.0+cu113 torchaudio-0.10.0+cu113 torchvision-0.11.1+cu113

报错

Traceback (most recent call last):
  File "fusion_pretrain.py", line 11, in <module>
    from torch.utils.tensorboard import SummaryWriter
  File "/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/tensorboard/__init__.py", line 4, in <module>
    LooseVersion = distutils.version.LooseVersion
AttributeError: module 'distutils' has no attribute 'version'

pip uninstall torchsummary
Found existing installation: torchsummary 1.5.1
Uninstalling torchsummary-1.5.1:
Would remove:
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torchsummary-1.5.1.dist-info/*
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torchsummary/*
Proceed (Y/n)? Y
Successfully uninstalled torchsummary-1.5.1

pip install -r requirements.txt(不需要,显示全部满足)

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: numpy in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (1.24.4)
Requirement already satisfied: Pillow in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 2)) (10.3.0)
Requirement already satisfied: scikit-learn in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 3)) (1.3.2)
Requirement already satisfied: scipy in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (1.8.1)
Requirement already satisfied: timm in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 5)) (0.9.16)
Requirement already satisfied: torch in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 6)) (1.10.0+cu113)
Requirement already satisfied: torchvision in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 7)) (0.11.1+cu113)
Requirement already satisfied: tqdm in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 8)) (4.66.2)
Requirement already satisfied: wget in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 9)) (3.2)
Requirement already satisfied: tifffile in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 10)) (2023.7.10)
Requirement already satisfied: scikit-image in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 11)) (0.21.0)
Requirement already satisfied: imageio in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 12)) (2.34.1)
Requirement already satisfied: tensorboard in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 13)) (2.1.1)
Requirement already satisfied: opencv-python in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 14)) (4.2.0.32)
Requirement already satisfied: setuptools==59.5.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from -r requirements.txt (line 15)) (59.5.0)
Requirement already satisfied: joblib>=1.1.1 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from scikit-learn->-r requirements.txt (line 3)) (1.4.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from scikit-learn->-r requirements.txt (line 3)) (3.4.0)
Requirement already satisfied: pyyaml in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from timm->-r requirements.txt (line 5)) (6.0.1)
Requirement already satisfied: huggingface_hub in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from timm->-r requirements.txt (line 5)) (0.22.2)
Requirement already satisfied: safetensors in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from timm->-r requirements.txt (line 5)) (0.4.3)
Requirement already satisfied: typing-extensions in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from torch->-r requirements.txt (line 6)) (4.11.0)
Requirement already satisfied: networkx>=2.8 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from scikit-image->-r requirements.txt (line 11)) (3.1)
Requirement already satisfied: PyWavelets>=1.1.1 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from scikit-image->-r requirements.txt (line 11)) (1.4.1)
Requirement already satisfied: packaging>=21 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from scikit-image->-r requirements.txt (line 11)) (23.2)
Requirement already satisfied: lazy_loader>=0.2 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from scikit-image->-r requirements.txt (line 11)) (0.4)
Requirement already satisfied: absl-py>=0.4 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard->-r requirements.txt (line 13)) (2.1.0)
Requirement already satisfied: grpcio>=1.24.3 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard->-r requirements.txt (line 13)) (1.62.2)
Requirement already satisfied: google-auth<2,>=1.6.3 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard->-r requirements.txt (line 13)) (1.35.0)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard->-r requirements.txt (line 13)) (0.4.6)
Requirement already satisfied: markdown>=2.6.8 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard->-r requirements.txt (line 13)) (3.6)
Requirement already satisfied: protobuf>=3.6.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard->-r requirements.txt (line 13)) (3.20.3)
Requirement already satisfied: requests<3,>=2.21.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard->-r requirements.txt (line 13)) (2.31.0)
Requirement already satisfied: six>=1.10.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard->-r requirements.txt (line 13)) (1.16.0)
Requirement already satisfied: werkzeug>=0.11.15 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard->-r requirements.txt (line 13)) (3.0.2)
Requirement already satisfied: wheel>=0.26 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard->-r requirements.txt (line 13)) (0.41.2)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from google-auth<2,>=1.6.3->tensorboard->-r requirements.txt (line 13)) (4.2.4)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from google-auth<2,>=1.6.3->tensorboard->-r requirements.txt (line 13)) (0.4.0)
Requirement already satisfied: rsa<5,>=3.1.4 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from google-auth<2,>=1.6.3->tensorboard->-r requirements.txt (line 13)) (4.9)
Requirement already satisfied: requests-oauthlib>=0.7.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard->-r requirements.txt (line 13)) (2.0.0)
Requirement already satisfied: importlib-metadata>=4.4 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from markdown>=2.6.8->tensorboard->-r requirements.txt (line 13)) (7.1.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard->-r requirements.txt (line 13)) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard->-r requirements.txt (line 13)) (3.7)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard->-r requirements.txt (line 13)) (2.2.1)
Requirement already satisfied: certifi>=2017.4.17 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard->-r requirements.txt (line 13)) (2024.2.2)
Requirement already satisfied: MarkupSafe>=2.1.1 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from werkzeug>=0.11.15->tensorboard->-r requirements.txt (line 13)) (2.1.5)
Requirement already satisfied: filelock in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from huggingface_hub->timm->-r requirements.txt (line 5)) (3.13.4)
Requirement already satisfied: fsspec>=2023.5.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from huggingface_hub->timm->-r requirements.txt (line 5)) (2024.3.1)
Requirement already satisfied: zipp>=0.5 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from importlib-metadata>=4.4->markdown>=2.6.8->tensorboard->-r requirements.txt (line 13)) (3.17.0)
Requirement already satisfied: pyasn1<0.7.0,>=0.4.6 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard->-r requirements.txt (line 13)) (0.6.0)
Requirement already satisfied: oauthlib>=3.0.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard->-r requirements.txt (line 13)) (3.2.2)

参考from torch.utils.tensorboard import SummaryWriter导入错误重新安装 pip install tensorboard==1.14.0

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting tensorboard==1.14.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/91/2d/2ed263449a078cd9c8a9ba50ebd50123adf1f8cfbea1492f9084169b89d9/tensorboard-1.14.0-py3-none-any.whl (3.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.1/3.1 MB 2.3 MB/s eta 0:00:00
Requirement already satisfied: absl-py>=0.4 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard==1.14.0) (2.1.0)
Requirement already satisfied: grpcio>=1.6.3 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard==1.14.0) (1.62.2)
Requirement already satisfied: markdown>=2.6.8 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard==1.14.0) (3.6)
Requirement already satisfied: numpy>=1.12.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard==1.14.0) (1.24.4)
Requirement already satisfied: protobuf>=3.6.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard==1.14.0) (3.20.3)
Requirement already satisfied: setuptools>=41.0.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard==1.14.0) (59.5.0)
Requirement already satisfied: six>=1.10.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard==1.14.0) (1.16.0)
Requirement already satisfied: werkzeug>=0.11.15 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard==1.14.0) (3.0.2)
Requirement already satisfied: wheel>=0.26 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from tensorboard==1.14.0) (0.41.2)
Requirement already satisfied: importlib-metadata>=4.4 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from markdown>=2.6.8->tensorboard==1.14.0) (7.1.0)
Requirement already satisfied: MarkupSafe>=2.1.1 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from werkzeug>=0.11.15->tensorboard==1.14.0) (2.1.5)
Requirement already satisfied: zipp>=0.5 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from importlib-metadata>=4.4->markdown>=2.6.8->tensorboard==1.14.0) (3.17.0)
Installing collected packages: tensorboard
  Attempting uninstall: tensorboard
    Found existing installation: tensorboard 2.1.1
    Uninstalling tensorboard-2.1.1:
      Successfully uninstalled tensorboard-2.1.1
Successfully installed tensorboard-1.14.0

没有作用 File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/tensorboard/init.py”, line 4, in
LooseVersion = distutils.version.LooseVersion
AttributeError: module ‘distutils’ has no attribute ‘version’

而且knn也被连累了

File “main.py”, line 2, in
from m3dm_runner import M3DM
File “/home/cszx/zgp/M3DM-repetition/m3dm_runner.py”, line 5, in
from feature_extractors import multiple_features
File “/home/cszx/zgp/M3DM-repetition/feature_extractors/multiple_features.py”, line 2, in
from feature_extractors.features import Features
File “/home/cszx/zgp/M3DM-repetition/feature_extractors/features.py”, line 19, in
from knn_cuda import KNN
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/knn_cuda/init.py”, line 38, in
_knn = load_cpp_ext(“knn”)
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/knn_cuda/init.py”, line 26, in load_cpp_ext
ext = load(
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 1124, in load
return _jit_compile(
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 1362, in _jit_compile
return _import_module_from_library(name, build_directory, is_python_module)
File “/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/torch/utils/cpp_extension.py”, line 1752, in _import_module_from_library
module = importlib.util.module_from_spec(spec)
ImportError: /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/knn_cuda/csrc/_ext/knn/knn.so: undefined symbol: _ZN3c106detail19maybe_wrap_dim_slowEllb
再次 pip install --upgrade https://github.com/unlimblue/KNN_CUDA/releases/download/0.2/KNN_CUDA-0.2-py3-none-any.whl
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting KNN-CUDA0.2
Downloading https://github.com/unlimblue/KNN_CUDA/releases/download/0.2/KNN_CUDA-0.2-py3-none-any.whl (5.7 kB)
Requirement already satisfied: numpy in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from KNN-CUDA
0.2) (1.24.4)
Requirement already satisfied: scikit-learn in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from KNN-CUDA0.2) (1.3.2)
Requirement already satisfied: torch>=1.1.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from KNN-CUDA
0.2) (1.10.0+cu113)
Requirement already satisfied: typing-extensions in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from torch>=1.1.0->KNN-CUDA0.2) (4.11.0)
Requirement already satisfied: scipy>=1.5.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from scikit-learn->KNN-CUDA
0.2) (1.8.1)
Requirement already satisfied: joblib>=1.1.1 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from scikit-learn->KNN-CUDA0.2) (1.4.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from scikit-learn->KNN-CUDA
0.2) (3.4.0)
卸载,再次安装

pip uninstall knn-cuda

Found existing installation: KNN-CUDA 0.2
Uninstalling KNN-CUDA-0.2:
Would remove:
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/KNN_CUDA-0.2.dist-info/*
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/knn_cuda/*
Would not remove (might be manually added):
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/knn_cuda/csrc/_ext/knn/.ninja_deps
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/knn_cuda/csrc/_ext/knn/.ninja_log
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/knn_cuda/csrc/_ext/knn/build.ninja
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/knn_cuda/csrc/_ext/knn/knn.cuda.o
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/knn_cuda/csrc/_ext/knn/knn.o
/home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages/knn_cuda/csrc/_ext/knn/knn.so
Proceed (Y/n)? Y
Successfully uninstalled KNN-CUDA-0.2

pip install --upgrade https://github.com/unlimblue/KNN_CUDA/releases/download/0.2/KNN_CUDA-0.2-py3-none-any.whl

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting KNN-CUDA0.2
Using cached https://github.com/unlimblue/KNN_CUDA/releases/download/0.2/KNN_CUDA-0.2-py3-none-any.whl (5.7 kB)
Requirement already satisfied: numpy in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from KNN-CUDA
0.2) (1.24.4)
Requirement already satisfied: scikit-learn in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from KNN-CUDA0.2) (1.3.2)
Requirement already satisfied: torch>=1.1.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from KNN-CUDA
0.2) (1.10.0+cu113)
Requirement already satisfied: typing-extensions in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from torch>=1.1.0->KNN-CUDA0.2) (4.11.0)
Requirement already satisfied: scipy>=1.5.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from scikit-learn->KNN-CUDA
0.2) (1.8.1)
Requirement already satisfied: joblib>=1.1.1 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from scikit-learn->KNN-CUDA0.2) (1.4.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in /home/cszx/miniconda3/envs/zgp_m3dm_main/lib/python3.8/site-packages (from scikit-learn->KNN-CUDA
0.2) (3.4.0)
Installing collected packages: KNN-CUDA
Successfully installed KNN-CUDA-0.2
还是不行
环境漏洞百出了,看来不如重建环境

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值