0

So, I want to mess around with atoti. I installed the library but I can't connect to session. I can't connect to the session using jupyter, and if I use google colab, I can't connect to the website. I don't know what's going on nor can I find any documentation on this.

Code that I used for jupyter (anaconda):

import atoti as tt
session = tt.Session()
#error statement
---------------------------------------------------------------------------
ConnectionRefusedError                    Traceback (most recent call last)
File ~\AppData\Local\anaconda3\lib\site-packages\atoti\_local_session.py:179, in LocalSession._create_subprocess_and_java_api(self, distributed, license_key)
    176 try:
    177     # Attempt to connect to an existing detached process (useful for debugging).
    178     # Failed attempts are very fast (usually less than 2ms): users won't notice them.
--> 179     self._java_api = JavaApi(
    180         py4j_java_port=_PY4J_DEFAULT_PORT,
    181         distributed=distributed,
    182     )
    183     self._server_subprocess = None

File ~\AppData\Local\anaconda3\lib\site-packages\atoti\_java_api.py:157, in _enhance_py4j_errors.<locals>.wrapped_method(self, *args, **kwargs)
    156 try:
--> 157     return function(self, *args, **kwargs)
    158 except Py4JJavaError as java_exception:

File ~\AppData\Local\anaconda3\lib\site-packages\atoti\_java_api.py:293, in JavaApi.__init__(self, auth_token, py4j_java_port, distributed)
    286 def __init__(
    287     self,
    288     *,
   (...)
    291     distributed: bool = False,
    292 ):
--> 293     self.gateway: JavaGateway = _create_py4j_gateway(
    294         auth_token=auth_token, py4j_java_port=py4j_java_port
    295     )
    296     self.java_session: Any = self.gateway.entry_point

File ~\AppData\Local\anaconda3\lib\site-packages\atoti\_java_api.py:276, in _create_py4j_gateway(auth_token, py4j_java_port)
    274 assert gateway_server is not None
    275 gateway_server.resetCallbackClient(  # pyright: ignore[reportGeneralTypeIssues, reportOptionalCall]
--> 276     gateway_server.getCallbackClient().getAddress(),  # pyright: ignore[reportGeneralTypeIssues, reportOptionalCall]
    277     python_port,
    278 )
    280 return gateway

File ~\AppData\Local\anaconda3\lib\site-packages\py4j\java_gateway.py:1321, in JavaMember.__call__(self, *args)
   1316 command = proto.CALL_COMMAND_NAME +\
   1317     self.command_header +\
   1318     args_command +\
   1319     proto.END_COMMAND_PART
-> 1321 answer = self.gateway_client.send_command(command)
   1322 return_value = get_return_value(
   1323     answer, self.gateway_client, self.target_id, self.name)

File ~\AppData\Local\anaconda3\lib\site-packages\py4j\java_gateway.py:1036, in GatewayClient.send_command(self, command, retry, binary)
   1016 """Sends a command to the JVM. This method is not intended to be
   1017    called directly by Py4J users. It is usually called by
   1018    :class:`JavaMember` instances.
   (...)
   1034  if `binary` is `True`.
   1035 """
-> 1036 connection = self._get_connection()
   1037 try:

File ~\AppData\Local\anaconda3\lib\site-packages\py4j\clientserver.py:284, in JavaClient._get_connection(self)
    283 if connection is None or connection.socket is None:
--> 284     connection = self._create_new_connection()
    285 return connection

File ~\AppData\Local\anaconda3\lib\site-packages\py4j\clientserver.py:291, in JavaClient._create_new_connection(self)
    288 connection = ClientServerConnection(
    289     self.java_parameters, self.python_parameters,
    290     self.gateway_property, self)
--> 291 connection.connect_to_java_server()
    292 self.set_thread_connection(connection)

File ~\AppData\Local\anaconda3\lib\site-packages\py4j\clientserver.py:438, in ClientServerConnection.connect_to_java_server(self)
    436     self.socket = self.ssl_context.wrap_socket(
    437         self.socket, server_hostname=self.java_address)
