Python-slack-sdk: [2.0.x] Does not install on alpine anymore - missing dependencies

Created on 4 Jun 2019  路  13Comments  路  Source: slackapi/python-slack-sdk

Description

Describe your issue here.

What type of issue is this? (place an x in one of the [ ])

  • [x] bug
  • [ ] enhancement (feature request)
  • [ ] question
  • [ ] documentation related
  • [ ] testing related
  • [ ] discussion

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

slackclient version: 2.0.1 and 2.0.0

python version: 3.7.3-alpine / 3.7.2-alpine / 3.6.8-alpine

OS version(s): linux alpine docker image

Steps to reproduce:

  1. Create the following files:

requirements.txt:
slackclient==2.0.0

echobot.py:
import slack

Dockerfile
FROM python:3.7.3-alpine
WORKDIR /app
ADD . /app
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
CMD ["python", "echobot.py"]

  1. Run the command:
    docker build -t staticdev/k8s-python-slackbot:0.1.0 -f Dockerfile .

Expected result:

A successful image creation as in github.com/staticdev/k8s-python-slackbot (this works with versions 1.x)

Actual result:

I got a pip error installing slackclient:

Step 5/6 : RUN pip install -r requirements.txt
 ---> Running in d5d4f90d8f5a
Collecting slackclient==2.0.1 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/90/85/e2a43f04f79dec82ee86eb4cd19108d8a49721d732942ac8e14450357167/slackclient-2.0.1-py2.py3-none-any.whl
Collecting aiodns>1.0 (from slackclient==2.0.1->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/da/01/8f2d49b441573fd2478833bdba91cf0b853b4c750a1fbb9e98de1b94bb22/aiodns-2.0.0-py2.py3-none-any.whl
Collecting aiohttp>3.5.2 (from slackclient==2.0.1->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/0f/58/c8b83f999da3b13e66249ea32f325be923791c0c10aee6cf16002a3effc1/aiohttp-3.5.4.tar.gz (1.1MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Collecting pycares>=3.0.0 (from aiodns>1.0->slackclient==2.0.1->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/85/de/cd46a73e43e206a6ad1e9cf9cc893c3ed1b21caf57f1e0a8d9a119d290eb/pycares-3.0.0.tar.gz (211kB)
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: 
        No working compiler found, or bogus compiler options passed to
        the compiler from Python's standard "distutils" module.  See
        the error messages above.  Likely, the problem is not related
        to CFFI but generic to the setup.py of any Python package that
        tries to compile C code.  (Hints: on OS/X 10.8, for errors about
        -mno-fused-madd see http://stackoverflow.com/questions/22313407/
        Otherwise, see https://wiki.python.org/moin/CompLangPython or
        the IRC channel #python on irc.freenode.net.)

        Trying to continue anyway.  If you are trying to install CFFI from
        a build done in a different context, you can ignore this warning.

    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/distutils/unixccompiler.py", line 118, in _compile
        extra_postargs)
      File "/usr/local/lib/python3.7/distutils/ccompiler.py", line 909, in spawn
        spawn(cmd, dry_run=self.dry_run)
      File "/usr/local/lib/python3.7/distutils/spawn.py", line 36, in spawn
        _spawn_posix(cmd, search_path, dry_run=dry_run)
      File "/usr/local/lib/python3.7/distutils/spawn.py", line 159, in _spawn_posix
        % (cmd, exit_status))
    distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 172, in run
        cmd = self.call_command('install_lib', warn_dir=0)
      File "/usr/local/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command
        self.run_command(cmdname)
      File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.7/site-packages/setuptools/command/install_lib.py", line 11, in run
        self.build()
      File "/usr/local/lib/python3.7/distutils/command/install_lib.py", line 107, in build
        self.run_command('build_ext')
      File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 78, in run
        _build_ext.run(self)
      File "/usr/local/lib/python3.7/distutils/command/build_ext.py", line 340, in run
        self.build_extensions()
      File "/usr/local/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
        self._build_extensions_serial()
      File "/usr/local/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
        self.build_extension(ext)
      File "/usr/local/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 199, in build_extension
        _build_ext.build_extension(self, ext)
      File "/usr/local/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
        depends=ext.depends)
      File "/usr/local/lib/python3.7/distutils/ccompiler.py", line 574, in compile
        self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
      File "/usr/local/lib/python3.7/distutils/unixccompiler.py", line 120, in _compile
        raise CompileError(msg)
    distutils.errors.CompileError: command 'gcc' failed with exit status 1

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 154, in save_modules
        yield saved
      File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-crxph_g3/cffi-1.12.3/setup.py", line 248, in <module>
      File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/local/lib/python3.7/distutils/core.py", line 163, in setup
        raise SystemExit("error: " + str(msg))
    SystemExit: error: command 'gcc' failed with exit status 1

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 1144, in run_setup
        run_setup(setup_script, args)
      File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 253, in run_setup
        raise
      File "/usr/local/lib/python3.7/contextlib.py", line 130, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/local/lib/python3.7/contextlib.py", line 130, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 166, in save_modules
        saved_exc.resume()
      File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 141, in resume
        six.reraise(type, exc, self._tb)
      File "/usr/local/lib/python3.7/site-packages/setuptools/_vendor/six.py", line 685, in reraise
        raise value.with_traceback(tb)
      File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 154, in save_modules
        yield saved
      File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-crxph_g3/cffi-1.12.3/setup.py", line 248, in <module>
      File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/local/lib/python3.7/distutils/core.py", line 163, in setup
        raise SystemExit("error: " + str(msg))
    SystemExit: error: command 'gcc' failed with exit status 1

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-w9661i00/pycares/setup.py", line 45, in <module>
        zip_safe         = False
      File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 717, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 782, in resolve
        replace_conflicting=replace_conflicting
      File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
        return installer(requirement)
      File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 784, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/local/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 679, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/usr/local/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 705, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/usr/local/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 890, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/usr/local/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 1158, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/usr/local/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 1146, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-w9661i00/pycares/

Attachments:

No need. Log above.

2x bug

All 13 comments

I just received the same error with 3.7.3 trying to install slackclient==2.0.0 on Mac

it works for me when installing slackclient==2.0.0 in 3.7.3-alpine AFTER running:

# apk add --update build-base libffi-dev

@staticdev Thanks for reporting this issue. I'm not super familiar with this error. I've got a few other bugs to address, but will try and get to this soon. Can y'all try @shawnzhu's suggestion and let me know if it things improve?

@RodneyU215 the problem if this issue is that installing build-base and libffi-dev wasn't necessary to previous versions of slackclient. I also tried with other versions of alpine (3.7.2 and 3.6.8) and updated the description.

It is not anywhere in the migration guide or the rest of documentation. Adding build-base and libffi-dev to the image creates an overhead of 183MB to the image, which is very costly.

I think the first thing that we need to understand to solve the problem is: what changed in version 2.0.0 that we now need this two libs?

I noticed that, from version 1.3.1 version, the dependecies changed from:

      'websocket-client >=0.35, <0.55.0',
      'requests >=2.11, <3.0a0',
      'six >=1.10, <2.0a0',

To:

      aiohttp>3.5.2",
     "aiodns>1.0

aiodns need pycares which needs compilation. Is aiodns really needed? Maybe just taking out this dependency makes everything work. I didn't see any import or configuration to use aiodns.

@staticdev Some of the build dependencies can be removed after pip has done its work, so if you combine it all into one RUN command then the file size isn't blown out too significantly. I have a small project which uses a Dockerfile that starts as per below, and the image comes out at 143MB in total:

FROM python:3.7.3-alpine3.9

COPY requirements.txt /tmp/
RUN apk add --no-cache --virtual .pynacl_deps build-base python3-dev libffi-dev && \
    apk add --no-cache --virtual .lxml_deps libxslt-dev && \
    pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r /tmp/requirements.txt && \
    apk del .pynacl_deps

@JamesWaldock I understand there are ways to clean this install of build-base. But my main question remains. Is it necessary to have aiodns>1.0 to make it work?

@staticdev you've raised a great point! It's not required but was strongly recommended to help improve performance. aiodns should however be an optional dependency. I'll work on this for the next release.

@RodneyU215 I made a little change to make this optional in #440.

Thanks @staticdev! I'm going to keep this open until I merge an update to the ReadMe with instructions for those who'd like to opt-in. i.e. pip3 install slackclient[optional]>2

Hi! Thanks for fixing this issue, any chance we could get a tag including this change? (:

Hi @jakedaleweb, yes, sorry for the delay. I'm hoping to have this released by the end of the week along with a few other fixes and improvements.

This has been released in 2.1.0 (#469).

Might be worth naming the extras_require to something more meaningful / feature oriented than optional, perhaps something like asyncdns or fastdns

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seratch picture seratch  路  3Comments

divyatman picture divyatman  路  4Comments

vv-grinko picture vv-grinko  路  3Comments

tinoargentino picture tinoargentino  路  4Comments

juan-vg picture juan-vg  路  5Comments