I have saspy (3.6.5) installed in JupyterLabs connecting to a remote instance of SAS via SSH.
Now the weird thing is that when I start python from the command line, it connects and establishes a session with my SAS instance, however when I try from a jupyter notebook it won't connect.
When I copy the ssh command that is presented in the Jupyter output it connects, but when I try to run it in a cell, it just hangs until I terminate it.
Anyone have any ideas?
Other potentially relevant information:
JupyterLab v 2.1.3
Python 3.7.6
SAS 9.4 M6 running under Centos 7
JupyterLab running in a docker container under Ubuntu 18.04.4 LTS
thanks in advance.
Solved.
Turns out that in my docker image (that I did not build), jupyter was running as a different user.
Once I copied the public keys over to the correct directory, it all works now.
Thanks to all those who chimed in to help.
I have passwordless ssh set up between the container and the vm, and it does connect.
Hey, my first thought on this is that wherever Jupyter is running, or what id it's running as, isn't the same as where this works when you run from a command line. Passwordless ssh isn't set up the same where Jupyter is running, as in your command line example. I do see you said the following:
JupyterLab running in a docker container under Ubuntu 18.04.4 LTS
So, that makes me think this is the issue. Can you verify that from the command line, inside that container, as the user that the jupyter process is running as, can ssh to the remote machine using that command line which works form your terminal?
The command line is inside the docker container, running as the same user as jupyter.
And there's no prompting, like for the machine to be added to the known_hosts file or anything?
Can you run python in the container, same as jupyter, but from the command line and try to connect w/ saspy? If you can ssh, w/out prompting for anything, then saspy should work, if you're configuration is the same.
No prompting. The screen shot of the command line connection in the OP is from the cli inside the container.
That's what has me stumped. It works from python at the cli but not from the notebook.
ok. Using the same user that jupyter is running? And what about current directory, is there something that could be picked up out of your current dir, running from the command line when it works, that maybe isn't there in the jupyter case? Are you using python environments, and maybe you're not using the same one in both cases?
What's different? It sounds like you're saying your running from the same machine, as the same user, w/ the same python environment with the same pw/less ssh setup, and it works one way but not the other. So, something is different between the two environments. But I can't look, so I'm just kinda guessing.
I appreciate your help.
Same environment, same user, not using virtual environments (unless python is using one without me knowing).
The notebook is connecting to the SAS compute instance, as when I hit the stop button I'm forced to terminate the sas session, it's just not getting the process id like the cli version.
ok, gotcha. Still, somethings different. If you'd like, I can set up a teams meeting with you this afternoon, If you can share your screen, maybe I can see something that's causing the difference, or we can debug it some and see what we turns up.
Tom
Thanks for the offer.
Would you have time on Tuesday for the teams call (i'm on pacific time), I'm tied up the rest of the day and on Monday.
Sure, no problem. Send me an email, tom.weber@sas.com, and I'll set up a meeting invite. I'm EST, so let me know what time works for you and I'll set it up.
Thanks,
Tom
Solved.
Turns out that in my docker image (that I did not build), jupyter was running as a different user.
Once I copied the public keys over to the correct directory, it all works now.
Thanks to all those who chimed in to help.
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:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94518__prt__xx__sp0__1\\deploywiz\\sas.svc.connection.jar;C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94518__prt__xx__sp0__1\\deploywiz\\log4j.jar;C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94518__prt__xx__sp0__1\\deploywiz\\sas.security.sspi.jar;C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94518__prt__xx__sp0__1\\deploywiz\\sas.core.jar;C:\\Users\\Pradip.Muhuri\\Anaconda3\\Lib\\site-packages\\saspy\\java\\saspyiom.jar', 'pyiom.saspy2j', '-host', 'localhost', '-stdinport', '52557', '-stdoutport', '52558', '-stderrport', '52559', '-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
Issue: Our IT staff has added the path to sspiauth.dll in the System PATH. I don't know why I am getting the above error in this laptop, although saspy and SAS in Juputer Lab work fine in my other laptop.
Any help toward resolving the issue would be appreciated. Thanks,
Below is some background information.
%put &sysvlong;
9.04.01M6P110718
%put &sysscpl;
X64_10PRO
C:\Program Files\SASHome\SASDeploymentManager\9.4\products\privatejre__99572__wx6__xx__sp0__1\bin\java.exe C:\Program Files\SASHome\SASPrivateJavaRuntimeEnvironment\9.4\jre\bin\java.exe
Name: saspy Version: 4.3.2
Name: SAS-kernel Version: 2.4.10
Python 3.9.12
#Content of sascfg_personal.py
SAS_config_names=['winlocal'] SAS_config_options = {'lock_down': False, 'verbose' : True } SAS_output_options = {'output' : 'html5'} # Configuration Definitions default = {'saspath' : '/opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_u8' } ssh = {'saspath' : '/opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_en', 'ssh' : '/usr/bin/ssh', 'host' : 'remote.linux.host', 'encoding': 'latin1', 'options' : ["-fullstimer"] } # build out a local classpath variable to use below for Windows clients CHANGE THE PATHS TO BE CORRECT FOR YOUR INSTALLATION cpW = "C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94518__prt__xx__sp0__1\\deploywiz\\sas.svc.connection.jar" cpW += ";C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94518__prt__xx__sp0__1\\deploywiz\\log4j.jar" cpW += ";C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94518__prt__xx__sp0__1\\deploywiz\\sas.security.sspi.jar" cpW += ";C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94518__prt__xx__sp0__1\\deploywiz\\sas.core.jar" cpW += ";C:\\Users\\Pradip.Muhuri\\Anaconda3\\Lib\\site-packages\\saspy\\java\\saspyiom.jar"
winlocal = {'java' : 'C:\\Program Files\\SASHome\\SASPrivateJavaRuntimeEnvironment\\9.4\\jre\\bin\\java.exe', 'encoding' : 'windows-1252', 'classpath' : cpW } winiomlinux = {'java' : 'java', 'iomhost' : 'linux.iom.host', 'iomport' : 8591, 'encoding' : 'latin1', 'classpath' : cpW } winiomwin = {'java' : 'java', 'iomhost' : 'windows.iom.host', 'iomport' : 8591, 'encoding' : 'windows-1252', 'classpath' : cpW } winiomIWA = {'java' : 'java', 'iomhost' : 'windows.iom.host', 'iomport' : 8591, 'encoding' : 'windows-1252', 'classpath' : cpW, 'sspi' : True }
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.
Find more tutorials on the SAS Users YouTube channel.