Problem in redash deployment

Issue Summary

We are using redash since an year at our organization. Recently we have been trying to make new releases around ad_hoc workers and other few custom deployments. Currently we are using docker containers to host redash but the same is failing to build for us.
Currently our requirements_all_ds file is as follows :

google-api-python-client==1.5.1
gspread==0.6.2
impyla==0.10.0
influxdb==2.7.1
MySQL-python==1.2.5
oauth2client==3.0.0
pyhive==0.5.1
pymongo[tls,srv]==3.6.1
vertica-python==0.8.0
td-client==0.8.0
pymssql==2.1.3
dql==0.5.24
dynamo3==0.4.7
boto3==1.9.85
botocore==1.12.85
sasl>=0.1.3
thrift>=0.8.0
thrift_sasl>=0.1.0
cassandra-driver==3.11.0
memsql==2.16.0
atsd_client==2.0.12
simple_salesforce==0.72.2
PyAthena>=1.0.0
pymapd==0.7.1
qds-sdk>=1.9.6
ibm-db>=2.0.9
pydruid==0.4
requests_aws_sign==0.1.4
snowflake_connector_python==2.0.3
# certifi is needed to support MongoDB and SSL:
certifi
numpy==1.16
pandas==0.24.2

For some reason while using docker-compose build worker our deployments is failing for same.
Current pip version : pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
Current python version : Python 2.7.12

If you can help with the issue it will be really helpful!
Thanks in advance!

A summary of the issue and the browser/OS environment in which it occurs.

Technical details:

  • Redash Version: 8.0.2
  • Browser/OS: Ubuntu 16
  • How did you install Redash: Github Redash Repo(Docker builds)

Sharing the error stack as well here for better understanding :
Collecting pymapd==0.7.1 (from -r requirements_all_ds.txt (line 24)) Downloading https://files.pythonhosted.org/packages/26/84/0d7fa3e4cfeaa12c128df1764863345f60859d04eb3086a78bbcc8e18c3b/pymapd-0.7.1.tar.gz (93kB) ERROR: Command errored out with exit status 1: command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-DMbPOe/pymapd/setup.py'"'"'; __file__='"'"'/tmp/pip-install-DMbPOe/pymapd/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 pip-egg-info

After a few duckduckgo searches it seems this error usually means there’s an incompatibility between the specific version of Python and the package that pip tries to install. Unless you’re using the mapd data source you can probably just remove this line from the requirements file and move along.

If you do require mapd then I’d suggest trying to manually install the mapd package, adjusting different version numbers to see if you can find one that works.

Post removing the pymapd dependency similar issues are getting raised for pydruid==0.4 and oauth2client==3.0.0. Post this I changed the version of same to a lower version post this our docker compose finally worked. But the server for worker didn’t build at all.
Also
Manually installing pymapd didn’t help we were still getting python dependency issues. I would strongly recommend and request to please look into this issue due to which alot of our deployments are pending.

1 Like

I can’t reproduce this. docker-compose build server works on my machine.

I wonder if one of these modifications broke the build?

I don’t think so since 1-2 changes were made around HTML and one around increasing the number of workers for which I had raised another ticket initially.
On top of it I am sharing the general steps that we follow for deployment :
1.docker-compose down 2. docker stop $(docker ps -q) 3. docker kill $(docker ps -q) 4. docker rm $(docker ps -a -q) 5. docker rmi $(docker images -q) 6. sudo npm i 7. sudo npm run build 8. docker-compose build worker 9. docker-compose build server 10. sudo npm run build 11. docker-compose up -d

1 observation that I have made is if we don’t remove the docker images (point 5) . The caches of previous containers sustain due to which the step which depends on requirements.txt installation step is getting skipped with which we are able to deploy the server but still this is not the permanent solution but just a workaround. Need the permanent fix for the same.

I have this exact same issues with no modifications to the docker image. Build fails at pymapd. After commenting out in requirements_all_ds.txt, build fails at pydruid with:

ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pMQZjN/pydruid/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pMQZjN/pydruid/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 pip-egg-info
         cwd: /tmp/pip-install-pMQZjN/pydruid/
    Complete output (106 lines):
    /tmp/easy_install-RAmU7Y/pytest-runner-5.3.0/temp/easy_install-6ng0KL/setuptools_scm-6.0.1/src
    <pkg_resources.WorkingSet object at 0x7fdb2e5317d0>
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-pMQZjN/pydruid/setup.py", line 46, in <module>
        include_package_data=True,
      File "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 719, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 782, in resolve
        replace_conflicting=replace_conflicting
      File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
        return installer(requirement)
      File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 786, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/local/lib/python2.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/python2.7/site-packages/setuptools/command/easy_install.py", line 705, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/usr/local/lib/python2.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/python2.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/python2.7/site-packages/setuptools/command/easy_install.py", line 1144, in run_setup
        run_setup(setup_script, args)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 253, in run_setup
        raise
      File "/usr/local/lib/python2.7/contextlib.py", line 35, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/local/lib/python2.7/contextlib.py", line 35, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 166, in save_modules
        saved_exc.resume()
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 141, in resume
        six.reraise(type, exc, self._tb)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 154, in save_modules
        yield saved
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-RAmU7Y/pytest-runner-5.3.0/setup.py", line 21, in <module>
    
      File "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 719, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 782, in resolve
        replace_conflicting=replace_conflicting
      File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
        return installer(requirement)
      File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 786, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/local/lib/python2.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/python2.7/site-packages/setuptools/command/easy_install.py", line 705, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/usr/local/lib/python2.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/python2.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/python2.7/site-packages/setuptools/command/easy_install.py", line 1144, in run_setup
        run_setup(setup_script, args)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 253, in run_setup
        raise
      File "/usr/local/lib/python2.7/contextlib.py", line 35, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/local/lib/python2.7/contextlib.py", line 35, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 166, in save_modules
        saved_exc.resume()
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 141, in resume
        six.reraise(type, exc, self._tb)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 154, in save_modules
        yield saved
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-RAmU7Y/pytest-runner-5.3.0/temp/easy_install-6ng0KL/setuptools_scm-6.0.1/setup.py", line 52, in <module>
    
      File "/tmp/easy_install-RAmU7Y/pytest-runner-5.3.0/temp/easy_install-6ng0KL/setuptools_scm-6.0.1/setup.py", line 29, in scm_config
        license='Apache License, Version 2.0',
      File "/tmp/easy_install-RAmU7Y/pytest-runner-5.3.0/temp/easy_install-6ng0KL/setuptools_scm-6.0.1/src/setuptools_scm/__init__.py", line 8, in <module>
      File "/tmp/easy_install-RAmU7Y/pytest-runner-5.3.0/temp/easy_install-6ng0KL/setuptools_scm-6.0.1/src/setuptools_scm/config.py", line 6, in <module>
      File "/tmp/easy_install-RAmU7Y/pytest-runner-5.3.0/temp/easy_install-6ng0KL/setuptools_scm-6.0.1/src/setuptools_scm/utils.py", line 41
        print(*k)
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.2.2, however version 20.3.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

OS: Ubuntu 18.04

Something is up with the Docker image on Ubuntu. I followed the instructions as per the Docker Based Developer Installation Guide. Once I run docker-compose up -d, I’m greeted with all of the pip errors.

This may be true on your machine but I can’t reproduce it on a fresh clone of getredash/redash. I’m using Docker 3.1.0 (51484) on MacOS Catalina.

These are the comman

cd ~
git@github.com:getredash/redash.git redash-test --single-branch
cd redash-test
docker-compose build
docker-compose up -d
docker-compose run --rm server create_db
npm install && npm run build

No build issues. Application starts on the first try on localhost:5000.


The problem is not with Redash or with Docker but rather something in your environment.

[EDIT]
I found this forum post that seems like you may not have installed the Python build tools on your system.

This SO response seems to point in the same direction.

Thanks for the quick response.

I’m installing v8.0.2 via git clone --branch v8.0.2 https://github.com/getredash/redash.git

I installed the dev libraries and compilers per your links but still the same issue as soon as docker-compose build is run: pymapd fails.

Docker-compose error:

ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pXvWjM/pymapd/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pXvWjM/pymapd/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 pip-egg-info
         cwd: /tmp/pip-install-pXvWjM/pymapd/
    Complete output (60 lines):
    /tmp/easy_install-XsY1d2/setuptools_scm-6.0.1/src
    <pkg_resources.WorkingSet object at 0x7f08b9a3af50>
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-pXvWjM/pymapd/setup.py", line 65, in <module>
        extras_require=extra_requires
      File "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 719, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 782, in resolve
        replace_conflicting=replace_conflicting
      File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
        return installer(requirement)
      File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 786, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/local/lib/python2.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/python2.7/site-packages/setuptools/command/easy_install.py", line 705, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/usr/local/lib/python2.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/python2.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/python2.7/site-packages/setuptools/command/easy_install.py", line 1144, in run_setup
        run_setup(setup_script, args)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 253, in run_setup
        raise
      File "/usr/local/lib/python2.7/contextlib.py", line 35, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/local/lib/python2.7/contextlib.py", line 35, in __exit__
        self.gen.throw(type, value, traceback)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 166, in save_modules
        saved_exc.resume()
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 141, in resume
        six.reraise(type, exc, self._tb)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 154, in save_modules
        yield saved
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
        yield
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/usr/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-XsY1d2/setuptools_scm-6.0.1/setup.py", line 52, in <module>
        'Topic :: Scientific/Engineering',
      File "/tmp/easy_install-XsY1d2/setuptools_scm-6.0.1/setup.py", line 29, in scm_config
        extra_requires = {
      File "/tmp/easy_install-XsY1d2/setuptools_scm-6.0.1/src/setuptools_scm/__init__.py", line 8, in <module>
      File "/tmp/easy_install-XsY1d2/setuptools_scm-6.0.1/src/setuptools_scm/config.py", line 6, in <module>
      File "/tmp/easy_install-XsY1d2/setuptools_scm-6.0.1/src/setuptools_scm/utils.py", line 41
        print(*k)
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.2.2, however version 20.3.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ERROR: Service 'server' failed to build: The command '/bin/sh -c if [ "x$skip_ds_deps" = "x" ] ; then pip install -r requirements_all_ds.txt ; else echo "Skipping pip install -r requirements_all_ds.txt" ; fi' returned a non-zero code: 1

This is indeed the exact same problem we are facing. We are solving the same by keeping the caches of initially installed images. Need a permanent solution to same.

I’m encountering this same issue as well.

I downloaded .zip source from https://github.com/getredash/redash/releases/tag/v8.0.0

Then ran docker-compose up -d.

Then the same above error occurred:

File "/tmp/easy_install-B94cIl/setuptools_scm-6.0.1/src/setuptools_scm/utils.py", line 41
    print(*k)
SyntaxError: invalid syntax

Here this print(*k) is a valid Python3, but not valid Python2. Maybe that has something to do with it.

This same issue is also discussed in the setuptools_scm github: https://github.com/pypa/setuptools_scm/issues/541

My environment details:

OS: Ubuntu 18.04
Docker: 20.10.6, build 370c289
docker-compose: 1.29.1, build c34c88b2

Also, this doesn’t happen if I pull the latest master repo from https://github.com/getredash/redash.