aws-saml cannot load readline
Closed this issue · 4 comments
I get the following error when i run..
Traceback (most recent call last):
File "/Users/zaro0508/.virtualenvs/test5/bin/aws-saml", line 8, in <module>
sys.exit(main())
File "/Users/zaro0508/.virtualenvs/test5/lib/python3.6/site-packages/awscli_saml/main.py", line 32, in main
import awscli_saml.assume_role as assume_role
File "/Users/zaro0508/.virtualenvs/test5/lib/python3.6/site-packages/awscli_saml/assume_role.py", line 7, in <module>
import readline # needed for terminal raw mode (> 4096 characters)
ImportError: dlopen(/Users/zaro0508/.virtualenvs/test5/lib/python3.6/readline.so, 2): Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
Referenced from: /Users/zaro0508/.virtualenvs/test5/lib/python3.6/readline.so
Reason: image not found
My environment:
➜ pip freeze
awscli-saml==1.1.1
boto3==1.13.6
botocore==1.16.6
docutils==0.15.2
jmespath==0.9.5
python-dateutil==2.8.1
s3transfer==0.3.3
six==1.14.0
urllib3==1.25.9
➜ brew info readline
readline: stable 8.0.4 (bottled) [keg-only]
Library for command-line editing
https://tiswww.case.edu/php/chet/readline/rltop.html
/usr/local/Cellar/readline/8.0.1 (48 files, 1.5MB)
Poured from bottle on 2019-11-13 at 11:18:27
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/readline.rb
I don't have ver 7 on my machine. The latest version of readline is ver 8.0.1 and and there doesn't seem to be a brew formula for ver 7 to install. Maybe the dependency needs to be updated? Do you know of a workaround?
Not the preferred solution but a workaround that seemed to work for me is to copy the ver 8 lib and name it ver 7.
cp /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
ls -l /usr/local/opt/readline/lib/
total 1920
-r--r--r-- 1 zaro0508 staff 40396 Nov 13 11:18 libhistory.8.0.dylib
lrwxr-xr-x 1 zaro0508 staff 20 Dec 19 2018 libhistory.8.dylib -> libhistory.8.0.dylib
-r--r--r-- 1 zaro0508 staff 46008 Dec 19 2018 libhistory.a
lrwxr-xr-x 1 zaro0508 staff 20 Dec 19 2018 libhistory.dylib -> libhistory.8.0.dylib
-rw-r--r-- 1 zaro0508 staff 239220 May 9 08:06 libreadline.7.dylib
-rw-r--r-- 1 zaro0508 staff 239220 Nov 13 11:18 libreadline.8.0.dylib
lrwxr-xr-x 1 zaro0508 staff 21 Dec 19 2018 libreadline.8.dylib -> libreadline.8.0.dylib
-r--r--r-- 1 zaro0508 staff 406912 Dec 19 2018 libreadline.a
lrwxr-xr-x 1 zaro0508 staff 21 Dec 19 2018 libreadline.dylib -> libreadline.8.0.dylib
drwxr-xr-x 3 zaro0508 staff 96 Nov 13 11:18 pkgconfig
Unfortunately I do not have a Mac and so cannot test this. (I do know that the docker version works on Mac.)
You might try commenting out the import altogether.
It was needed for input
to support more than 4KB.
With 2.0.0, if you provide the SAML response as a env variable or command line parameter, readline is no longer loaded.
thanks @pauldraper. I've verified that this issue was happening when using python ver 3.6.3. I used pyenv to install python ver 3.6.9 and it no longer occurs. I also verified that this error does not happen when using python 3.7.3 and 3.8.0.