AnyDoor icon indicating copy to clipboard operation
AnyDoor copied to clipboard

setuptools - raise ValueError("path '%s' cannot be absolute" % pathname)

Open fuddyduddy opened this issue 1 year ago • 1 comments

I've encountered the installation problem on share=1.0.4 module. With the suggested environment config. Installed setuptools=66.0.0 and wheel=0.41.2. I don't want to alter any code from setuptools. But if it's the only way to do it, please suggests. Thanks.

  Building wheel for share (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [40 lines of output]
      C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\<my_user_name>\AppData\Local\Temp\pip-install-xyoqj7k8\share_84a33f02528d4e36a4ca9998fc05ed01\setup.py", line 11, in <module>
          setup(
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\dist.py", line 1208, in run_command
          super().run_command(command)
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\wheel\bdist_wheel.py", line 399, in run
          self.run_command("install")
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\dist.py", line 1208, in run_command
          super().run_command(command)
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\command\install.py", line 68, in run
          return orig.install.run(self)
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\_distutils\command\install.py", line 709, in run
          self.run_command(cmd_name)
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\dist.py", line 1208, in run_command
          super().run_command(command)
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\_distutils\command\install_data.py", line 61, in run
          dir = convert_path(f[0])
        File "C:\Users\<my_user_name>\.conda\envs\anydoor\lib\site-packages\setuptools\_distutils\util.py", line 139, in convert_path
          raise ValueError("path '%s' cannot be absolute" % pathname)
      ValueError: path '/etc' cannot be absolute
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for share
  Running setup.py clean for share
Failed to build share
ERROR: Could not build wheels for share, which is required to install pyproject.toml-based projects

(anydoor) C:\Users\<my_user_name>\...\0001_Github_Downloads\AnyDoor - Image Customization, virtual try-on>pip list
Package       Version
------------- -------
cmake         3.28.1
ffmpeg-python 0.2.0
pip           23.3.1
setuptools    66.0.0
wheel         0.41.2

fuddyduddy avatar Dec 20 '23 15:12 fuddyduddy

I solved it by modifying "util.py" function:

def convert_path (pathname):
    if os.sep == '/':
        return pathname
    if not pathname:
        return pathname
    if pathname[0] == '/':
        raise ValueError("path '%s' cannot be absolute" % pathname)
    if pathname[-1] == '/':
        raise ValueError("path '%s' cannot end with '/'" % pathname)

    paths = pathname.split('/')
    while '.' in paths:
        paths.remove('.')
    if not paths:
        return os.curdir
    return os.path.join(*paths)

TO

def convert_path (pathname):
    if os.sep == '/':
        return pathname
    if not pathname:
        return pathname

    paths = pathname.split('/')
    while '.' in paths:
        paths.remove('.')
    if not paths:
        return os.curdir
    return os.path.join(*paths)

OR There is a forked repository "AnyDoor-for-windows" with modified "util.py" you may use that to build "share" successfully.

sohaibhaider avatar Dec 21 '23 12:12 sohaibhaider