Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'TSocket' object has no attribute 'isOpen' #268

Open
tdhopper opened this issue Oct 4, 2017 · 25 comments
Open

'TSocket' object has no attribute 'isOpen' #268

tdhopper opened this issue Oct 4, 2017 · 25 comments

Comments

@tdhopper
Copy link
Contributor

tdhopper commented Oct 4, 2017

I'm seeing this error for the first time:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-b8033d8b7753> in <module>()
      1 impala.dbapi.connect(host=HOST, port=PORT, auth_mechanism='PLAIN',
----> 2                     user=USER, password=PASSWORD)

~/miniconda2/envs/env/lib/python3.6/site-packages/impala/dbapi.py in connect(host, port, database, timeout, use_ssl, ca_cert, auth_mechanism, user, password, kerberos_service_name, use_ldap, ldap_user, ldap_password, use_kerberos, protocol)
    145                           ca_cert=ca_cert, user=user, password=password,
    146                           kerberos_service_name=kerberos_service_name,
--> 147                           auth_mechanism=auth_mechanism)
    148     return hs2.HiveServer2Connection(service, default_db=database)
    149 

~/miniconda2/envs/env/lib/python3.6/site-packages/impala/hiveserver2.py in connect(host, port, timeout, use_ssl, ca_cert, user, password, kerberos_service_name, auth_mechanism)
    756     transport = get_transport(sock, host, kerberos_service_name,
    757                               auth_mechanism, user, password)
--> 758     transport.open()
    759     protocol = TBinaryProtocol(transport)
    760     if six.PY2:

~/miniconda2/envs/env/lib/python3.6/site-packages/thrift_sasl/__init__.py in open(self)
     65 
     66   def open(self):
---> 67     if not self._trans.isOpen():
     68       self._trans.open()
     69 

AttributeError: 'TSocket' object has no attribute 'isOpen'

These are versions I have installed:

thrift==0.9.3
thrift-sasl==0.3.0
thriftpy==0.3.9
impyla==0.14.0
@wesm
Copy link
Contributor

wesm commented Oct 4, 2017

I just pushed thrift_sasl 0.3.0 yesterday so it must be a version incompatibility. Can you upgrade to thrift 0.10.0? We probably need a version bump in impyla to pin things properly

@tdhopper
Copy link
Contributor Author

tdhopper commented Oct 4, 2017

@wesm Thanks. I actually get the same error with 0.10.0.

@wesm
Copy link
Contributor

wesm commented Oct 4, 2017

OK, well the fix is to pin thrift_sasl at 0.2.1 until we get impyla working on 0.10.0 + thrift_sasl 0.3.0. I am unable to work on it today unfortunately =/

@tdhopper
Copy link
Contributor Author

tdhopper commented Oct 4, 2017

Yup, that works.

@ghost
Copy link

ghost commented Oct 10, 2017

Hello!
I can't solve this problem with "AttributeError: 'TSocket' object has no attribute 'isOpen'" even with thrift_sasl == 0.2.1 installated...may be some other libraries should be exact versions? If so, what libraries and their versions should i check?
I use anaconda by the way.
Thanks!

@tdhopper
Copy link
Contributor Author

@rockot Maybe try thrift=0.9.3

@ghost
Copy link

ghost commented Oct 12, 2017

yes, this works, thanks! and also, suddenly, i needed sasl==0.2.1. And then, all together, it works.

wesm pushed a commit that referenced this issue Oct 12, 2017
* set thrift_sasl max version

It looks like there was a breaking change in thrift_sasl module.
Please specify thrift_sasl version <= 0.2.1, and that would resolve the issue.

* thrift_sasl<=0.2.1 requirement

install thrift_sasl before thrift

* pinned thrift_sasl until #268 is closed

* removed manditory requirement of thrift_sasl
wanjingjjj pushed a commit to wanjingjjj/impyla that referenced this issue Oct 25, 2017
)

* set thrift_sasl max version

It looks like there was a breaking change in thrift_sasl module.
Please specify thrift_sasl version <= 0.2.1, and that would resolve the issue.

* thrift_sasl<=0.2.1 requirement

install thrift_sasl before thrift

* pinned thrift_sasl until cloudera#268 is closed

* removed manditory requirement of thrift_sasl
@igorivanov
Copy link

Hello!
I create PR - cloudera/thrift_sasl#10 - in a thrift_sasl module. It fix compatibility erors.

acherici added a commit to acherici/superset that referenced this issue Nov 29, 2017
@rsadaphule
Copy link

I attempted to install pip install git+https://github.com/cloudera/thrift_sasl and ran into TSocket thrift_sas1 error. I checked version . It says sasl-0.2.1 thrift-sasl-0.3.0.

Could someone send me exact command to pin to 0.2.1

@qp910
Copy link

qp910 commented Apr 20, 2018

