Open xiyufeng2 opened 3 years ago
Hi, try to check the link below: https://github.com/facebookresearch/detectron2/issues/157
I have seen that already,but not helpful.I have biult Detectron2 as instruction。
It's likely your terminal and IDE have different environments. Can you try to install a new conda environment and use the same one for both?
Hi @xingyizhou ,
I was facing the same problem and got it to work following more or less the instructions in the previous issue.
Some details about how I did this:
My environment
name: wfsdet
channels:
- conda-forge
- defaults
dependencies:
- python=3.7
- cudatoolkit
- pip
- pip:
- termcolor
- cython
- numpy
- tqdm
- matplotlib
- termcolor
- yacs
- tabulate
- cloudpickle
- Pillow
- imagesize
- tensorboard
- opencv-python
- torch
- torchvision
- lvis
- omegaconf>=2
- iopath
- git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI
- git+https://github.com/facebookresearch/fvcore.git
This was deleted because when initially installed, along with Detectron2, the libgcc was not present. So, I had to clean it up.
conda remove --name wfsdet --all
conda env create -f environment.yml
conda activate wfsdet
conda update -n base -c defaults conda
conda install -c conda-forge libgcc
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
python -c "from detectron2 import _C"
It should output no error at all.
My setup:
When I run demo.py in Treminal, it's successful. But when running it in IDE(pycharm etc.), shows the error:ImportError: cannot import name '_C' from 'detectron2' (/home/ubuntu/CenterNet2/detectron2/init.py) 在终端运行成功,但在IDE运行失败(line11:from detectron2.data.detection_utils import read_image)