mmgeneration icon indicating copy to clipboard operation
mmgeneration copied to clipboard

Installation error

Open codaubianca opened this issue 1 year ago • 4 comments

I want to use the mmgen module in my own project but I have been struggling with the installation. I couldn't find any issues on the topic. Any help is greatly appreciated.

Describe the bug First, I have tried to install the mmgen module by following the steps in the get_started tutorial. However, when running the following command in Step 1:

pip install -v -e .

I get the following error and the installation is interrupted:

Installing collected packages: mmgen
  Running setup.py develop for mmgen
    Running command python setup.py develop
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "D:\Work\FZI\TKS\workspace\adversarial_traffic_signs\mmgeneration\setup.py", line 173, in <module>
        add_mim_extension()
      File "D:\Work\FZI\TKS\workspace\adversarial_traffic_signs\mmgeneration\setup.py", line 159, in add_mim_extension 
        os.symlink(src_relpath, tar_path)
    OSError: [WinError 1314] A required privilege is not held by the client: '..\\..\\tools' -> 'D:\\Work\\FZI\\TKS\\workspace\\adversarial_traffic_signs\\mmgeneration\\mmgen\\.mim\\tools'

In a second attempt, I have tried to install mmgen as a dependency, as described in case b, with:

pip install mmgen

In this case, the installation is completed but I get another error when simply importing the mmgen module in my project. When I run the following code line:

from mmgen.apis import init_model, sample_conditional_model

I get the following error:

