Closed tszjqgs closed 9 months ago
Hey @tszjqgs, if you have a local PC SAS install on that machine, then you should configure it as Local. The config above is for Remote, which is why its trying to authenticate you.
Just remove both iomhost
and iomport
from your config definition and it will connect locally. Make sure you also set the path to the sspiauth.dll file as is explained in the Local
configuration instructions as well (in the link above).
Then you should be able to connect locally. Tom
You also need to remove other keys that aren't valid in this configuration. Neither classpath
nor saspath
should be in this configuration. About the only key you need is java
, I'm not sure if the option you're passing is needed or not.
@tomweber-sas Hi Tom , thanks , and I added path of sspiauth.dll in the Path in system variable
with configure file look like this :
SAS_config_names=['winlocal']
winlocal = {
'java' : 'D:\Program Files\Java\bin\java.exe'
}
I got error message :
Using SAS Config named: winlocal We failed in getConnection The native implementation module for the security package could not be found in the path. 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 D:\Program Files\Java\bin\java.exe with the following parameters:['D:\Program Files\Java\bin\java.exe', '-classpath', 'C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\saspyiom.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\iomclient\log4j-1.2-api-2.12.4.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\iomclient\log4j-api-2.12.4.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\iomclient\log4j-core-2.12.4.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\iomclient\sas.security.sspi.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\iomclient\sas.core.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\iomclient\sas.svc.connection.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\iomclient\sas.rutil.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\iomclient\sas.rutil.nls.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\iomclient\sastpj.rutil.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\thirdparty\glassfish-corba-internal-api.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\thirdparty\glassfish-corba-omgapi.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\thirdparty\glassfish-corba-orb.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\thirdparty\pfl-basic.jar;C:\Users\user\AppData\Roaming\Python\Python311\site-packages\saspy\java\thirdparty\pfl-tf.jar', 'pyiom.saspy2j', '-host', 'localhost', '-stdinport', '12720', '-stdoutport', '12721', '-stderrport', '12722', '-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
SASIOConnectionError Traceback (most recent call last) Cell In[6], line 1 ----> 1 sas = saspy.SASsession(cfgfile='C:/Users/user/AppData/Roaming/Python/Python311/site-packages/saspy/sascfg_personal.py')
File ~\AppData\Roaming\Python\Python311\site-packages\saspy\sasbase.py:610, in SASsession.init(self, **kwargs) 607 pass 609 if failed: --> 610 raise SASIOConnectionError(res) 612 if self.pyenc is not None: 613 if self._io.sascfg.encoding != '':
SASIOConnectionError: Failure establishing SASsession. No SAS process attached. SAS process has terminated unexpectedly.
Please refer to the Configuration Instructions in the SASPy Documentation at https://sassoftware.github.io/saspy/configuration You can also look for the error you've recieved in the Troublshooting guide at https://sassoftware.github.io/saspy/troubleshooting If you need more help, please open an Issue on the SASPy GitHub site at https://github.com/sassoftware/saspy/issues
if the configure file like this :
SAS_config_names=['winlocal']
I got error message like this :
AttributeError Traceback (most recent call last) Cell In[3], line 1 ----> 1 sas = saspy.SASsession(cfgfile='C:/Users/user/AppData/Roaming/Python/Python311/site-packages/saspy/sascfg_personal.py')
File ~\AppData\Roaming\Python\Python311\site-packages\saspy\sasbase.py:528, in SASsession.init(self, kwargs) 526 self._obj_cnt = 0 527 self.nosub = False --> 528 self.sascfg = SASconfig(kwargs) 529 self.batch = False 530 self.results = kwargs.get('results', self.sascfg.results)
File ~\AppData\Roaming\Python\Python311\site-packages\saspy\sasbase.py:184, in SASconfig.init(self, **kwargs) 181 raise RuntimeError("No SAS Config name provided.") 183 self.name = cfgname --> 184 cfg = getattr(SAScfg, cfgname) 186 ip = cfg.get('ip') 187 url = cfg.get('url')
AttributeError: module 'sascfg001' has no attribute 'winlocal'
Thanks Tom ,I followed the instruction ,got Path variable set up ,but got new error regarding some security related key words------------------------------------------------------------------ Sender:Tom @.> Date:2023/09/18 21:25:26 @.> @.>; @.> Theme:Re: [sassoftware/saspy] Using SAS Config named: winlocal Please enter the OMR user id: (Issue #559)
You also need to remove other keys that aren't valid in this configuration. Neither classpath nor saspath should be in this configuration. About the only key you need is java, I'm not sure if the option you're passing is needed or not. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
Hey, the error you got:
The native implementation module for the security package could not be found in the path.
Is the error when sspiauth.dll isn't found; num 3 here.
Can you show me where/how you have that set? Did you restart Python after setting it, so it would get picked up? Did you set it in the system PATH variable, or set it in the config file?
As for deleting the configuration definition from the config file, that's invalid and that would be the error you'd get for that. You have to have the configuration definition in the config file.
Hi Tom ,
here is my screen shot of path set up. And I followed the following steps
Press Windows + R keys simultaneously to open the Run dialog box. Type sysdm.cpl and press Enter. This will open the System Properties dialog. Navigate to the "Advanced" tab and click the "Environment Variables" button. In the "System Variables" section, find and select the "Path" variable and click "Edit". In the "Edit Environment Variable" dialog, click "New" and paste the path to the directory containing the sspiauth.dll file. As per your note, it should be something like C:\Program Files\SASHome\SASFoundation\9.4\core\sasext\ (though the exact path may differ on your system). Click "OK" on all dialogs to save and close.
and I also restarted my Anaconda to start my Jupyternote book over again already , and the following is my configure file
SAS_config_names=['winlocal']
winlocal = {
'java' : 'D:\Program Files\Java\bin\java.exe'
}
That all looks correct! So, lets verify by submitting a couple statements in your python session. Can you run the following and see if we see the dll?
import os
for item in os.environ['PATH'].split(';'):
print(item)
Well, that's to see if the path is in there. To see if the dll actually in there is:
os.stat(r'D:\Program Files\SASHome\SASFoundation\9.4\core\sasext\sspiauth.dll')
So, let's do both to see if pyhton is actually able to see the dll.
Wow, you've got it all right. And in that session you get that error about not finding the dll? That's strange. I'm at lunch right now, but when I get back in the office I'll try to see what else could cause that. Nothing I remember, but I'll dig into it some more.
Just to round out things, can you tell me what version of saspy you have? And, what happens on your machine when you double click a .SAS file? Does SAS come up, or EG, or ???
Thanks! Tom
Hi Tom , am not by my PC now , but as I recall , i used pip install saspy --upgrade command , and on my Windows machine , it is pretty traditional standalone version of desk top license , it installed the SAS suites . when double click a .SAS file , SAS comes up . and in Jupyter notebook , I used command print(saspy._ file _.py) to locate the saspy installation place and put the personal_config.py into this location
all above is what I did so far
No problem. All of what you have (that I've seen) looks good at the moment. When you have a chance to look at things on your PC, can you see the version of saspy, SAS, and Java that you're using. Your SAS directory says 9.4, so whichever maint version of that should be fine. I'm guessing you have a reasonable current version of saspy. So, what version of Java? If that's old, maybe it could be the issue with it trying to use that dll? A bit of a guess, but I'm not seeing anything else jump out with what I've seen so far. Is your system 64 bit? A current Windows version? Is Java a 64 bit version? Thanks, Tom
Wow, I'm at a loss. All of that looks perfectly fine. What version of SAS do you have (maintenance level), I see it's some 9.4 release? I may need to engage TS to see if there's something that can cause this with SAS/IOM on a local pc install that I've not see before.
Wait, I'm looking back at the output from the post and you don't have the path in the PATH. I see ...\sasexe but not ...\sasext. I didn't see that earlier; I thought I saw what I expected, So, for some reason, the \sasext path isn't in your PATH for your Python session even though it's in the System Path.
So, lets try the following. Either put this in your sascfg_personal.py (as shown here) or just submit it in python before importing saspy and making a connection:
import os
os.environ["PATH"] += ";D:\\Program Files\\SASHome\\SASFoundation\\9.4\\core\\sasext"
Then try to connect. I can't explain why Windows isn't getting the system path in your python, but it doesn't seem that it's there. So, setting it in the python session explicitly will have to do.
Please try that and let's see if that gets it! Tom
Ok, now we're getting further. The sspiauth.dll is finally being found and used! This new error is number 6 here; the solution is as documented.
The application could not log on to the server “localhost:0”. Integrated Windows authentication failed.
Your host file doesn't have localhost
defined as an alias for you loopback network adapter (127.0.0.1). This is often caused by installing docker which corrupts your host file. So, look in you host file and add localhost back in, per the instructions in that part of the troubleshooting guide.
Everything else is looking good now. As for why your system path variables aren't in your python session probably has to do with python and not windows itself. If you're using environments in anaconda, that can amybe have something to do with it. But, I can't tell from here. Go ahead and put that code to set the path in your config file, then it will be executed for you whenever you import saspy, so you won't need to submit it yourself (just like it says in the doc).
Hopefully this is the last thing!
Thanks a bunch , it really took a village
All right! That was harder than it needed to be. But you're up and running! Again, I would put the
import os
os.environ["PATH"] += ";D:\\Program Files\\SASHome\\SASFoundation\\9.4\\core\\sasext"
in your sascfg_personal.py file so that you never have to type that in. Or, figure out why that's not being included in your python's environment when it's in your system path. That's specific to something on your system; that ought to work and does in most other cases.
The hosts file being messed up by docker ow something else is a one time fix. Again, that's something that should always work; using localhost
in networking. So, you should be good to go now.
Let me know if you need anything else. I'll close this one now that you're running!
Thanks, Tom
my sascfg_personal.py look like this:
SAS_config_names=['winlocal']
winlocal = {
}
==================
and when I running in my windows jupyter notebook
sas = saspy.SASsession(cfgfile='C:/ProgramData/anaconda3/Lib/site-packages/saspy/sascfg_personal.py')
I KEEP getting the prompt:
Using SAS Config named: winlocal Please enter the OMR user id:
=================
my SAS is standalone windows version , company paid license , so how to make things right please