Skip to content

[BUG] urllib3 not found when use it with pyinstaller and docker #1877

Description

@yingshaoxo

Steps to reproduce

  1. clone the repository: https://github.com/yingshaoxo/TGAsk.git

  2. run pyinstaller: pyinstaller main.py -w

  3. build a docker image: sudo docker build -t yingshaoxo/tgask .

  4. add your token to docker-compose.yml

  5. run docker-compose: sudo docker-compose up

Expected behaviour

The program should run well as it would be outside of the docker container.

Actual behaviour

The error message I got:

yingshaoxo@pop-os:~/Software_Engineering$ sudo docker-compose up 
Recreating software_engineering_TGAsk_1 ... done
Attaching to software_engineering_TGAsk_1
TGAsk_1  | [6] Failed to execute script main
TGAsk_1  | Traceback (most recent call last):
TGAsk_1  |   File "telegram/vendor/ptb_urllib3/urllib3/util/ssl_.py", line 308, in ssl_wrap_socket
TGAsk_1  | FileNotFoundError: [Errno 2] No such file or directory
TGAsk_1  | 
TGAsk_1  | During handling of the above exception, another exception occurred:
TGAsk_1  | 
TGAsk_1  | Traceback (most recent call last):
TGAsk_1  |   File "telegram/utils/request.py", line 225, in _request_wrapper
TGAsk_1  |   File "telegram/vendor/ptb_urllib3/urllib3/request.py", line 66, in request
TGAsk_1  |   File "telegram/vendor/ptb_urllib3/urllib3/request.py", line 87, in request_encode_url
TGAsk_1  |   File "telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
TGAsk_1  |   File "telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
TGAsk_1  |   File "telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 360, in _make_request
TGAsk_1  |   File "telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 857, in _validate_conn
TGAsk_1  |   File "telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 289, in _validate_conn
TGAsk_1  |   File "telegram/vendor/ptb_urllib3/urllib3/connection.py", line 326, in connect
TGAsk_1  |   File "telegram/vendor/ptb_urllib3/urllib3/util/ssl_.py", line 310, in ssl_wrap_socket
TGAsk_1  | telegram.vendor.ptb_urllib3.urllib3.exceptions.SSLError: [Errno 2] No such file or directory
TGAsk_1  | 
TGAsk_1  | During handling of the above exception, another exception occurred:
TGAsk_1  | 
TGAsk_1  | Traceback (most recent call last):
TGAsk_1  |   File "main.py", line 84, in <module>
TGAsk_1  |   File "telegram/ext/updater.py", line 260, in start_polling
TGAsk_1  |   File "telegram/ext/jobqueue.py", line 311, in start
TGAsk_1  |   File "telegram/bot.py", line 54, in decorator
TGAsk_1  |   File "<decorator-gen-1>", line 2, in get_me
TGAsk_1  |   File "telegram/bot.py", line 67, in decorator
TGAsk_1  |   File "telegram/bot.py", line 279, in get_me
TGAsk_1  |   File "telegram/utils/request.py", line 277, in get
TGAsk_1  |   File "telegram/utils/request.py", line 231, in _request_wrapper
TGAsk_1  | telegram.error.NetworkError: urllib3 HTTPError [Errno 2] No such file or directory

Configuration

Operating System: Linux pop-os 5.0.0-21-generic #22+system76-Ubuntu SMP Tue Jul 16 19:57:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

It's actually Ubuntu 19.10

Version of Python, python-telegram-bot & dependencies:

python-telegram-bot 12.5.1
certifi 2018.08.24
future 0.18.2
Python 3.7.3 (default, Oct  7 2019, 12:56:13)  [GCC 8.3.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions