sylhare / simple-lda

:bookmark: simple lda - latent dirichlet allocation
Apache License 2.0
2 stars 2 forks source link

Installation error when pypandoc not installed #1

Closed sylhare closed 5 years ago

sylhare commented 6 years ago

When trying to install the package from pip without pypandoc I am getting this error:

Collecting simple-lda (from -r requirements.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/e1/90/a2ae69de059deb5ba431d5f50841a4430ce8d5aabd69b059acd97e3b0a9b/simple-lda-0.1.3.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-install-y_cwe7te/simple-lda/setup.py", line 2, in <module>
        from pypandoc import convert
    ImportError: No module named 'pypandoc'

So I will need to correct either the convert function or simply remove it, or add pypandoc as a dependency to the package.

sylhare commented 5 years ago

Fixed it with a try catch, I guess that's good enough

def get_long_description():
    try:
        import pypandoc

        pypandoc.convert_file('README.md', 'rst', outputfile="readme.rst")
        with open("readme.rst", 'r') as f:
            readme = f.read()
    except ImportError:
        readme = 'Python library for Latent Dirichlet allocation (lda)'
        print("Install pypandoc and pandoc to generate long description")

    return readme