Repository: iterative/dvc

Issue:
unknown encoding during "dvc push"
**Information about your setup**
DVC version: 0.66.0
Platform: Ubuntu 18.04
Method of installation: DEB

**Description:**
I access my dvc remote via ssh.  **Sometimes** `dvc push` command with the following error:

```
ERROR: unexpected error - unknown encoding: idna
```


Discussion:
@nik123 Could you post full log for `dvc push -v`? We've seen this happen in a binary mac package:
```
ERROR: unexpected error - unknown encoding: idna

------------------------------------------------------------

Traceback (most recent call last):

  File "dvc/main.py", line 43, in main

  File "dvc/command/data_sync.py", line 50, in run

  File "dvc/repo/__init__.py", line 33, in wrapper

  File "dvc/repo/push.py", line 27, in push

  File "dvc/data_cloud.py", line 63, in push

  File "dvc/remote/local.py", line 380, in push

  File "dvc/remote/local.py", line 353, in _process

  File "dvc/remote/local.py", line 274, in status

  File "dvc/remote/base.py", line 732, in cache_exists

  File "concurrent/futures/_base.py", line 586, in result_iterator

  File "concurrent/futures/_base.py", line 425, in result

  File "concurrent/futures/_base.py", line 384, in __get_result

  File "concurrent/futures/thread.py", line 56, in run

  File "dvc/remote/base.py", line 725, in exists_with_progress

  File "dvc/remote/s3.py", line 203, in exists

  File "dvc/remote/s3.py", line 203, in <genexpr>

  File "dvc/remote/s3.py", line 190, in _list_paths

  File "funcy/objects.py", line 28, in __get__

  File "dvc/remote/s3.py", line 66, in s3

  File "boto3/session.py", line 263, in client

  File "botocore/session.py", line 827, in create_client

  File "botocore/session.py", line 426, in get_credentials

  File "botocore/session.py", line 903, in get_component

  File "botocore/session.py", line 145, in <lambda>

  File "botocore/credentials.py", line 75, in create_credential_resolver

  File "botocore/utils.py", line 274, in __init__

  File "botocore/utils.py", line 1328, in get_environ_proxies

  File "botocore/utils.py", line 1347, in should_bypass_proxies

  File "urllib/request.py", line 2612, in proxy_bypass

  File "urllib/request.py", line 2589, in proxy_bypass_macosx_sysconf

  File "urllib/request.py", line 2562, in _proxy_bypass_macosx_sysconf

LookupError: unknown encoding: idna
```

seems to be a lib issue of sorts, not quite sure what specifically went wrong. Could you try installing using `pip` and see if that helps?
Might be caused by pyinstaller not including those modules, looking into it...
Seems like it is related to https://github.com/pyinstaller/pyinstaller/issues/1113 . Getting tired of pyinstaller-related bugs. Will take a look at making our deb and rpm packages use python instead of monolithic apps built by pyinstaller.
@nik123 as a workaround, try uninstalling dvc and installing it from pip or conda.
@efiop Here is my full log for `dvc push -v`: [link](https://gist.githubusercontent.com/nik123/30381c0aef7e8d5918c9112cd3014fe5/raw/8316cc98a032b34313f1b9954275380ab32bac66/gistfile1.txt)
@nik123 Thanks! Have you tried installing from pip or conda? Did it solve the issue for you?

As to
> Getting tired of pyinstaller-related bugs. Will take a look at making our deb and rpm packages use python instead of monolithic apps built by pyinstaller.

Not that simple :slightly_smiling_face: Will have to package all our dependencies too for that to happen :slightly_frowning_face: Need to take a closer look.

Resolving patch:
diff --git a/dvc/main.py b/dvc/main.py
--- a/dvc/main.py
+++ b/dvc/main.py
@@ -15,6 +15,12 @@
 from dvc.utils.compat import is_py2
 
 
+# Workaround for CPython bug. See [1] and [2] for more info.
+# [1] https://github.com/aws/aws-cli/blob/1.16.277/awscli/clidriver.py#L55
+# [2] https://bugs.python.org/issue29288
+"".encode("idna")
+
+
 logger = logging.getLogger("dvc")
 
 


Test patch: