NVIDIA / vid2vid

Pytorch implementation of our method for high-resolution (e.g. 2048x1024) photorealistic video-to-video translation.
Other
8.6k stars 1.2k forks source link

ModuleNotFoundError: No module named 'resample2d_cuda' #30

Closed TatsuyaOsugi closed 6 years ago

TatsuyaOsugi commented 6 years ago

Hi,

I faced an issue, 'ModuleNotFoundError: No module named 'resample2d_cuda'. Do you know how to solve this?

'resample2d_package' folder contains as below. D:\download\vid2vid\models\flownet2_pytorch\networks\resample2d_package\ pycache init.py resample2d.py resample2d_cuda.cc resample2d_kernel.cu resample2d_kernel.cuh setup.py

Following is the cmd command.

D:\download\vid2vid>python test.py --name label2city_2048 --dataroot datasets/Cityscapes/test_A --loadSize 2048 --n_scales_spatial 3 --use_instance --fg --use_single_G ------------ Options ------------- aspect_ratio: 1.0 batchSize: 1 checkpoints_dir: ./checkpoints dataroot: datasets/Cityscapes/test_A dataset_mode: temporal debug: False display_id: 0 display_winsize: 512 feat_num: 3 fg: True fg_labels: [26] fineSize: 512 gpu_ids: [0] how_many: 300 input_nc: 3 isTrain: False label_feat: False label_nc: 35 loadSize: 2048 load_features: False load_pretrain: max_dataset_size: inf model: vid2vid nThreads: 2 n_blocks: 9 n_blocks_local: 3 n_downsample_E: 3 n_downsample_G: 3 n_frames_G: 3 n_gpus_gen: 1 n_local_enhancers: 1 n_scales_spatial: 3 name: label2city_2048 ndf: 64 nef: 32 netE: simple netG: composite ngf: 128 no_first_img: False no_flip: False norm: batch ntest: inf output_nc: 3 phase: test resize_or_crop: scaleWidth results_dir: ./results/ serial_batches: False tf_log: False use_instance: True use_real_img: False use_single_G: True which_epoch: latest -------------- End ---------------- CustomDatasetDataLoader dataset [TestDataset] was created vid2vid Traceback (most recent call last): File "test.py", line 24, in model = create_model(opt) File "D:\download\vid2vid\models\models.py", line 7, in create_model from .vid2vid_model_G import Vid2VidModelG File "D:\download\vid2vid\models\vid2vid_model_G.py", line 13, in from . import networks File "D:\download\vid2vid\models\networks.py", line 12, in from .flownet2_pytorch.networks.resample2d_package.resample2d import Resample2d File "D:\download\vid2vid\models\flownet2_pytorch\networks\resample2d_package\resample2d.py", line 3, in import resample2d_cuda ModuleNotFoundError: No module named 'resample2d_cuda'

dustinfreeman commented 6 years ago

This looks like a wrong pytorch version problem. Do you know which version you have installed?

fniroui commented 6 years ago

Having the same issue. Tried pytorch 0.4.1 and 0.4.0.

CodeBlazer commented 6 years ago

Go to the folder: vid2vid/models/flownet2_pytorch/networks/resample2d_package/

and run the commands: python3 setup.py build and python3 setup.py install

in that order, fixed it for me.

nwestlake commented 6 years ago

I wanted it to work (without this error message or a separate install) for multiple users on an NFS share with users cloning the internal git repo. After running the installers, I copied the ".egg" folders into a directory in NFS (modules/flownet2_pytorch is a symbolic link in the repo): channelnorm_cuda-0.0.0-py3.5-linux-x86_64.egg correlation_cuda-0.0.0-py3.5-linux-x86_64.egg resample2d_cuda-0.0.0-py3.5-linux-x86_64.egg

At run time, I use the following:

### Copyright (C) 2017 NVIDIA Corporation. All rights reserved.
### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
import time
import os
import numpy as np
import sys

PACKAGES_DIR = 'models/flownet2_pytorch/networks/site-packages/' 
for egg in os.listdir(PACKAGES_DIR):
    sys.path.append(os.path.join(PACKAGES_DIR, egg))

from collections import OrderedDict
from torch.autograd import Variable
from options.test_options import TestOptions
from data.data_loader import CreateDataLoader
from models.models import create_model
import util.util as util
from util.visualizer import Visualizer
from util import html
fniroui commented 6 years ago

I installed flownet2 again and my problem was solved!

guancheng817 commented 5 years ago

Go to the folder: vid2vid/models/flownet2_pytorch/networks/resample2d_package/

and run the commands: python3 setup.py build and python3 setup.py install

in that order, fixed it for me.

thanks, it works well

SimonsLiu commented 5 years ago

转到文件夹: vid2vid / models / flownet2_pytorch / networks / resample2d_package / 并运行命令: python3 setup.py buildpython3 setup.py install 按此顺序,为我修好了。

谢谢,它运作良好

I followed your instructions and did the same. But the error is as follows: ImportError: /home/×××××××/anaconda3/lib/python3.5/site-packages/resample2d_cuda-0.0.0-py3.5-linux-x86_64.egg/resample2d_cuda.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZNSt13runtime_errorC2EPKc

shaldor0315 commented 5 years ago

maybe you forget to run the commands: bash install.sh

jakubLangr commented 4 years ago

Hi @shaldor0315 , I got the following issue despite running bash install.sh

python
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import resample2d_cuda
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /home/ubuntu/.local/lib/python3.6/site-packages/resample2d_cuda-0.0.0-py3.6-linux-x86_64.egg/resample2d_cuda.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN3c104impl28tls_excluded_tensor_type_setEv
>>>

Any thoughts?

chinmaychinara91 commented 4 years ago

I followed all possible steps above but still get the error below:

import resample2d_cuda ImportError: /root/.local/lib/python3.6/site-packages/resample2d_cuda-0.0.0-py3.6-linux-x86_64.egg/resample2d_cuda.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN3c105ErrorC1ENS_14SourceLocationERKSs

I have the following installed: Python 3.6 Pytorch 1.0.1 CUDA 9.0

Anyone able to solve it ?

aryanna384 commented 3 years ago

what files will create after successfully running setup.py build and install? When I run the above command, I met with:

fatal error C1021: invalid preprocessor command 'warning' error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

how can I fix it?

ZHANG-hengzhi commented 3 years ago

what files will create after successfully running setup.py build and install? When I run the above command, I met with:

fatal error C1021: invalid preprocessor command 'warning' error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

how can I fix it?

I have the same problem. How did you solve it?

ZHANG-hengzhi commented 3 years ago

转到文件夹: vid2vid / models / flownet2_pytorch / networks / resample2d_package / 并运行命令: python3 setup.py buildpython3 setup.py install 按此顺序,为我修好了。

谢谢,它运作良好

I followed your instructions and did the same. But the error is as follows: ImportError: /home/×××××××/anaconda3/lib/python3.5/site-packages/resample2d_cuda-0.0.0-py3.5-linux-x86_64.egg/resample2d_cuda.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZNSt13runtime_errorC2EPKc

image Hello! How can i solve this problem?