ModuleNotFoundError                       Traceback (most recent call last)
d:\Work\FZI\TKS\workspace\adversarial_traffic_signs\src\pretrained_gan_comparison.ipynb Cell 2 in <cell line: 10>()
      [7](vscode-notebook-cell:/d%3A/Work/FZI/TKS/workspace/adversarial_traffic_signs/src/pretrained_gan_comparison.ipynb#ch0000001?line=6) from pytorch_pretrained_biggan import BigGAN, one_hot_from_names, truncated_noise_sample, save_as_images, display_in_terminal
      [9](vscode-notebook-cell:/d%3A/Work/FZI/TKS/workspace/adversarial_traffic_signs/src/pretrained_gan_comparison.ipynb#ch0000001?line=8) # Open-MMLab models:
---> [10](vscode-notebook-cell:/d%3A/Work/FZI/TKS/workspace/adversarial_traffic_signs/src/pretrained_gan_comparison.ipynb#ch0000001?line=9) from mmgen.apis import init_model, sample_conditional_model

File d:\Work\FZI\TKS\workspace\adversarial_traffic_signs\env\lib\site-packages\mmgen\apis\__init__.py:2, in <module>
      1 # Copyright (c) OpenMMLab. All rights reserved.
----> 2 from .inference import (init_model, sample_conditional_model,
      3                         sample_ddpm_model, sample_img2img_model,
      4                         sample_unconditional_model)
      5 from .train import set_random_seed, train_model
      7 __all__ = [
      8     'set_random_seed', 'train_model', 'init_model', 'sample_img2img_model',
      9     'sample_unconditional_model', 'sample_conditional_model',
     10     'sample_ddpm_model'
     11 ]

File d:\Work\FZI\TKS\workspace\adversarial_traffic_signs\env\lib\site-packages\mmgen\apis\inference.py:9, in <module>
      6 from mmcv.utils import is_list_of
      8 from mmgen.datasets.pipelines import Compose
----> 9 from mmgen.models import BaseTranslationModel, build_model
     12 def init_model(config, checkpoint=None, device='cuda:0', cfg_options=None):
     13     """Initialize a detector from config file.
...
     17                                          EqualLinearActModule,
     18                                          ModMBStddevLayer, ModulatedStyleConv,
     19                                          ModulatedToRGB, ResBlock)

ModuleNotFoundError: No module named 'mmgen.models.architectures.stylegan.ada'

I have noticed that when installing mmgen via pip then the 'mmgen.models.architectures.stylegan.ada' module is not downloaded at all.

I have installed mmcv-full version 1.5.0 and other required dependencies in the local python environment I use for my project.

codaubianca avatar Aug 03 '22 16:08 codaubianca

I will attempt to reproduce your error on windows. You can add 'mmgen' to PYTHON_PATH for a temporary solution. Then you can use it like it has already been installed.

LeoXing1996 avatar Aug 03 '22 16:08 LeoXing1996

The same problem on Ubuntu using pip install mmgen. There should be some bugs in the init file.

IceClear avatar Aug 26 '22 08:08 IceClear

I want to use the mmgen module in my own project but I have been struggling with the installation. I couldn't find any issues on the topic. Any help is greatly appreciated.

Describe the bug First, I have tried to install the mmgen module by following the steps in the get_started tutorial. However, when running the following command in Step 1:

pip install -v -e .

I get the following error and the installation is interrupted:

Installing collected packages: mmgen
  Running setup.py develop for mmgen
    Running command python setup.py develop
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "D:\Work\FZI\TKS\workspace\adversarial_traffic_signs\mmgeneration\setup.py", line 173, in <module>
        add_mim_extension()
      File "D:\Work\FZI\TKS\workspace\adversarial_traffic_signs\mmgeneration\setup.py", line 159, in add_mim_extension 
        os.symlink(src_relpath, tar_path)
    OSError: [WinError 1314] A required privilege is not held by the client: '..\\..\\tools' -> 'D:\\Work\\FZI\\TKS\\workspace\\adversarial_traffic_signs\\mmgeneration\\mmgen\\.mim\\tools'

In a second attempt, I have tried to install mmgen as a dependency, as described in case b, with:

pip install mmgen

In this case, the installation is completed but I get another error when simply importing the mmgen module in my project. When I run the following code line:

from mmgen.apis import init_model, sample_conditional_model

I get the following error:

ModuleNotFoundError                       Traceback (most recent call last)
d:\Work\FZI\TKS\workspace\adversarial_traffic_signs\src\pretrained_gan_comparison.ipynb Cell 2 in <cell line: 10>()
      [7](vscode-notebook-cell:/d%3A/Work/FZI/TKS/workspace/adversarial_traffic_signs/src/pretrained_gan_comparison.ipynb#ch0000001?line=6) from pytorch_pretrained_biggan import BigGAN, one_hot_from_names, truncated_noise_sample, save_as_images, display_in_terminal
      [9](vscode-notebook-cell:/d%3A/Work/FZI/TKS/workspace/adversarial_traffic_signs/src/pretrained_gan_comparison.ipynb#ch0000001?line=8) # Open-MMLab models:
---> [10](vscode-notebook-cell:/d%3A/Work/FZI/TKS/workspace/adversarial_traffic_signs/src/pretrained_gan_comparison.ipynb#ch0000001?line=9) from mmgen.apis import init_model, sample_conditional_model

File d:\Work\FZI\TKS\workspace\adversarial_traffic_signs\env\lib\site-packages\mmgen\apis\__init__.py:2, in <module>
      1 # Copyright (c) OpenMMLab. All rights reserved.
----> 2 from .inference import (init_model, sample_conditional_model,
      3                         sample_ddpm_model, sample_img2img_model,
      4                         sample_unconditional_model)
      5 from .train import set_random_seed, train_model
      7 __all__ = [
      8     'set_random_seed', 'train_model', 'init_model', 'sample_img2img_model',
      9     'sample_unconditional_model', 'sample_conditional_model',
     10     'sample_ddpm_model'
     11 ]

File d:\Work\FZI\TKS\workspace\adversarial_traffic_signs\env\lib\site-packages\mmgen\apis\inference.py:9, in <module>
      6 from mmcv.utils import is_list_of
      8 from mmgen.datasets.pipelines import Compose
----> 9 from mmgen.models import BaseTranslationModel, build_model
     12 def init_model(config, checkpoint=None, device='cuda:0', cfg_options=None):
     13     """Initialize a detector from config file.
...
     17                                          EqualLinearActModule,
     18                                          ModMBStddevLayer, ModulatedStyleConv,
     19                                          ModulatedToRGB, ResBlock)

ModuleNotFoundError: No module named 'mmgen.models.architectures.stylegan.ada'

I have noticed that when installing mmgen via pip then the 'mmgen.models.architectures.stylegan.ada' module is not downloaded at all.

I have installed mmcv-full version 1.5.0 and other required dependencies in the local python environment I use for my project.

Have you found a solution?I have the same problem as you.

lyzla avatar Nov 08 '22 14:11 lyzla

I want to use the mmgen module in my own project but I have been struggling with the installation. I couldn't find any issues on the topic. Any help is greatly appreciated. Describe the bug First, I have tried to install the mmgen module by following the steps in the get_started tutorial. However, when running the following command in Step 1:

pip install -v -e .

I get the following error and the installation is interrupted:

Installing collected packages: mmgen
  Running setup.py develop for mmgen
    Running command python setup.py develop
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "D:\Work\FZI\TKS\workspace\adversarial_traffic_signs\mmgeneration\setup.py", line 173, in <module>
        add_mim_extension()
      File "D:\Work\FZI\TKS\workspace\adversarial_traffic_signs\mmgeneration\setup.py", line 159, in add_mim_extension 
        os.symlink(src_relpath, tar_path)
    OSError: [WinError 1314] A required privilege is not held by the client: '..\\..\\tools' -> 'D:\\Work\\FZI\\TKS\\workspace\\adversarial_traffic_signs\\mmgeneration\\mmgen\\.mim\\tools'

In a second attempt, I have tried to install mmgen as a dependency, as described in case b, with:

pip install mmgen

In this case, the installation is completed but I get another error when simply importing the mmgen module in my project. When I run the following code line:

from mmgen.apis import init_model, sample_conditional_model

I get the following error:

ModuleNotFoundError                       Traceback (most recent call last)
d:\Work\FZI\TKS\workspace\adversarial_traffic_signs\src\pretrained_gan_comparison.ipynb Cell 2 in <cell line: 10>()
      [7](vscode-notebook-cell:/d%3A/Work/FZI/TKS/workspace/adversarial_traffic_signs/src/pretrained_gan_comparison.ipynb#ch0000001?line=6) from pytorch_pretrained_biggan import BigGAN, one_hot_from_names, truncated_noise_sample, save_as_images, display_in_terminal
      [9](vscode-notebook-cell:/d%3A/Work/FZI/TKS/workspace/adversarial_traffic_signs/src/pretrained_gan_comparison.ipynb#ch0000001?line=8) # Open-MMLab models:
---> [10](vscode-notebook-cell:/d%3A/Work/FZI/TKS/workspace/adversarial_traffic_signs/src/pretrained_gan_comparison.ipynb#ch0000001?line=9) from mmgen.apis import init_model, sample_conditional_model

File d:\Work\FZI\TKS\workspace\adversarial_traffic_signs\env\lib\site-packages\mmgen\apis\__init__.py:2, in <module>
      1 # Copyright (c) OpenMMLab. All rights reserved.
----> 2 from .inference import (init_model, sample_conditional_model,
      3                         sample_ddpm_model, sample_img2img_model,
      4                         sample_unconditional_model)
      5 from .train import set_random_seed, train_model
      7 __all__ = [
      8     'set_random_seed', 'train_model', 'init_model', 'sample_img2img_model',
      9     'sample_unconditional_model', 'sample_conditional_model',
     10     'sample_ddpm_model'
     11 ]

File d:\Work\FZI\TKS\workspace\adversarial_traffic_signs\env\lib\site-packages\mmgen\apis\inference.py:9, in <module>
      6 from mmcv.utils import is_list_of
      8 from mmgen.datasets.pipelines import Compose
----> 9 from mmgen.models import BaseTranslationModel, build_model
     12 def init_model(config, checkpoint=None, device='cuda:0', cfg_options=None):
     13     """Initialize a detector from config file.
...
     17                                          EqualLinearActModule,
     18                                          ModMBStddevLayer, ModulatedStyleConv,
     19                                          ModulatedToRGB, ResBlock)

ModuleNotFoundError: No module named 'mmgen.models.architectures.stylegan.ada'

I have noticed that when installing mmgen via pip then the 'mmgen.models.architectures.stylegan.ada' module is not downloaded at all. I have installed mmcv-full version 1.5.0 and other required dependencies in the local python environment I use for my project.

Have you found a solution?I have the same problem as you.

I think currently the only solution is to install from the source rather than pip install and modify the related part.

IceClear avatar Nov 08 '22 15:11 IceClear