libfuse/python-fuse

Does not install on Python 2.7

MarioVilas opened this issue · 1 comments

Output of pip2 below:

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: colorama in /home/mario/.local/lib/python2.7/site-packages (from -r requirements.txt (line 2)) (0.4.4)
Requirement already satisfied: argparse-color-formatter in /home/mario/.local/lib/python2.7/site-packages (from -r requirements.txt (line 3)) (1.2.2.post2)
Requirement already satisfied: texttable in /home/mario/.local/lib/python2.7/site-packages (from -r requirements.txt (line 4)) (1.6.3)
Collecting fuse-python
  Using cached fuse-python-1.0.1.tar.gz (48 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-SqGZP4/fuse-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-SqGZP4/fuse-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-DPQm1G
         cwd: /tmp/pip-install-SqGZP4/fuse-python/
    Complete output (48 lines):
    Usage:
      pkg-config [OPTION?]
    
    Help Options:
      -h, --help                              Show help options
    
    Application Options:
      --version                               output version of pkg-config
      --modversion                            output version for package
      --atleast-pkgconfig-version=VERSION     require given version of pkg-config
      --libs                                  output all linker flags
      --static                                output linker flags for static linking
      --short-errors                          print short errors
      --libs-only-l                           output -l flags
      --libs-only-other                       output other libs (e.g. -pthread)
      --libs-only-L                           output -L flags
      --cflags                                output all pre-processor and compiler flags
      --cflags-only-I                         output -I flags
      --cflags-only-other                     output cflags not covered by the cflags-only-I option
      --variable=NAME                         get the value of variable named NAME
      --define-variable=NAME=VALUE            set variable NAME to VALUE
      --exists                                return 0 if the module(s) exist
      --print-variables                       output list of variables defined by the module
      --uninstalled                           return 0 if the uninstalled version of one or more module(s) or their dependencies will be used
      --atleast-version=VERSION               return 0 if the module is at least version VERSION
      --exact-version=VERSION                 return 0 if the module is at exactly version VERSION
      --max-version=VERSION                   return 0 if the module is at no newer than version VERSION
      --list-all                              list all known packages
      --debug                                 show verbose debug information
      --print-errors                          show verbose information about missing or conflicting packages (default unless --exists or --atleast/exact/max-version given on the command line)
      --silence-errors                        be silent about errors (default when --exists or --atleast/exact/max-version given on the command line)
      --errors-to-stdout                      print errors from --print-errors to stdout not stderr
      --print-provides                        print which packages the package provides
      --print-requires                        print which packages the package requires
      --print-requires-private                print which packages the package requires for static linking
      --validate                              validate a package's .pc file
      --define-prefix                         try to override the value of prefix for each .pc file found with a guesstimated value based on the location of the .pc file
      --dont-define-prefix                    don't try to override the value of prefix for each .pc file found with a guesstimated value based on the location of the .pc file
      --prefix-variable=PREFIX                set the name of the variable that pkg-config automatically sets
    
    pkg-config could not find fuse:
    you might need to adjust PKG_CONFIG_PATH or your
    FUSE installation is very old (older than 2.1-pre1)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-SqGZP4/fuse-python/setup.py", line 60, in <module>
        iflags = [x[2:] for x in cflags.split() if x[0:2] == '-I']
    NameError: name 'cflags' is not defined
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Although the error states that my FUSE version is too old, the real problem seems to be a syntax error here:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-SqGZP4/fuse-python/setup.py", line 60, in <module>
        iflags = [x[2:] for x in cflags.split() if x[0:2] == '-I']
    NameError: name 'cflags' is not defined

Additionally, python-fuse works correctly on Python 3:

Python 3.8.5 (default, Jan 27 2021, 15:41:15) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fuse
>>> 

It works fine, you just need to install the appropriate headers for the fuse library. In a clean Buster chroot:

# apt install libfuse-dev
[...]
# pip install fuse-python
Collecting fuse-python
  Using cached https://files.pythonhosted.org/packages/bf/fe/a2140e86eb79b3f0d023a9046ec45a8be64bd1cf9794cc036a554b4e2ad1/fuse-python-1.0.1.tar.gz
Building wheels for collected packages: fuse-python
  Running setup.py bdist_wheel for fuse-python ... done
  Stored in directory: /root/.cache/pip/wheels/ac/6b
/4c/088caf583d596561f81d1afd837b597e0b60aad1cc0053bc88
Successfully built fuse-python
Installing collected packages: fuse-python
Successfully installed fuse-python-1.0.1
# pip show fuse-python | grep Location
Location: /usr/local/lib/python2.7/dist-packages
# python
[...]
>>> import fuse
>>> fuse.__file__
'/usr/local/lib/python2.7/dist-packages/fuse.pyc'