sassoftware / saspy

A Python interface module to the SAS System. It works with Linux, Windows, and Mainframe SAS as well as with SAS in Viya.
https://sassoftware.github.io/saspy
Other
375 stars 149 forks source link

Error: Could not log on to the server "localhost:0" #479

Closed pkmedu closed 2 years ago

pkmedu commented 2 years ago

Attached is my saspy_personal.py.

Issue: The problem is similar to #6 in the troubleshooting guide for IOM specific errors. What change would I make to the file: saspy_personal.py or elsewhere? Please see below for details. Thanks,


import saspy import pandas as pd sas = saspy.SASsession(cfgname='winlocal') w_class = sas.sasdata("CLASS","SASHELP") w_class.describe()

We failed in getConnection The application could not log on to the server "localhost:0". Integrated Windows authentication failed. SAS process has terminated unexpectedly. RC from wait was: 4294967290 SAS Connection failed. No connection established. Double check your settings in sascfg_personal.py file.

Attempted to run program C:\Program Files\SASHome\SASPrivateJavaRuntimeEnvironment\9.4\jre\bin\java.exe with the following parameters:['C:\Program Files\SASHome\SASPrivateJavaRuntimeEnvironment\9.4\jre\bin\java.exe', '-classpath', 'C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\saspyiom.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\iomclient\log4j-1.2-api-2.12.4.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\iomclient\log4j-api-2.12.4.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\iomclient\log4j-core-2.12.4.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\iomclient\sas.security.sspi.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\iomclient\sas.core.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\iomclient\sas.svc.connection.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\iomclient\sas.rutil.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\iomclient\sas.rutil.nls.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\iomclient\sastpj.rutil.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\thirdparty\glassfish-corba-internal-api.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\thirdparty\glassfish-corba-omgapi.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\thirdparty\glassfish-corba-orb.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\thirdparty\pfl-basic.jar;C:\Users\pradip.muhuri\Anaconda3\lib\site-packages\saspy\java\thirdparty\pfl-tf.jar', 'pyiom.saspy2j', '-host', 'localhost', '-stdinport', '53812', '-stdoutport', '53813', '-stderrport', '53814', '-zero', '-lrecl', '1048576', '']

Be sure the path to sspiauth.dll is in your System PATH

No SAS process attached. SAS process has terminated unexpectedly. Invalid response from SAS on inital submission. printing the SASLOG as diagnostic

tomweber-sas commented 2 years ago

Is this from the communities site? Did you address your hosts file like number 6 in that section of the troubleshooting guide describes?

pkmedu commented 2 years ago

Hello Tom, My apology for multiple posts on this issue (SAS Communities and here). I didn't see your email until now. It came to my email associated with the GitHub repo. Is your question related to my saspy configuration file? Please see below. Thanks,

sascfg_personal.py

https://sassoftware.github.io/saspy/configuration.html#attn-as-of-saspy-version-3-3-3-the-classpath-is-no-longer-required-in-your-configuration-file

I have added C:\Program Files\SASHome\SASFoundation\9.4\core\sasexte to my system PATH as well.

Are the following two lines of Python code redundant here?

import os os.environ["PATH"] += ";C:\Program Files\SASHome\SASFoundation\9.4\core\sasext"

There are three main parts to this configuration file as stated in the abobe link.

Part 1. SAS_config_names

SAS_config_names=['winlocal']

Part 2. SAS_config_options are required unless you want to change a default. No such options added to this file.

Part 3 Configuration definitions

default = {'saspath' : '/opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_u8' }

winlocal = {'java' : 'C:\Program Files\SASHome\SASPrivateJavaRuntimeEnvironment\9.4\jre\bin\java.exe', 'encoding' : 'windows-1252' }

Is the following code chunk part of Part 3 and required here? If yes, does this code snippet require revision?

winiomwin = {'java' : 'java', 'iomhost' : 'windows.iom.host', 'iomport' : 8591, 'encoding' : 'windows-1252' }

tomweber-sas commented 2 years ago

Your error is number 6 in the troubleshooting guide, here: https://sassoftware.github.io/saspy/troubleshooting.html#iom-specific-errors. Have you addressed your host file that probably has localhost not set correctly.

Your config file is ok. You don't need to have configuration definitions in it that you don't use. But that won't matter either way. Having the path to the sspiauth.dll in your system path should be fine. If it's there then it's redundant to add it to the Python processes os.environ; but again, won't hurt.

Have you looked at your host file to fix the problem?

pkmedu commented 2 years ago

