0

I have tried to install Pysftp lib (https://pypi.org/project/pysftp/) on my system but whenever I tried to install it in Python2.x or Python3.x it gives me the error.

In Python2.X error

Collecting pynacl>=1.0.1 (from paramiko>=1.17->pysftp==0.2.9->-r requirements.txt (line 1))
  Using cached https://files.pythonhosted.org/packages/a7/22/27582568be639dfe22ddb3902225f91f2f17ceff88ce80e4db396c8986da/PyNaCl-1.5.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-_k6VkE/pynacl/setup.py", line 29, in <module>
        from setuptools.command.build_clib import build_clib as _build_clib
    ImportError: No module named build_clib

In Python3.X error

Collecting pysftp
  Using cached https://files.pythonhosted.org/packages/36/60/45f30390a38b1f92e0a8cf4de178cd7c2bc3f874c85430e40ccf99df8fe7/pysftp-0.2.9.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/ubuntu/.local/lib/python3.5/site-packages/setuptools/__init__.py", line 8, in <module>
        import _distutils_hack.override  # noqa: F401
      File "/home/ubuntu/.local/lib/python3.5/site-packages/_distutils_hack/override.py", line 1, in <module>
        __import__('_distutils_hack').do_override()
      File "/home/ubuntu/.local/lib/python3.5/site-packages/_distutils_hack/__init__.py", line 72, in do_override
        ensure_local_distutils()
      File "/home/ubuntu/.local/lib/python3.5/site-packages/_distutils_hack/__init__.py", line 58, in ensure_local_distutils
        core = importlib.import_module('distutils.core')
      File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "/home/ubuntu/.local/lib/python3.5/site-packages/setuptools/_distutils/core.py", line 17, in <module>
        from distutils.dist import Distribution
      File "/home/ubuntu/.local/lib/python3.5/site-packages/setuptools/_distutils/dist.py", line 19, in <module>
        from distutils.util import check_environ, strtobool, rfc822_escape
      File "/home/ubuntu/.local/lib/python3.5/site-packages/setuptools/_distutils/util.py", line 171
        raise DistutilsPlatformError(f"nothing known about platform '{os.name}'")
                                                                               ^
    SyntaxError: invalid syntax

cmd I used is as per Python2.X (pip install pysftp) and Python3.X (pip3 install pysftp) and my python3 version is 3.5 so I have no idea how to fix this

SuperStormer
  • 4,997
  • 5
  • 25
  • 35
Harshit Trivedi
  • 764
  • 9
  • 33

1 Answers1

0

You somehow have a version of setuptools for Python 3.6+, causing the interpreter to choke on a f-string (which were added in 3.6). Reinstall your distro's setuptools - I believe the command is sudo apt install python-setuptools - then rerun pip3 install pysftp.

SuperStormer
  • 4,997
  • 5
  • 25
  • 35