Missing Linux Library Dependencies
Incorrect SAS Threaded Kernel Configuration
As with any software, especially those that are network-based, you are bound to encounter problems. We have tried to outline the most common issues here so that you can get working as soon as possible.
There are minimum versions of Python packages that are required in order to use SWAT. If you install Python from Continuum Analytics, you should not expect any problems. But if you use an existing Python installation, you might have to upgrade some of your Python packages. The SWAT installer defines minimum package version requirements, which should prevent software installation problems.
Since you connect to some of your resources across a network, you might encounter problems while trying to get started. There are also dependencies on C shared libraries that can cause some issues. We’ll try to cover the most common situations here.
If you use SWAT on Linux with the binary interface to CAS, there is one particular shared library dependency that is installed by many Linux distributions, but not all of them: libnuma.so.1. If you are missing a required shared library, you see an error like the following when creating a connection to CAS.
In [1]: conn = swat.CAS('server-name.mycompany.com', 5570)
tkBoot failed: Cannot dlopen [tkmk.so] : [libnuma.so.1: cannot open shared object file: No such file or directory]
In this case, the dependency can be resolved by installing the numactl package of your Linux distribution. You can also put a copy of libnuma.so.1 in a directory and set the environment variable LD_LIBRARY_PATH to point to the directory in which the package is located. It is recommended that you ask your system administrator to install it so that it can be updated with any system updates.
It is possible that there are other shared library dependencies that might not be installed by your distribution. If so, you must determine which package of your Linux distribution contains those files and install them.
The SWAT package uses the SAS Threaded Kernel system for handling much of the heavy lifting behind-the-scenes. It consists of many shared libraries that SWAT must be able to load in order to run. Your SWAT installer should put them in the correct place. If the required shared libraries cannot be located when you attempt to create a connection, the following message is displayed:
In [1]: conn = swat.CAS('server-name.mycompany.com', 5570)
tkBoot failed: Cannot Locate [tkmk] in [/usr/local/lib/swat-tk:
/opt/sas/viya/SASFoundation/sasexe/:
Could not get TK handle
---------------------------------------------------------------------------
. . .
SWATError Traceback (most recent call last)
<ipython-input-2-d18c0dfd66ee> in <module>()
----> 1 s = swat.CAS('my-cas', 12345)
connection.py in __init__(self, hostname, port, username, password, session,
locale, nworkers, name, authinfo, protocol, **kwargs)
225 self._sw_error = clib.SW_CASError(a2n(soptions))
226 except SystemError:
--> 227 raise SWATError('Could not create CAS object. Check
your TK path setting.')
228
229 # Make the connection
SWATError: Could not create CAS object. Check your TK path setting.
If you know the location of your threaded kernel libraries, you can set an environment variable called TKPATH to the directory where they are installed. Note that the threaded kernel libraries should be installed for you in the SWAT package under the lib/platform directory.
If you receive an error about not being able to import _pyXXswat (where XX is the version number of your Python interpreter), it likely means that you are trying to connect to the binary interface of CAS without having the SWAT C extension installed. Here is an example of the error output:
In [1]: conn = swat.CAS('server-name.mycompany.com', 5570)
...
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-2-cb8d2ab92685> in <module>()
----> 1 swat.CAS('my-cas', 12345)
connection.py in __init__(self, hostname, port, username, password,
session,
locale, nworkers, name, authinfo, protocol,
**kwargs)
223 self._sw_error =
rest.REST_CASError(a2n(soptions))
224 else:
--> 225 self._sw_error =
clib.SW_CASError(a2n(soptions))
226 except SystemError:
227 raise SWATError('Could not create CAS object.
Check your TK path setting.')
clib.py in SW_CASError(*args, **kwargs)
84 ''' Return a CASError (importing _pyswat as needed) '''
85 if _pyswat is None:
---> 86 _import_pyswat()
87 return _pyswat.SW_CASError(*args, **kwargs)
88
clib.py in _import_pyswat()
43 raise ValueError(('Could not import import %s. This
is likely due to an '
44 'incorrect SAS TK path or an error
while loading the SAS TK
subsystem. '
---> 45 'You can try using the REST
interface as an alternative.') %
libname)
46
47
ValueError: Could not import import _py34swat. This is likely due to an incorrect SAS TK path or an error while loading the SAS TK subsystem. You can try using the REST interface as an alternative.
Not all platforms support the binary interface to CAS. If you did not see a platform-specific installer when installing SWAT, you are limited to using the REST interface to connect to CAS. To solve the problem, change the port number of CAS to the HTTP or HTTPS port of the server.
Another common issue is a refused connection. Here is an example of a typical message for this problem:
In [1]: conn = swat.CAS('server-name.mycompany.com', 5570)
ERROR: The TCP/IP tcpSockConnect support routine failed with error 61 (The connection was refused.).
ERROR: Failed to connect to host 'server-name.mycompany.com', port 5570.
...
During handling of the above exception, another exception occurred:
SWATError Traceback (most recent call last)
<ipython-input-3-404a7919d58a> in <module>()
----> 1 conn = swat.CAS('server-name.mycompany.com', 5570)
cas/connection.py in __init__(self, hostname, port, username,
password, session,
locale, nworkers, name, authinfo,
protocol, **kwargs)
259 raise SystemError
260 except SystemError:
--> 261 raise
SWATError(self._sw_error.getLastErrorMessage())
262
263 errorcheck(
self._sw_connection.setZeroIndexedParameters(),
self._sw_connection)
SWATError: Could not connect to 'server-name.mycompany.com' on port 5570.
The most common reason for this problem is that you don’t have a CAS server running on that host or port. Another cause might be that your network has firewall settings that prevent you from reaching that host or port.
Authentication problems can occur for several reasons, including a forgotten password or the system administrator’s deliberate disablement of your account on the machine. Another explanation is that the form of authentication that you are trying to use might not be enabled on your server.
Using an Authinfo file to authenticate a user name and password might also cause problems. First, for Linux, the permissions on the Authinfo file must be set to Readable by the owner. For Windows, permissions must be set to not Readable by the Everyone group. If you have incorrect permissions on the file, the file cannot be used, for security reasons. Here is a typical error message:
In [1]: conn = swat.CAS('server-name.mycompany.com', 5570)
WARNING: Incorrect permissions on netrc/authinfo file.
----------------------------------------------------------------------
SystemError Traceback (most recent call last)
connection.py in__init__(self, hostname, port, username, password,
session,
locale, nworkers, name, authinfo, protocol, **kwargs)
256 a2n(soptions),
--> 257 self._sw_error)
258 if self._sw_connection is None:
. . .
SWATError: Could not connect to 'server-name.mycompany.com' on port 5570.
To solve the problem for Linux, use the chmod command to assign the correct permissions as follows:
chmod 0600 ~/.authinfo
Another issue that pertains to Authinfo files is that the name (or IP address) of the CAS server must be specified explicitly. Domain names cannot be expanded. For example, the following line in your Authinfo file will cause a problem if you use server-name.mycompany.com when creating the CAS connection:
host server-name port 5570 user username password password
The specification of server-name does not match server-name.mycompany.com. Exact host names must be specified in the Authinfo file and in CAS connection parameters.
3.145.45.5