Thanks Tom. Okay, I will remove redundancy although it won't hurt. Which host file are you referring to? Sorry, I'm not familiar with the host file. Please clarify.

On Wed, Aug 31, 2022 at 2:08 PM Tom Weber @.***> wrote:

Your error is number 6 in the troubleshooting guide, here: https://sassoftware.github.io/saspy/troubleshooting.html#iom-specific-errors. Have you addressed your host file that probably has localhost not set correctly.

Your config file is ok. You don't need to have configuration definitions in it that you don't use. But that won't matter either way. Having the path to the sspiauth.dll in your system path should be fine. If it's there then it's redundant to add it to the Python processes os.environ; but again, won't hurt.

Have you looked at your host file to fix the problem?

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/479#issuecomment-1233255995, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXDQFRPCTEJZLRLVA6LIZDV36NRJANCNFSM57YUPG5A . You are receiving this because you authored the thread.Message ID: @.***>

-- Pradip K. Muhuri 2824 Big Bear Terrace Silver Spring, MD 20906 USA c: 301-728-0290 h: 301-438-0301 email: @.***

tomweber-sas commented 2 years ago

Have you read the information here. It tells you what to do. image

pkmedu commented 2 years ago

Hi Tom, Quite frankly, the thing about the host file is all Greek to me. I have reached out to our Tech Support. His response is as follows:

"We do not have FQDN and I don’t know enough to get this working for you. Our job is to install it.

That’s it.. My advice is to reach out to a colleague or set up a time for US (Me, you and SASP support) can work on this."

Any further thoughts?

Thanks for your continued support.

Pradip

On Wed, Aug 31, 2022 at 2:56 PM Tom Weber @.***> wrote:

Have you read the information here. It tells you what to do. [image: image] https://user-images.githubusercontent.com/17710182/187760063-b45fd59f-fecd-4c82-9c0c-9020fa43029f.png

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/479#issuecomment-1233300364, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXDQFWIMLXP2MHEXYQH6ZLV36TGDANCNFSM57YUPG5A . You are receiving this because you authored the thread.Message ID: @.***>

-- Pradip K. Muhuri 2824 Big Bear Terrace Silver Spring, MD 20906 USA c: 301-728-0290 h: 301-438-0301 email: @.***

tomweber-sas commented 2 years ago

Can you show me the contents of your host file?

pkmedu commented 2 years ago

C:>ipconfig /all

Windows IP Configuration

Host Name . . . . . . . . . . . . : HHSL76SFC93 Primary Dns Suffix . . . . . . . : itsc.hhs-itsc.local Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : itsc.hhs-itsc.local acf.hhs.gov hhs.gov ees.hhs.gov psc.gov samhsa.gov uc.hhs.local

On Wed, Aug 31, 2022 at 3:40 PM Tom Weber @.***> wrote:

Can you show me the contents of your host file?

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/479#issuecomment-1233347258, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXDQFWL6E2TLCX2PRK42KDV36YMLANCNFSM57YUPG5A . You are receiving this because you authored the thread.Message ID: @.***>

-- Pradip K. Muhuri 2824 Big Bear Terrace Silver Spring, MD 20906 USA c: 301-728-0290 h: 301-438-0301 email: @.***

pkmedu commented 2 years ago

Sorry for receding this in complete form. Thanks,

C:>ipconfig /all

Windows IP Configuration

Host Name . . . . . . . . . . . . : HHSL76SFC93 Primary Dns Suffix . . . . . . . : itsc.hhs-itsc.local Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : itsc.hhs-itsc.local acf.hhs.gov hhs.gov ees.hhs.gov psc.gov samhsa.gov uc.hhs.local

Ethernet adapter Ethernet 3:

Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Check Point Virtual Network Adapter For Endpoint VPN Client Physical Address. . . . . . . . . : 54-D4-9F-F1-06-01 DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes

Ethernet adapter Ethernet 5:

