Image-Adaptive-3DLUT icon indicating copy to clipboard operation
Image-Adaptive-3DLUT copied to clipboard

Difficulty setting up package

Open abnormally-distributed opened this issue 2 years ago • 3 comments

Hi,

First, some basic information about my setup which may be relevant. I am running Pyton 3.8.1, which was installed as part of Anaconda. I am using the Spyder IDE. My operating system is Windows 10.

My issue is that I cannot get the package set up because it says invalid syntax.

Since the pytorch version installed was 1.10.2, I followed the instructions on the github home page:

cd trilinear_cpp sh setup.sh

Of course changing to the trilinear_cpp directory is fine, but the problem happens with the sh setup.sh line:

sh setup.sh SyntaxError: invalid syntax

So I just looked at what setup.sh is doing. Since I am using an IDE, I manually added an environment variable for CUDA_HOME and pointed it to the correct location in Windows (C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6).

Next, I tried running the setup.py file, but it says OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root. After investigation, I discovered the notebook variant of my GPU does no support cuda processing. So, I simply simplified the setup.py script to the following:

from setuptools import setup
import torch
from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CppExtension


setup(name='trilinear',
   ext_modules=[CppExtension('trilinear', ['src/trilinear.cpp'])],
   cmdclass={'build_ext': BuildExtension})

This results in a sequence of errors (for the record, running the original version of setup.py has the same result):

An exception has occurred, use %tb to see the full traceback.

Traceback (most recent call last):

  File "D:\Anaconda3\lib\distutils\core.py", line 134, in setup
    ok = dist.parse_command_line()

  File "D:\Anaconda3\lib\distutils\dist.py", line 501, in parse_command_line
    raise DistutilsArgError("no commands supplied")

DistutilsArgError: no commands supplied


During handling of the above exception, another exception occurred:

SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied

Of course, typing %tb just repeats the above, adding no additional information. I know with debugging the first error is the best place to start, but I am not sure what the problem is relating to core.py, or why dist.py thinks commands are missing.

I am new to python so I apologize if the solution is obvious to some, but I am at a loss for how to get this to work. The Image Adaptive 3D Lut seems like it would be very nice to use with processing my photography, so is there a potential solution to these errors?

abnormally-distributed avatar Feb 18 '22 08:02 abnormally-distributed

Hi,

First, some basic information about my setup which may be relevant. I am running Pyton 3.8.1, which was installed as part of Anaconda. I am using the Spyder IDE. My operating system is Windows 10.

My issue is that I cannot get the package set up because it says invalid syntax.

Since the pytorch version installed was 1.10.2, I followed the instructions on the github home page:

cd trilinear_cpp sh setup.sh

Of course changing to the trilinear_cpp directory is fine, but the problem happens with the sh setup.sh line:

sh setup.sh SyntaxError: invalid syntax

So I just looked at what setup.sh is doing. Since I am using an IDE, I manually added an environment variable for CUDA_HOME and pointed it to the correct location in Windows (C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6).

Next, I tried running the setup.py file, but it says OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root. After investigation, I discovered the notebook variant of my GPU does no support cuda processing. So, I simply simplified the setup.py script to the following:

from setuptools import setup
import torch
from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CppExtension


setup(name='trilinear',
   ext_modules=[CppExtension('trilinear', ['src/trilinear.cpp'])],
   cmdclass={'build_ext': BuildExtension})

This results in a sequence of errors (for the record, running the original version of setup.py has the same result):

An exception has occurred, use %tb to see the full traceback.

Traceback (most recent call last):

  File "D:\Anaconda3\lib\distutils\core.py", line 134, in setup
    ok = dist.parse_command_line()

  File "D:\Anaconda3\lib\distutils\dist.py", line 501, in parse_command_line
    raise DistutilsArgError("no commands supplied")

DistutilsArgError: no commands supplied


During handling of the above exception, another exception occurred:

SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied

Of course, typing %tb just repeats the above, adding no additional information. I know with debugging the first error is the best place to start, but I am not sure what the problem is relating to core.py, or why dist.py thinks commands are missing.

I am new to python so I apologize if the solution is obvious to some, but I am at a loss for how to get this to work. The Image Adaptive 3D Lut seems like it would be very nice to use with processing my photography, so is there a potential solution to these errors?

HIi i want to setup trilinear_cpp ,but error image have you setup success ,give me some advices,thanks

zhanghongyong123456 avatar Mar 10 '22 09:03 zhanghongyong123456

You may try to use the torch.nn.functional.grid_sample to replace the trilinear function if you have difficulty in building up the cuda implementation. Please refer to https://github.com/HuiZeng/Image-Adaptive-3DLUT/issues/14 for more information. It may take some time to modify the corresponding codes.

HuiZeng avatar Mar 11 '22 06:03 HuiZeng

You may try to use the torch.nn.functional.grid_sample to replace the trilinear function if you have difficulty in building up the cuda implementation. Please refer to #14 for more information. It may take some time to modify the corresponding codes.

I'm not sure if I have the ability to modify the code, I want to install this c++ library on windows, are there any installation requirements, I think I'm missing some key operation

zhanghongyong123456 avatar Mar 12 '22 01:03 zhanghongyong123456