--> 438 self.socket.connect((self.java_address, self.java_port))
    439 self.stream = self.socket.makefile("rb")

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
Cell In[4], line 1
----> 1 session = tt.Session()

File ~\AppData\Local\anaconda3\lib\site-packages\atoti\_telemetry\track_calls.py:95, in _track_function_calls.<locals>.function_wrapper(*args, **kwargs)
     92 call_tracker.tracking = True
     94 try:
---> 95     return _track_function_call(function, call_path, *args, **kwargs)
     96 finally:
     97     call_tracker.tracking = False

File ~\AppData\Local\anaconda3\lib\site-packages\atoti\_telemetry\track_calls.py:54, in _track_function_call(function, call_path, *args, **kwargs)
     52 call_time = time.perf_counter()
     53 try:
---> 54     return function(*args, **kwargs)
     55 except Exception as error:
     56     with contextlib.suppress(  # Do nothing to let the previous error be the one presented to the user.
     57         Exception
     58     ):

File ~\AppData\Local\anaconda3\lib\site-packages\atoti\_runtime_type_checking_utils.py:168, in _TypecheckWrapperFactory.create_wrapper.<locals>.typechecked_func_wrapper(*args, **kwargs)
    165 typeguard.check_argument_types(memo)
    167 # Call the actual function.
--> 168 return self._func(*args, **kwargs)

File ~\AppData\Local\anaconda3\lib\site-packages\atoti\session.py:245, in Session.__init__(self, name, app_extensions, authentication, branding, client_certificate, extra_jars, https, i18n, java_options, jwt, logging, port, same_site, user_content_storage, **kwargs)
    242 if name is not None:
    243     _sessions._clear_duplicate_sessions(name)
--> 245 super().__init__(
    246     config=config,
    247     distributed=False,
    248     license_key=private_parameters.license_key,
    249     name=name,
    250     plugins=private_parameters.plugins,
    251 )
    253 self._warn_if_license_about_to_expire()
    254 self._cubes = Cubes(
    255     delete_cube=self._java_api.delete_cube,
    256     get_cube=self._get_cube,
    257     get_cubes=self._get_cubes,
    258 )

File ~\AppData\Local\anaconda3\lib\site-packages\atoti\_local_session.py:153, in LocalSession.__init__(self, config, distributed, license_key, name, plugins)
    150 if not license_key and LICENSE_KEY.use_env_var:
    151     license_key = os.environ.get(LICENSE_KEY_ENV_VAR_NAME)
--> 153 self._create_subprocess_and_java_api(
    154     distributed=distributed, license_key=license_key
    155 )
    157 for plugin in plugins.values():
    158     plugin.init_session(self)

File ~\AppData\Local\anaconda3\lib\site-packages\atoti\_local_session.py:186, in LocalSession._create_subprocess_and_java_api(self, distributed, license_key)
    183     self._server_subprocess = None
    184 except ConnectionRefusedError:
    185     # No available unauthenticated detached process: creating subprocess.
--> 186     process = ServerSubprocess(
    187         config=self._config,
    188         license_key=license_key,
    189         plugins=self._plugins,
    190         session_id=self._id,
    191     )
    192     self._java_api = JavaApi(
    193         auth_token=process.auth_token,
    194         py4j_java_port=process.py4j_java_port,
    195         distributed=distributed,
    196     )
    197     self._server_subprocess = process

File ~\AppData\Local\anaconda3\lib\site-packages\atoti\_server_subprocess.py:94, in ServerSubprocess.__init__(self, config, license_key, plugins, session_id)
     84     license_key = local_to_absolute_path(_COMMUNITY_LICENSE_KEY_PATH)
     86 self._process = Popen(
     87     self.command,  # noqa: S603
     88     env={**os.environ, LICENSE_KEY_ENV_VAR_NAME: license_key},
   (...)
     91     text=True,
     92 )
---> 94 match, startup_output = wait_for_matching_output(
     95     _PY4J_SERVER_STARTED_PATTERN,
     96     process=self._process,
     97 )
     99 self.py4j_java_port = int(match.group("port"))
    100 self.auth_token: Optional[str] = match.group("token")