hlpe me, (if thrift_sasl=0.3.0,it will AttributeError: 'TSocket' object has no attribute 'isOpen'.but, thrift_sasl=0.2.1,it will thriftpy.transport.TTransportException: TTransportException(type=1, message="Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: Unable to find a callback: 2'")
supplement

@xiaomaosusie
Copy link

Hi Guys,

I"m having:
thrift==0.11.0
thrift-sasl==0.3.0
thriftpy==0.3.9
impyla==0.14.1

and I"m getting ''TSSLSocket' object has no attribute 'isOpen'' . Is it also bc of version issues? Shall I downgrade any of them?

Thank you so much for your help! Much appreciated!

Best,
Susie

@catchcharan
Copy link

Hi guys,

I'm able to resolve this issue with a workaround and little tweaking.

I uninstalled thrift_sasl on my anaconda3 environment. Then copied then directory from anaconda2 directory to anaconda3 directory. This change worked.

cd /opt/anaconda2/lib/python2.7/site-packages/
cp -R thrift_sasl /opt/anaconda3/lib/python3.6/site-packages/

Thanks,
Meher

@merritth
Copy link

I am experiencing the same issue with TSocket object has no attribute isOpen.

thrift-sasl 0.3.0
sasl 0.2.1
impyla 0.14.1

I'd love to be able to connect to a hive server via python...

@RobertFeyerharm
Copy link

Make sure to Restart your kernel if you're working in a Jupyter notebook!

I had the same problem connecting to Hive even after pip installing thrift_sasl==0.2.1, and was reminded by IT to restart my kernel before the changes take effect.

@yerra
Copy link

yerra commented Feb 7, 2019

I am using Anaconda 3 Environment with python 3.6.4 .Even I am getting 'TSocket' object has not attribute 'isOpen' issue.
But I am unable to downgrade thrift_sasl below 0.3.0 Any Idea why I am uable to downgrade ?

thrift = 0.11.0
thrift-sasl 0.3.0
thrift-py=0.3.9
impyla 0.14.1

@merritth
Copy link

merritth commented Feb 8, 2019

Make sure to Restart your kernel if you're working in a Jupyter notebook!

I had the same problem connecting to Hive even after pip installing thrift_sasl==0.2.1, and was reminded by IT to restart my kernel before the changes take effect.

Do you mean restart your Hive kernel or the kernel within your notebook?

@yerra
Copy link

yerra commented Feb 8, 2019

I am using Anaconda Snyder . I did restart kernel restart at Ipython console . How to do Hive Kernel restart ?

@merritth
Copy link

merritth commented Feb 8, 2019

That would be on your IT department I believe. I am not familiar how to reboot a hive/hadoop kernel.

@yerra
Copy link

yerra commented Feb 8, 2019

I am running this on VM , Which I can do my self if it resolves the issue. I will try and update

@RobertFeyerharm
Copy link

@merritth Restart the kernel within your notebook. On the notebook toolbar: Kernel -> Restart

@416381012
Copy link

I hava resolved it by use 0.2.1 version

timarmstrong pushed a commit that referenced this issue Jul 15, 2019
* include thrift_sasl in setup.py for Python3

I've also pinned the version pending the resolution of #268

* Add thrift_sasl as optional dependency
@Kxrr
Copy link

Kxrr commented Aug 20, 2019

The dependencies below work for me in docker container to initialize hive and impala client both.

system version

Python 3.6.8
Debian GNU/Linux 9 (stretch)

requirements.txt

impyla==0.15.0
sasl==0.2.1
thrift_sasl==0.2.1
thriftpy==0.3.9
thriftpy2==0.4.0

apt packages

sudo apt-get install libsasl2-dev libsasl2-2 libsasl2-modules-gssapi-mit

@ampersand-five
Copy link

ampersand-five commented Jan 24, 2020

Had the same problem. If you follow the error around, for me at least, the problem is that thrift-sasl calls isOpen() on a TSocket object (which exists in thriftpy2), but that object only has a function called is_open().

Looking at thrift-sasl, this was actually fixed in version 0.4.0 that was released on Dec. 13, 2019.

So make sure your package manager of choice is pulling thrift-sasl >= 0.4.0 and it should be fixed.
pypi at https://pypi.org/project/thrift-sasl/#history shows that thrift-sasl (as of Jan. 23, 2020) only has version 3 being distributed, so most are probably using pip and only getting version 3. Until pypi is updated with version 0.4.0, then the new version can be obtained with pip install thrift-sasl==0.4a1

@timarmstrong
Copy link
Contributor

@dknupp do we plan to make the 0.4.0 release of thrift-sasl non-alpha?

@MacwinWin
Copy link

pandas.read_sql() still not working under thrift-sasl-0.4.2 but thrift-sasl-0.2.1 works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests