Why.init("whylabs_anonymous") <-- Course Deprecated

whylabs unable to intialize and getting exception below:

--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 196, in _new_conn
    sock = connection.create_connection(
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 60, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

this is the course url:

is this the complete error you got??

--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 196, in _new_conn
    sock = connection.create_connection(
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py", line 60, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 490, in _make_request
    raise new_e
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 466, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 615, in connect
    self.sock = sock = self._new_conn()
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 203, in _new_conn
    raise NameResolutionError(self.host, self, e) from e
urllib3.exceptions.NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x7fab8d7f9de0>: Failed to resolve 'api.whylabsapp.com' ([Errno -2] Name or service not known)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/whylogs/api/whylabs/session/session_manager.py", line 276, in init
    SessionManager.init(type=_session_type)
  File "/usr/local/lib/python3.10/site-packages/whylogs/api/whylabs/session/session_manager.py", line 245, in init
    SessionManager.__instance = SessionManager(type=type)
  File "/usr/local/lib/python3.10/site-packages/whylogs/api/whylabs/session/session_manager.py", line 237, in __init__
    self.session = GuestSession(self._config, self._whylabs_client)
  File "/usr/local/lib/python3.10/site-packages/whylogs/api/whylabs/session/session_manager.py", line 71, in __init__
    self._session_id = self._get_or_create_session_id()
  File "/usr/local/lib/python3.10/site-packages/whylogs/api/whylabs/session/session_manager.py", line 103, in _get_or_create_session_id
    session_id = self._create_session_id()
  File "/usr/local/lib/python3.10/site-packages/whylogs/api/whylabs/session/session_manager.py", line 135, in _create_session_id
    response: CreateSessionResponse = self._whylabs_session_api.create_session(CreateSessionRequest(user_guid))
  File "/usr/local/lib/python3.10/site-packages/whylabs_client/api/sessions_api.py", line 799, in create_session
    return self.create_session_endpoint.call_with_http_info(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/whylabs_client/api_client.py", line 849, in call_with_http_info
    return self.api_client.call_api(
  File "/usr/local/lib/python3.10/site-packages/whylabs_client/api_client.py", line 410, in call_api
    return self.__call_api(resource_path, method,
  File "/usr/local/lib/python3.10/site-packages/whylabs_client/api_client.py", line 197, in __call_api
    response_data = self.request(
  File "/usr/local/lib/python3.10/site-packages/whylabs_client/api_client.py", line 456, in request
    return self.rest_client.POST(url,
  File "/usr/local/lib/python3.10/site-packages/whylabs_client/rest.py", line 269, in POST
    return self.request("POST", url,
  File "/usr/local/lib/python3.10/site-packages/whylabs_client/rest.py", line 155, in request
    r = self.pool_manager.request(
  File "/usr/local/lib/python3.10/site-packages/urllib3/_request_methods.py", line 144, in request
    return self.request_encode_body(
  File "/usr/local/lib/python3.10/site-packages/urllib3/_request_methods.py", line 279, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/usr/local/lib/python3.10/site-packages/urllib3/poolmanager.py", line 443, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 873, in urlopen
    return self.urlopen(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 873, in urlopen
    return self.urlopen(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 873, in urlopen
    return self.urlopen(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 843, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 519, in increment
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.whylabsapp.com', port=443): Max retries exceeded with url: /v0/sessions (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fab8d7f9de0>: Failed to resolve 'api.whylabsapp.com' ([Errno -2] Name or service not known)"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/logging/__init__.py", line 1100, in emit
    msg = self.format(record)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 943, in format
    return fmt.format(record)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 678, in format
    record.message = record.getMessage()
  File "/usr/local/lib/python3.10/logging/__init__.py", line 368, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.10/site-packages/ipykernel_launcher.py", line 18, in <module>
    app.launch_new_instance()
  File "/usr/local/lib/python3.10/site-packages/traitlets/config/application.py", line 1043, in launch_instance
    app.start()
  File "/usr/local/lib/python3.10/site-packages/ipykernel/kernelapp.py", line 739, in start
    self.io_loop.start()
  File "/usr/local/lib/python3.10/site-packages/tornado/platform/asyncio.py", line 205, in start
    self.asyncio_loop.run_forever()
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/usr/local/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 545, in dispatch_queue
    await self.process_one()
  File "/usr/local/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 534, in process_one
    await dispatch(*args)
  File "/usr/local/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 437, in dispatch_shell
    await result
  File "/usr/local/lib/python3.10/site-packages/ipykernel/ipkernel.py", line 362, in execute_request
    await super().execute_request(stream, ident, parent)
  File "/usr/local/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 778, in execute_request
    reply_content = await reply_content
  File "/usr/local/lib/python3.10/site-packages/ipykernel/ipkernel.py", line 449, in do_execute
    res = shell.run_cell(
  File "/usr/local/lib/python3.10/site-packages/ipykernel/zmqshell.py", line 549, in run_cell
    return super().run_cell(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3009, in run_cell
    result = self._run_cell(
  File "/usr/local/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3064, in _run_cell
    result = runner(coro)
  File "/usr/local/lib/python3.10/site-packages/IPython/core/async_helpers.py", line 129, in _pseudo_sync_runner
    coro.send(None)
  File "/usr/local/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3269, in run_cell_async
    has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
  File "/usr/local/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3448, in run_ast_nodes
    if await self.run_code(code, result, async_=asy):
  File "/usr/local/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3508, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "/tmp/ipykernel_27/3308197956.py", line 1, in <module>
    why.init("whylabs_anonymous")
  File "/usr/local/lib/python3.10/site-packages/whylogs/api/whylabs/session/session_manager.py", line 280, in init
    logger.warning("Could not initialize session", e)
Message: 'Could not initialize session'
Arguments: (MaxRetryError('HTTPSConnectionPool(host=\'api.whylabsapp.com\', port=443): Max retries exceeded with url: /v0/sessions (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fab8d7f9de0>: Failed to resolve \'api.whylabsapp.com\' ([Errno -2] Name or service not known)"))'),)

Looks to me , DNS resolution issue:

import socket
socket.getaddrinfo(“``api.whylabsapp.com``”, 443)

Response:

File /usr/local/lib/python3.10/socket.py:955, in getaddrinfo(host, port, family, type, proto, flags)
952 # We override this function since we want to translate the numeric family
953 # and socket type values to enum constants.
954 addrlist = []
→ 955 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
956 af, socktype, proto, canonname, sa = res
957 addrlist.append((_intenum_converter(af, AddressFamily),
958 _intenum_converter(socktype, SocketKind),
959 proto, canonname, sa))

gaierror: [Errno -3] Temporary failure in name resolution

can you try after sometime?

Also make sure to reset your work environment! and then try.

First clear your cache and browsing history, then reset the work environment, and try again

It does have DNS related issue, but could be also a temporary connectivity issue.

Let me know if your continue to encounter this error.

Also remember when you working on any labs dlai platform, we do have issue with connection server error frequently especially if we switch! browser consoles. So avoid switching browser in between. In case you do, make sure you first clear your kernel output and re-run the cells individually.

Regards
Dr. Deepti

hi @lesly.zerna

can you please check learner’s issue.

Thank you
Dr. Deepti

1 Like

The issue remains the same; I have followed all the steps above.

@raukuma

We apologise to inform you this course has been removed from the platform due to deprecated model.

Regards
Dr. Deepti

Thank you for learning with us! and sharing this! Actually, the course has been deprecated this week! :smiling_face_with_tear:
WhyLabs was acquired by Apple in 2025 and the course notebooks are no longer maintained.

The oficial announcement was made today! (here)