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

Tinytuya unable to import due to outdated openSSL #377

Open
Frefdt opened this issue Jul 4, 2023 · 7 comments
Open

Tinytuya unable to import due to outdated openSSL #377

Frefdt opened this issue Jul 4, 2023 · 7 comments

Comments

@Frefdt
Copy link

Frefdt commented Jul 4, 2023

image

@jasonacox
Copy link
Owner

ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the "ssl’ module is compiled with ‘OpenSSL 1.1.0h 27 Mar 2018". See: urllib3/urllib3#2168

TinyTuya uses the requests library which uses urllib3. It seems that v2 of urllib3 now requires OpenSSL 1.1.1 but your python environment has OpenSSL 1.1.0.

Workaround:

# remove urllib3 v2
pip uninstall urllib3
 
# install older version that support openssl v1.1.0
pip install urllib3==1.26.5 

I need to research if there is a good way we can address this. Since urllib3's decision to remove support for OpenSSL < 1.1.1, many other projects are impacted due to the transitive dependencies in python modules.

Any suggestions or PRs appreciated. 😁

@uzlonewolf
Copy link
Collaborator

uzlonewolf commented Jul 4, 2023

While it won't fix it, perhaps we should wrap that import in a try/except and print a message if it fails. That would at least allow local control to keep working.

@jasonacox
Copy link
Owner

Ooooh! That's a great idea. I wonder if this would work...

try:
    import requests
except ImportError as impErr:
    print("WARN: Unable to import requests library, Cloud functions will not work.")
    print("WARN: Check dependencies. See https://github.com/jasonacox/tinytuya/issues/377")
    print("WARN: Error: {}.".format(impErr.args[0]))

@Frefdt can you try this (just paste into a python prompt)? Also, what OS are you using?

@Frefdt
Copy link
Author

Frefdt commented Jul 4, 2023

image
Yeah, seems like it works! Currently running windows 10, but being that this was a fresh install of both python 3.7 and vscode its probably for the best if you wrap it in there for others that encounter similar problems

@Frefdt
Copy link
Author

Frefdt commented Jul 4, 2023

Also workaround worked just fine, thank you for the quick responses :)

@jasonacox
Copy link
Owner

Thanks @Frefdt !

@uzlonewolf I thought about folding this into #370 but don't want to conflate it - I think we make this a minor patch (v1.12.9).

@Frefdt
Copy link
Author

Frefdt commented Jul 4, 2023

Sounds like the best idea- just tested on a fresh vm and had the same issue so don't think it's an issue with my config specifically

jasonacox added a commit that referenced this issue Jul 4, 2023
Handle import issue with urllib3 #377
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

3 participants