File ~\AppData\Local\anaconda3\lib\site-packages\atoti\_wait_for_matching_output.py:40, in wait_for_matching_output(pattern, process, timeout)
     38 while process.poll() is None:
     39     if (datetime.now() - start) > timeout:
---> 40         raise RuntimeError(
     41             get_error_message(
     42                 reason=f"{timeout.total_seconds()} seconds elapsed but the process output did not match the expected pattern."
     43             )
     44         )
     46     line = process.stdout.readline()
     47     output.write(line)

RuntimeError: 100.0 seconds elapsed but the process output did not match the expected pattern.
COMMAND:
'C:\Users\HIS10842\AppData\Local\anaconda3\lib\site-packages\jdk4py\java-runtime\bin\java' --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED -jar -Dserver.port=0 '-Dserver.session_directory=C:\Users\HIS10842\.atoti\1689286805_8Q7AFX' -Dserver.logging.disable_console_logging=true '-Dhadoop.home.dir=C:\Users\HIS10842\AppData\Local\anaconda3\lib\site-packages\atoti\bin\hadoop-3.2.1' '-Dloader.path=C:\Users\HIS10842\AppData\Local\anaconda3\lib\site-packages\atoti\data\activeui-initial-content.jar,C:\Users\HIS10842\AppData\Local\anaconda3\lib\site-packages\atoti\data\admin-ui.jar,C:\Users\HIS10842\AppData\Local\anaconda3\lib\site-packages\atoti\data\application.jar,C:\Users\HIS10842\AppData\Local\anaconda3\lib\site-packages\atoti\data\atoti-plus.jar' 'C:\Users\HIS10842\AppData\Local\anaconda3\lib\site-packages\atoti\data\atoti.jar' --enable-auth
PATTERN:
Py4J server started on port (?P<port>\d+)(?: with auth token (?P<token>.+))?$
OUTPUT:
Jul 13, 2023 3:20:13 PM ActiveViam License log
INFO: Activating ActiveViam Licensing Agent.
Jul 13, 2023 3:20:13 PM com.activeviam.activation.impl.LicenseManager a
INFO: License has been found from system property -Dactivepivot.license=C:\Users\HIS10842\AppData\Local\anaconda3\lib\site-packages\atoti\data\community.lic
Jul 13, 2023 3:20:13 PM ActiveViam License log
INFO: 
*************** Platform Information *****************
System Time: July 13, 2023
Number of Processors: 4
MAC address: 60-45-BD-CC-8A-AE
IP address: 172.21.96.46
Hostname: haeadedavd1-58
******************************************************

********** ActivePivot License Information ***********
License ID: 627da152-6d61-43b5-9348-ad49ae5f5c2e
Client name: atoti community
End Date: Thu Oct 12 21:00:00 PDT 2023
Maximum Number of Processors: 0
Restricted MAC address: -
Restricted IP address: -
Restricted Hostname: -
On Demand: true
On Demand License Server: AWS_EU_WEST_1_PROD
Target Environment: -
Datastore Enabled: true
DirectQuery Enabled: false
ActiveUI Enabled: true
ActiveMonitor Enabled: true
Collateral Optimizer Enabled: false
******************************************************

ActivePivot Version: 6.0.6-20230630-143543
Jul 13, 2023 3:20:35 PM ActiveViam License log
WARNING: Unable to contact license server for initial check. Retry in 15 seconds.(Connection timed out: connect)
Jul 13, 2023 3:21:11 PM ActiveViam License log
WARNING: Unable to contact license server for initial check. Retry in 30 seconds.(Connection timed out: connect)
Jul 13, 2023 3:22:03 PM ActiveViam License log

Code I used in google colab:

import atoti as tt

session = tt.Session()
session.link()

this is the web error

