ethereum / hexbytes

Python `bytes` subclass that decodes hex, with a readable console output
MIT License
27 stars 19 forks source link

RuntimeError: Format missing, but need one #5

Closed gregrebholz closed 6 years ago

gregrebholz commented 6 years ago

Similar to issue #3 I am getting this stack trace when installing via pip (including when hexbytes is a dependency of other packages), but I am using python3/pip3 --

Collecting hexbytes<1.0.0,>=0.1.0 (from -r /requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/81/15/fcd3a5ad583673ce52f0aac8e1246b91e7c88acbeae47863c30bfb264436/hexbytes-0.1.0.tar.gz
    Complete output from command python setup.py egg_info:
    /tmp/easy_install-_01amdvx/pypandoc-1.4/setup.py:16: DeprecationWarning: Due to possible ambiguity, 'convert()' is deprecated. Use 'convert_file()'  or 'convert_text()'.
      long_description = pypandoc.convert('README.md', 'rst')
    zip_safe flag not set; analyzing archive contents...
    pypandoc.__pycache__.__init__.cpython-37: module references __file__

    Installed /tmp/pip-install-qistyd3l/hexbytes/.eggs/pypandoc-1.4-py3.7.egg
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-qistyd3l/hexbytes/setup.py", line 67, in <module>
        'Programming Language :: Python :: Implementation :: PyPy',
      File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 131, in setup
        return distutils.core.setup(**attrs)
      File "/usr/local/lib/python3.7/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 370, in __init__
        k: v for k, v in attrs.items()
      File "/usr/local/lib/python3.7/distutils/dist.py", line 292, in __init__
        self.finalize_options()
      File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 529, in finalize_options
        ep.load()(self, ep.name, value)
      File "/tmp/pip-install-qistyd3l/hexbytes/.eggs/setuptools_markdown-0.2-py3.7.egg/setuptools_markdown.py", line 22, in long_description_markdown_filename
        output = pypandoc.convert(markdown_filename, 'rst')
      File "/tmp/pip-install-qistyd3l/hexbytes/.eggs/pypandoc-1.4-py3.7.egg/pypandoc/__init__.py", line 66, in convert
        raise RuntimeError("Format missing, but need one (identified source as text as no "
    RuntimeError: Format missing, but need one (identified source as text as no file with that name was found).

This was in a Docker container built on library:python:latest which is ubuntu at the lowest layer, but also occurs on library:python:3.6-alpine for Alpine Linux, and even another user's Alpine based docker image "frolvlad/alpine-python3". In the error above I'm running pip 18.0 from /usr/local/lib/python3.7/site-packages/pip (python 3.7) but I've also see it from pip 10.0.1 from python3.6. The Dockerfile is:

FROM python as base
FROM base as builder

RUN mkdir /install
WORKDIR /install

COPY requirements.txt /requirements.txt

RUN pip install --upgrade pip && pip --version && pip install --install-option="--prefix=/install" -r /requirements.txt

FROM base

COPY --from=builder /install /usr
COPY src /app

WORKDIR /app
ENTRYPOINT ["python", "script.py"]

And the build then is simply: sudo docker build --no-cache -t script . which failed on the pip run.

I've tried installing pandoc with apt-get update -y && apt install -y pandoc in case there was a version dependency there.

I ran into this while trying to install "web3" with my initial requirements.txt as the one line: web3>=4.4.1,<5 ... but I'm now troubleshooting with just hexbytes<1.0.0,>=0.1.0. Thanks for any help you can provide.

gregrebholz commented 6 years ago

I've traced this to the use of --install-option="--prefix=/install" ... perhaps hexbytes is not relocatable?

carver commented 6 years ago

I've traced this to the use of --install-option="--prefix=/install" ... perhaps hexbytes is not relocatable?

It's possible. I've never used that option, so haven't done anything special to support it. Are you interested in contributing?

gregrebholz commented 6 years ago

Looking to add support, I've learned that passing "--prefix=/install" to setup.py is no longer preferred in Python; passing "--target=/install" to pip itself is the modern approach. There are many caveats regarding binaries, libraries, scripts and data and how they react differently to the many related options, but "pip install --target=/install hexbytes" works just fine for me, so I'll close this. Further reading for posterity: