Build.sh throws Syntax error

Hi,

I’m getting this syntax error while trying to run build.sh on Ubuntu 16.04 VM:

Traceback (most recent call last):
  File "/usr/local/bin/aicrowd-repo2docker", line 7, in <module>
    from repo2docker.__main__ import main
  File "/usr/local/lib/python3.5/dist-packages/repo2docker/__main__.py", line 1, in <module>
    from .app import Repo2Docker
  File "/usr/local/lib/python3.5/dist-packages/repo2docker/app.py", line 592
    self.log.info(f'Successfully pushed {self.output_image_spec}', extra=dict(phase='pushing'))
                                                                ^
SyntaxError: invalid syntax

This is how I set up the VM.

The f-string syntax in f'Successfully pushed {self.output_image_spec} was introduced in Python 3.6.

1 Like

Thanks, I’ll switch to Ubuntu 18.04 as 16.04 keeps installing 3.5.2

Or you could use anaconda and manage a separate environment (with python36) just for the competition.

I still didn’t get build.sh to work. Any idea why Repo2Docker cannot resolve sources?

Step 29/33 : RUN apt-get update && apt-get install --yes --no-install-recommends curl git xvfb ffmpeg && apt-get purge && apt-get clean && rm -rf /var/lib/apt/lists/*
 ---> Running in f3979d51b4f6
Err:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu xenial InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:3 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  InRelease
  Could not resolve host: developer.download.nvidia.com
Err:4 https://deb.nodesource.com/node_10.x bionic InRelease
  Could not resolve host: deb.nodesource.com
Err:5 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:6 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64  InRelease
  Could not resolve host: developer.download.nvidia.com
Err:7 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/InRelease  Could not resolve host: developer.download.nvidia.com
W: Failed to fetch https://deb.nodesource.com/node_10.x/dists/bionic/InRelease  Could not resolve host: deb.nodesource.com
W: Failed to fetch https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/InRelease  Could not resolve host: developer.download.nvidia.com
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package curl
E: Unable to locate package git
E: Unable to locate package xvfb
E: Unable to locate package ffmpeg
Removing intermediate container f3979d51b4f6
The command '/bin/sh -c apt-get update && apt-get install --yes --no-install-recommends curl git xvfb ffmpeg && apt-get purge && apt-get clean && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100

@Leckofunny: Weird. But this seems to be similar to this issue : https://askubuntu.com/questions/91543/apt-get-update-fails-to-fetch-files-temporary-failure-resolving-error

The host system does not have any issues with resolving the urls. The docker container, which is being build struggles with resolving these. As I don’t have access to the images being build, I cannot think of anything on how to approach this

@Leckofunny: Thats weird. Because the image build happens on the host machine itself using whatever default docker setup is configured.
Would be curious to know if anyone else is facing the same issue ?

I’m able to ping these addresses and to use wget, so I have no clue why Repo2Docker is not doing its job.

@Leckofunny are you behind a corporate firewall or a university/office proxy by any chance? Is there any special network configuration files/variables you’ve set on your box (outside the container/VM)?

This was tested on my home computer and at one at my university.

@Leckofunny This is silly suggestion and maybe you’ve already tried it, have you tried manually setting your DNS (nameserver) to something like 9.9.9.9 or 8.8.8.8? I’ve also seen this occasionally happen when your VM sometimes asks for an ipv6 address and your DNS server is unable to resolve it.

Sorry I don’t have anything concrete for you, but no NS resolution is just an odd symptom.