Connection-specific DNS Suffix . : ITSC.HHS-ITSC.local Description . . . . . . . . . . . : Dell Giga Ethernet Physical Address. . . . . . . . . : E4-54-E8-FC-06-72 DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::a59d:f077:e313:7379%10(Preferred) IPv4 Address. . . . . . . . . . . : 158.72.116.36(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Lease Obtained. . . . . . . . . . : Wednesday, August 31, 2022 7:54:19 AM Lease Expires . . . . . . . . . . : Thursday, September 8, 2022 7:55:20 AM Default Gateway . . . . . . . . . : 158.72.116.1 DHCP Server . . . . . . . . . . . : 158.72.151.37 DHCPv6 IAID . . . . . . . . . . . : 535057640 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2A-3A-F0-EA-1C-99-57-51-18-DC DNS Servers . . . . . . . . . . . : 158.72.66.137 158.70.80.137 158.72.66.136 158.70.80.136 NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter Ethernet 6:

Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Check Point Virtual Network Adapter For SSL Network Extender #2 Physical Address. . . . . . . . . : 54-DD-AC-5E-17-0E DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Wi-Fi:

Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : fios-router.home Description . . . . . . . . . . . : Intel(R) Wi-Fi 6 AX201 160MHz Physical Address. . . . . . . . . : 1C-99-57-51-18-DC DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Local Area Connection* 9:

Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter Physical Address. . . . . . . . . : 1C-99-57-51-18-DD DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Local Area Connection* 10:

Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2 Physical Address. . . . . . . . . : 1E-99-57-51-18-DC DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes

Ethernet adapter Bluetooth Network Connection:

Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network) Physical Address. . . . . . . . . : 1C-99-57-51-18-E0 DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes

On Wed, Aug 31, 2022 at 3:40 PM Tom Weber @.***> wrote:

Can you show me the contents of your host file?

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/479#issuecomment-1233347258, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXDQFWL6E2TLCX2PRK42KDV36YMLANCNFSM57YUPG5A . You are receiving this because you authored the thread.Message ID: @.***>

-- Pradip K. Muhuri 2824 Big Bear Terrace Silver Spring, MD 20906 USA c: 301-728-0290 h: 301-438-0301 email: @.***

tomweber-sas commented 2 years ago

That's not the hosts file. That's the output from running the ipconfig command. The hosts file is in the directory explained in the SAS note:

Resolve the Problem
If you encounter either of these error messages when attempting to create a project within SAS Enterprise Miner Workstation, then the first step is to inspect the hosts file with a text editor. By default, the hosts file is located here: your-Windows-system-path\System32\drivers\etc\hosts

In this directory path, your-Windows-system-path specifies the installation location for your Windows operating system (example: C:\Windows)

To achieve the required behavior, the hosts file must contain a line like this one:

127.0.0.1 localhost host-name

So, on my computer it's C:\Windows\System32\drivers\etc\hosts.

pkmedu commented 2 years ago

Hi Tom,

Here are the contents of the hosts file.

Copyright (c) 1993-2009 Microsoft Corp.

#

This is a sample HOSTS file used by Microsoft TCP/IP for Windows.

#

This file contains the mappings of IP addresses to host names. Each

entry should be kept on an individual line. The IP address should

be placed in the first column followed by the corresponding host name.

The IP address and the host name should be separated by at least one

space.

#

Additionally, comments (such as these) may be inserted on individual

lines or following the machine name denoted by a '#' symbol.

#

For example:

#

102.54.94.97 rhino.acme.com # source server

38.25.63.10 x.acme.com # x client host

localhost name resolution is handled within DNS itself.

127.0.0.1 localhost

::1 localhost

127.0.0.1 view-localhost # view localhost server

On Wed, Aug 31, 2022 at 3:46 PM Tom Weber @.***> wrote:

That's not the hosts file. That's the output from running the ipconfig command. The hosts file is in the directory explained in the SAS note:

Resolve the Problem If you encounter either of these error messages when attempting to create a project within SAS Enterprise Miner Workstation, then the first step is to inspect the hosts file with a text editor. By default, the hosts file is located here: your-Windows-system-path\System32\drivers\etc\hosts

In this directory path, your-Windows-system-path specifies the installation location for your Windows operating system (example: C:\Windows)

To achieve the required behavior, the hosts file must contain a line like this one:

127.0.0.1 localhost host-name

So, on my computer it's C:\Windows\System32\drivers\etc\hosts.

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/479#issuecomment-1233351894, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXDQFQH3PILQC27W66EY6TV36ZBTANCNFSM57YUPG5A . You are receiving this because you authored the thread.Message ID: @.***>

-- Pradip K. Muhuri 2824 Big Bear Terrace Silver Spring, MD 20906 USA c: 301-728-0290 h: 301-438-0301 email: @.***

tomweber-sas commented 2 years ago

Ok, that's what the instructions show and say to edit that line to add localhost before view-localhost:

Preserve Existing Mapping to Avoid an Issue from a Problematic Configuration
One specific, problematic configuration that SAS Technical Support has observed is a case where some virtualization software modifies the default host file to contain a line like the following:

127.0.0.1 view-localhost
This configuration results in the error messages mentioned earlier because it does not meet the requirement to map the keyword localhost to 127.0.0.1. To preserve this existing mapping and allow SAS Enterprise Miner Workstation to function, modify the line so that it looks like this: 

127.0.0.1 localhost view-localhost
pkmedu commented 2 years ago

Ok, that's what the instructions show and say to edit that line to add localhost before view-localhost:

Preserve Existing Mapping to Avoid an Issue from a Problematic Configuration
One specific, problematic configuration that SAS Technical Support has observed is a case where some virtualization software modifies the default host file to contain a line like the following:

127.0.0.1 view-localhost
This configuration results in the error messages mentioned earlier because it does not meet the requirement to map the keyword localhost to 127.0.0.1. To preserve this existing mapping and allow SAS Enterprise Miner Workstation to function, modify the line so that it looks like this: 

127.0.0.1 localhost view-localhost
pkmedu commented 2 years ago

Hello Tom, Our office says, "Modification of host files for testing on productions laptop is not recommended security practice." Is there a workaround to resolve the issue? Thanks,

pkmedu commented 2 years ago

(Also responded to the SASpy GitHub site) Hi Tom, Thanks for your reply. Our office now says that modification of host files for testing on production laptops is not a recommended security practice. Is there a workaround to resolve the issue?

On Wed, Aug 31, 2022 at 4:42 PM Tom Weber @.***> wrote:

Ok, that's what the instructions show and say to edit that line to add localhost before view-localhost:

Preserve Existing Mapping to Avoid an Issue from a Problematic Configuration One specific, problematic configuration that SAS Technical Support has observed is a case where some virtualization software modifies the default host file to contain a line like the following:

127.0.0.1 view-localhost This configuration results in the error messages mentioned earlier because it does not meet the requirement to map the keyword localhost to 127.0.0.1. To preserve this existing mapping and allow SAS Enterprise Miner Workstation to function, modify the line so that it looks like this:

127.0.0.1 localhost view-localhost

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/479#issuecomment-1233401488, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXDQFQEZ5JGP32QXFF757DV367VDANCNFSM57YUPG5A . You are receiving this because you authored the thread.Message ID: @.***>

-- Pradip K. Muhuri 2824 Big Bear Terrace Silver Spring, MD 20906 USA c: 301-728-0290 h: 301-438-0301 email: @.***

tomweber-sas commented 2 years ago

I don't know of any workaround. This isn't a SASPy requirement, it's a PC SAS restriction for client connections; it's not licensed to be a server. That means that client connections can only be made locally (not from other machines). That's why the IOM interface only honors connections for 'localhost'. It's SAS (The IOM interface) using 'localhost' as the machine name for the connection. That's why there's that tech support note saying exactly what to do, since this has become a problem with docker changing your host file when it's installed. All hosts files have had 127.0.0.1 localhost defined in them for decades, so software uses localhost as the alias for the loopback network adapter (local machine address). I'm sure your hosts file had that before installing whichever virtualization software changed it. Having the alias 'localhost' resolve to 127.0.0.1 is necessary for lots of software to function correctly. The specific section of the TS Note addresses what's in your hosts file, exactly:

Preserve Existing Mapping to Avoid an Issue from a Problematic Configuration
One specific, problematic configuration that SAS Technical Support has observed is a case where some virtualization software modifies the default host file to contain a line like the following:

127.0.0.1 view-localhost
This configuration results in the error messages mentioned earlier because it does not meet the requirement to map the keyword localhost to 127.0.0.1. To preserve this existing mapping and allow SAS Enterprise Miner Workstation to function, modify the line so that it looks like this: 

127.0.0.1 localhost view-localhost

I'm not sure how your systems folks don't get that localhost should resolve. If it's not in your hosts file, it could be configured as part of your DSN system to resolve that to 127.0.0.1, but it isn't configured that way, or you wouldn't get this error. Don't know how they can have issue with adding 'localhost' alias back to the hosts file like it's supposed to be, and was before it got changed by the virtualization software that was installed.

defining localhost to be 127.0.0.1 isn't a security risk; it's a decades old default convention. I don't have any workaround for that.

pkmedu commented 2 years ago

Thank you so much for your detailed response on the issue. It is good to know that "defining localhost to be 127.0.0.1 isn't a security risk; it's a decades old default convention". I will share your response with our IT group. I hope your response will convince them for a resolution of the issue .