daza
  • 37
  • 3
  • The Colab aspect is a straightforard answer. You are running Google Colab on a remote computer system that then gets ported to you. I suspect it is like using JupyterHub. It looks like `atoti` by default is set up to be used in Python running on your own machine. I'm not sure it is even compatible with running in a notebook given it is using localhost, which Jupyter notebook **running on your own local machine** also uses to allow you to connect. It does look like it uses a different port by default. Still you cannot connect easily to the localhost running on Google Colab's machine. ... – Wayne Jul 14 '23 at 01:16
  • First hit if you search 'atoti google colab' on Google is [a filed issue at ` atoti` Github page entitled 'How to use atoti on Google Colab'](https://github.com/atoti/atoti/issues/273). – Wayne Jul 14 '23 at 01:18
  • On your own computer (the upper error statement shown) it looks promising. It seems to be indicating that it needs licensing information from you? Did you set that like the error tells you to ` 84 license_key = local_to_absolute_path(_COMMUNITY_LICENSE_KEY_PATH)`? – Wayne Jul 14 '23 at 01:28
  • Is there a document telling me how to set up the licensing info? I just followed the atoti installation page and video (https://docs.atoti.io/latest/getting_started/installation.html,, https://www.youtube.com/watch?v=AfKfs3teFlM). Never once has it mentioned anything about license. As a matter of fact, I don't even know what the path for the community_license_key is. – daza Jul 14 '23 at 16:23
  • Hmmm... maybe if you install it correctly, it deals with that license. It seems so from my own test just now. How did you install it? You seem to be using Anaconda, so you should follow [here](https://docs.atoti.io/latest/getting_started/installation.html#conda-package). I'll post an example of using it where you can use it in your browser without touching your own system. Maybe seeing it install and run correctly will help you sort out what you did wrong. Go [here](https://nbviewer.org/gist/fomightez/21f5414174d36a56c7a96474aeda8253) and follow the steps I used to run it just now. – Wayne Jul 14 '23 at 18:00
  • I installed atoti using pip install. Should I uninstall it first before using conda? – daza Jul 14 '23 at 18:18
  • Because Anaconda/conda is your **primary** package manager by choice because you installed Anaconda/conda, you should always choose to install with conda if you have the option. Only ever use `pip install` if you have no choice. Considering you already tried `pip`. you should ideally uninstall from `pip` first before trying with conda. – Wayne Jul 14 '23 at 18:45

2 Answers2

0

Using it from Jupyter works fine. I just posted a a gist here where I stepped through running the installation in a temporary session served via the MyBinder.org service. Note that those sessions on remote computers are temporary and so if you make anything, make sure to download it back to your local machine. If the session times out, it is gone forever.

(Note I suspect because I installed in an already running mybinder, session I wasn't seeing 'session.visualize()' steps work right. The extension would have to be installed during build and the session launched with that working already, I believe. I didn't pursue that idea farther. Here has some complex extensions that work when launched via MyBinder because they are installed & run before the actual session runs.)

I covered the possible issue with Google Colab in my comments below the original post. I also referenced others posting questions about using it with Google Colab in the packages Github site: a filed issue at atoti Github page entitled 'How to use atoti on Google Colab'.

Wayne
  • 6,607
  • 8
  • 36
  • 93
0

The embedded community license key requires an open Internet access to be validated. Do you have a firewall or something else preventing outgoing requests? If that's the case you can request an evaluation license to be able to use Atoti offline.

tibdex
  • 36
  • 2
  • I got an evaluation license. I just have no idea on how to incorporate it (or activate it). – daza Jul 24 '23 at 23:01
  • The **Setting up the license key** section in the link I shared previously explains how to use it. Do you find something unclear in these steps? – tibdex Jul 25 '23 at 15:34
  • This step - 'Set the ATOTI_LICENSE environment variable to the Base64 encoded content of your license key file.' I don't know how to do this – daza Jul 25 '23 at 17:19
  • The evaluation license that you received is already base64 encoded. You should define an environment variable named `ATOTI_LICENSE` and with your license key as a value. – tibdex Jul 26 '23 at 17:37
  • So something like this when coding? ---> license = atoti ([license]) – daza Jul 27 '23 at 16:50