当前位置: 首页 > news >正文

【无标题】安装环境

这里写目录标题

      • 清华镜像加速
    • 安装cuda11.3 +PyTorch 1.10.1
      • https://pytorch.org/get-started/previous-versions/
      • [如果没有可以点Previous pyTorch Versions,这里面有更多的更早的版本](https://pytorch.org/get-started/locally/)
    • 复制非空文件夹cp: -r not specified; omitting directory XXX
    • MultiplexedOCR
      • cannot import name ‘_download_url_to_file‘ from ‘torch.utils.model_zoo‘
      • ImportError: cannot import name 'TopologicalError' from 'shapely.geos'
      • ImportError: /data1/xyj/MultiplexedOCR-main/multiplexer/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN3c106SymInt19promote_to_negativeEv
      • TypeError: join() argument must be str, bytes, or os.PathLike object, not ‘NoneType‘
    • masktextspotter
      • apex安装
      • 安装maskrcnn-benchmark(maskrcnn)
      • maskrcnn-benchmark疯狂报错
        • ImportError: cannot import name ‘_C’ from ‘maskrcnn_benchmark’
    • Test_spotting_transformer
      • /data1/xyj/anaconda3/envs/TESTR/lib/python3.8/site-packages/detectron2/utils/visualizer.py:308: UserWarning: Glyph 21475 (\N{CJK UNIFIED IDEOGRAPH-53E3}) missing from current font.
    • openmmlab
      • error: metadata-generation-failed
    • ERROR: Failed building wheel for mmpycocotools
    • ERROR: Could not build wheels for mmpycocotools, which is required to install pyproject.toml-based projects
    • ImportError: /usr/local/anaconda3/envs/py38/lib/python3.8/site-packages/mmcv/_ext.cpython-38-x86_64-
    • AssertionError: MMCV==2.1.0 is used but incompatible. Please install mmcv>=1.2.4, <=1.4.0.
    • 安装mmcv
    • mmcv报错:ModuleNotFoundError: No module named ‘mmcv._ext‘
    • OSError: checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth is not a checkpoint file
      • RuntimeError: CUDA error: no kernel image is available for execution on the device
    • ==**安装torch cuda成功后,用以下代码测试cuda是否可用:**==

清华镜像加速

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simplepip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html

安装cuda11.3 +PyTorch 1.10.1

https://pytorch.org/get-started/previous-versions/

在这里插入图片描述
conda install pytorch1.10.1 torchvision0.11.2 torchaudio==0.10.1 cudatoolkit=11.3 -c pytorch -c conda-forge

不可以,一直在解析环境

如果没有可以点Previous pyTorch Versions,这里面有更多的更早的版本

在这里插入图片描述

pip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio==0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html

通过以上指令会把Pytorch1.10以及需要的CUDA11.3全部安装好(不需要单独安装CUDA)

复制非空文件夹cp: -r not specified; omitting directory XXX

linux复制操作 cp: -r not specified; omitting directory XXX 错误
记得加上 -r

MultiplexedOCR

cannot import name ‘_download_url_to_file‘ from ‘torch.utils.model_zoo‘

ImportError: cannot import name ‘HASH_REGEX’ from ‘torch.utils.model_zoo’

try:from torch.hub import HASH_REGEX, _download_url_to_file, urlparse
except ImportError:from torch.hub import download_url_to_filefrom torch.hub import urlparsefrom torch.hub import  HASH_REGEX#from torch.utils.model_zoo import _download_url_to_file#from torch.utils.model_zoo import urlparse#from torch.utils.model_zoo import HASH_REGEX

ImportError: cannot import name ‘TopologicalError’ from ‘shapely.geos’

Revert Shapely to 1.8.5 and Numpy to 1.23.4
Should work.

ImportError: /data1/xyj/MultiplexedOCR-main/multiplexer/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN3c106SymInt19promote_to_negativeEv

I’ve faced of this issue recently and creating a new environment with parameters below solved my problem.

PS : I assume that you’re using torch with CUDA, if you’re not you can install non-GPU versions.

torch version : 1.9 + cu111
torchvision : 0.10.0 + cu111
torchaudio : 0.9.0

You can download these from ;

pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

好像不管什么版本 -f 后面接的都是一个网址

TypeError: join() argument must be str, bytes, or os.PathLike object, not ‘NoneType‘

masktextspotter

conda create -n masktextspotter python=3.8
conda activate maskrcnn_benchmark
#安装各种依赖包
conda install ipython
pip install ninja yacs cython matplotlib tqdm opencv-python# install PyTorch 反正后面torch报错,我换了个版本conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
# install pycocotoolscd $INSTALL_DIRgit clone https://github.com/cocodataset/cocoapi.gitcd cocoapi/PythonAPIpython setup.py build_ext install# install apexcd $INSTALL_DIRgit clone https://github.com/NVIDIA/apex.gitcd apexpython setup.py install --cuda_ext --cpp_ext# clone repocd $INSTALL_DIRgit clone https://github.com/MhLiao/MaskTextSpotterV3.gitcd MaskTextSpotterV3# buildpython setup.py build develop

apex安装

此句报错,

python setup.py install --cuda_ext --cpp_ext

或许换成这句有用pip install -v --no-cache-dir ./,待会试试

注意apex和下面的maskrcnn-benchmark都不可以直接pip

安装maskrcnn-benchmark(maskrcnn)

一堆报错,报错找不到maskrcnn-benchmark
但是清楚地看到项目同级文件夹下有maskrcnn-benchmark这个包
我甚至很愚蠢地

import torch
print(torch.__file__) 

查看包的路径,想把maskrcnn-benchmark这个文件夹复制到搜寻的路径(安装的包就是一个文件夹嘛)TT,查到是 anaconda3/envs/masktextspotter/lib/python3.8/site-packages,放到这个路径下,好像没再报错了,但可能这个文件夹就没安装成功,是错的
python import 搜索包路径的机制,以及添加自定义python包的方法

cd ../
git clone https://github.com/facebookresearch/maskrcnn-benchmark.git
cd maskrcnn-benchmark
#安装相应的包
pip3 install -r requirements.txt

maskrcnn-benchmark疯狂报错

ImportError: cannot import name ‘_C’ from ‘maskrcnn_benchmark’

修改处:

nms.py

from maskrcnn_benchmark import _C
修改为:
from ._utils import _C

没用,继续报错TT TT

有时间再看看把

maskrcnn安装及遇到的各种问题
搭建maskrcnn-benchmark的环境遇到问题

Test_spotting_transformer

训练语料库只含少量中文数据,论文中写到将其忽略

python demo/demo.py --config-file configs/TESTR/TotalText/TESTR_R_50_Polygon.yaml --input work_dirs/ocr_en_422k --output output/en --opts MODEL.WEIGHTS work_dirs/totaltext_testr_R_50_polygon.pth MODEL.TRANSFORMER.INFERENCE_TH_TEST 0.3 
python demo/demo.py --config-file configs/TESTR/TotalText/TESTR_R_50_Polygon.yaml --input work_dirs/ocr_en_422k --output output/en --opts MODEL.WEIGHTS work_dirs/totaltext_testr_R_50_polygon.pth MODEL.TRANSFORMER.INFERENCE_TH_TEST 0.3 

检测中文时出现以下错误

/data1/xyj/anaconda3/envs/TESTR/lib/python3.8/site-packages/detectron2/utils/visualizer.py:308: UserWarning: Glyph 21475 (\N{CJK UNIFIED IDEOGRAPH-53E3}) missing from current font.

openmmlab

在这里插入图片描述
从网上上找到的资料看,可能是由于最新版本的pytorch (1.11以上)去除对这个头文件的支持,所以我们建议使用pytorch 1.8版本会比较稳定

pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

原来是conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.8 -c pytorch -c nvidia 这个版本

error: metadata-generation-failed

error: metadata-generation-failed

需要执行命令 pip install setuptools==50.3.2

问题解决

ERROR: Failed building wheel for mmpycocotools

安装cython=0.29.33版本就可以解决

pip3 install cython==0.29.33 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
pip install mmpycocotools

ERROR: Could not build wheels for mmpycocotools, which is required to install pyproject.toml-based projects

ImportError: /usr/local/anaconda3/envs/py38/lib/python3.8/site-packages/mmcv/_ext.cpython-38-x86_64-

mmcv官方:https://mmcv.readthedocs.io/en/latest/get_started/installation.html

这些问题归根到底还是mmcv-full和自己安装的pytorch版本不匹配的原因导致的,所以在安装mmcv-full时,尽量不要偷懒,不要直接pip install mmcv-full,先检查好自己的nvidia驱动以及CUDA版本,然后去mmcv的github或者官网去寻找指定的命令去下载,找到匹配的版本下载安装后,就可以正常运行了。

原文链接:https://blog.csdn.net/weixin_42130300/article/details/121616567

在这里插入图片描述
官方链接

AssertionError: MMCV==2.1.0 is used but incompatible. Please install mmcv>=1.2.4, <=1.4.0.

安装mmcv

MMCV是OpenMMLab系列代码的基础库。Linux环境安装的whl包又打包好的,相对较容易,可以直接下载安装
特别注意需要和Pytorch 和 CUDA版本对应,才能确保安装,安装过程出现ERROR的红色字样均需要卸载重新安装
当前机器版本为Torch 1.8.0 CUDA 10.2 ,安装相应的版本
#安装mmcv
#使用简单功能使用下命令
#!pip install mmcv -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.1/index.html
#安装完全版本
#!pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.1/index.html

#安装只需要修改cuda版本和torch版本即可,当前安装的是mmcv-full
————————————————
版权声明:本文为CSDN博主「瑾怀轩」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ckq707718837/article/details/121252909

pip uninstall -y mmdet mmcv
conda install -y cython==0.28.5
pip install mmcv==0.6.2 terminaltables Pillow==6.2.2export FORCE_CUDA="1"pip install "git+https://github.com/open-mmlab/cocoapi.git#subdirectory=pycocotools"
pip install "git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI"rm -rf build
pip install -r requirements/build.txt
python setup.py developpip install mmcv==1.4.0
# pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/{cu版本}/{torch版本}/index.html
pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.1/index.html

mmcv报错:ModuleNotFoundError: No module named ‘mmcv._ext‘

当前的仓库代码是基于mmcv-full==1.3.4和mmdet=2.11.0,新的mmdet一些接口的调用位置会发生变化

mmdet=2.11.0
pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.1/index.html
解决
解决方法:

mmcv正常安装

先卸载mmcv-full,然后重新安装一下

OSError: checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth is not a checkpoint file

config文件对应错了

RuntimeError: CUDA error: no kernel image is available for execution on the device

换了个环境

conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge

哭死

安装torch cuda成功后,用以下代码测试cuda是否可用:

python -c 'import torch;print(torch.__version__)'

查看版本

 1.8.1+cu102
import torch
torch.cuda.is_available()
# 返回True 接着用下列代码进一步测试
torch.zeros(1).cuda()

在这里插入图片描述

http://www.lryc.cn/news/256727.html

相关文章:

  • 一. 初识数据结构和算法
  • qt 使用百度在线地图 方法1
  • 轻快小miniconda3在linux下的安装配置-centos9stream-Miniconda3 Linux 64-bit
  • C语言——字符函数和字符串函数(一)
  • 15.Java程序设计-基于SSM框架的微信小程序校园求职系统的设计与实现
  • 蓝桥杯航班时间
  • openEuler学习05-kernel升级
  • Linux-centos上如何配置管理NFS服务器?
  • 自然语言处理第2天:自然语言处理词语编码
  • ES6中的Promise
  • 载入了名字空间‘htmltools’ 0.5.6,但需要的是>= 0.5.7解决方案
  • Cisco 思科路由交换网络设备 安全基线 安全加固操作
  • WPF仿网易云搭建笔记(0):项目搭建
  • Python爬虫利器:BeautifulSoup库详解
  • 【链表Linked List】力扣-117 填充每个节点的下一个右侧节点指针II
  • 安卓adb【备忘录】
  • Linux笔记之删除指定目录下除最新修改的以 .pack 为扩展名的文件之外的所有文件
  • 什么是呼叫中心的语音通道?呼叫中心语音线路有几种?
  • 3D点云:平面模型上提取凸(凹)多边形方法
  • 论文笔记--A Fine-grained Interpretability Evaluation Benchmark for Neural NLP
  • NFC和蓝牙在物联网中有什么意义?如何选择?
  • 代码随想录二刷 |二叉树 | 二叉树的最小深度
  • 云上守沪 | 云轴科技ZStack成功实践精选(上海)
  • 2023 IoTDB 用户大会成功举办,深入洞察工业互联网数据价值
  • cache教程 3.HTTP服务器
  • redis应用-分布式锁
  • 51单片机程序
  • Android 分享小结
  • Ubunutu18.04 ROS melodic 无人机 XTDrone PX4 仿真平台配置
  • JVM 命令行监控及诊断工具