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

Getting error while importing ssl " import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed while importing _ssl: The specified module could not be found." #83525

Closed
Ajaya mannequin opened this issue Jan 15, 2020 · 5 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes OS-windows topic-SSL type-bug An unexpected behavior, bug, or error

Comments

@Ajaya
Copy link
Mannequin

Ajaya mannequin commented Jan 15, 2020

BPO 39344
Nosy @pfmoore, @tiran, @tjguk, @zware, @zooba
Files
  • journal.py: python script
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/tiran'
    closed_at = <Date 2021-04-17.18:27:00.886>
    created_at = <Date 2020-01-15.13:35:53.764>
    labels = ['expert-SSL', '3.8', 'type-bug', '3.7', 'OS-windows']
    title = 'Getting error while importing ssl " import _ssl # if we can\'t import it, let the error propagate ImportError: DLL load failed while importing _ssl: The specified module could not be found."'
    updated_at = <Date 2021-04-17.18:27:00.886>
    user = 'https://bugs.python.org/Ajaya'

    bugs.python.org fields:

    activity = <Date 2021-04-17.18:27:00.886>
    actor = 'christian.heimes'
    assignee = 'christian.heimes'
    closed = True
    closed_date = <Date 2021-04-17.18:27:00.886>
    closer = 'christian.heimes'
    components = ['Windows', 'SSL']
    creation = <Date 2020-01-15.13:35:53.764>
    creator = 'Ajaya'
    dependencies = []
    files = ['48846']
    hgrepos = []
    issue_num = 39344
    keywords = []
    message_count = 4.0
    messages = ['360055', '360059', '360074', '360094']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'christian.heimes', 'tim.golden', 'zach.ware', 'steve.dower', 'Ajaya']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue39344'
    versions = ['Python 3.7', 'Python 3.8']

    @Ajaya
    Copy link
    Mannequin Author

    Ajaya mannequin commented Jan 15, 2020

    We have built python3.7.5 and python3.8.1 source code in windows 10 machine. I have created an embedded interptreter where i am trying to "import ssl" but it is failing with error "Journal execution results for D:\workdir\PR\9616145\9616145\journal.py...
    Syntax errors:
    Line 98: Traceback (most recent call last):
      File "D:\workdir\PR\9616145\9616145\journal.py", line 1, in <module>
        import ssl
      File "<frozen zipimport>", line 259, in load_module
      File "D:\workdir\PR\PRUnits\PythonIssuefix381\wntx64\kits\nxbin\python\Python38.zip\ssl.py", line 98, in <module>
        import _ssl             # if we can't import it, let the error propagate
    ImportError: DLL load failed while importing _ssl: The specified module could not be found."

    This error was coming from python 3.7.4 and it was working fine till python 3.7.3.

    There is also one work around if i replaced _ssl.pyd with python3.7.3 _ssl.pyd it is working fine. I also found python 3.7.3 is using openssl-1.1.1c where as python3.7.5 and python3.8.1 is using openssl- 1.1.1d.

    I have also checked in using python 3.7.5 installing and import ssl is working fine. I have also checked that _ssl.pyd in installer and _ssl.pyd is created by manually built size is different.

    I am not getting the exact root cause what has happened. Could you please me i have already stucked and not able to work.

    @Ajaya Ajaya mannequin added 3.7 (EOL) end of life OS-windows type-bug An unexpected behavior, bug, or error labels Jan 15, 2020
    @SilentGhost SilentGhost mannequin added topic-SSL 3.8 only security fixes labels Jan 15, 2020
    @SilentGhost SilentGhost mannequin assigned tiran Jan 15, 2020
    @SilentGhost SilentGhost mannequin added topic-SSL 3.8 only security fixes labels Jan 15, 2020
    @SilentGhost SilentGhost mannequin assigned tiran Jan 15, 2020
    @tiran
    Copy link
    Member

    tiran commented Jan 15, 2020

    It sounds like Python cannot load the OpenSSL DLLs or a dependency of the OpenSSL DLLs. IIRC the libraries are called libssl.dll and libcrypto.dll. The files must be in the current DLL search path.

    @zooba
    Copy link
    Member

    zooba commented Jan 15, 2020

    More precisely, make sure the libcrypto-1_1.dll and libssl-1_1.dll files are in the same directory as your _ssl.pyd, but _not_ inside your Python38.zip file (zip import does not support native modules, they have to be outside of the zip).

    @pppery pppery mannequin changed the title Getting error while importing ssl " import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed while importing _ssl: The specified module could not be found." ImportError: DLL load failed while importing _ssl: The specified module could not be found." Jan 16, 2020
    @pppery pppery mannequin changed the title Getting error while importing ssl " import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed while importing _ssl: The specified module could not be found." ImportError: DLL load failed while importing _ssl: The specified module could not be found." Jan 16, 2020
    @Ajaya
    Copy link
    Mannequin Author

    Ajaya mannequin commented Jan 16, 2020

    Thanks all for your quick response. That issue has been resolved by
    solution given by Steve Dower and Christian Heimes

    On Thu, Jan 16, 2020 at 2:41 AM Steve Dower <report@bugs.python.org> wrote:

    Steve Dower <steve.dower@python.org> added the comment:

    More precisely, make sure the libcrypto-1_1.dll and libssl-1_1.dll files
    are in the same directory as your _ssl.pyd, but _not_ inside your
    Python38.zip file (zip import does not support native modules, they have to
    be outside of the zip).

    ----------


    Python tracker <report@bugs.python.org>
    <https://bugs.python.org/issue39344\>


    --
    Regards:
    Ajaya Kumar Sutar
    Product Engineer
    Siemens Industry Software (India) Private Limited
    Tower C, Panchashil Business Park,
    Cummins India Office Campus,
    Survey No. 21, Balewadi,
    Pune, India 411045
    Tel: +91-20-39182839(O)
    09764180686(P)

    @Ajaya Ajaya mannequin changed the title ImportError: DLL load failed while importing _ssl: The specified module could not be found." Getting error while importing ssl " import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed while importing _ssl: The specified module could not be found." Jan 16, 2020
    @Ajaya Ajaya mannequin changed the title ImportError: DLL load failed while importing _ssl: The specified module could not be found." Getting error while importing ssl " import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed while importing _ssl: The specified module could not be found." Jan 16, 2020
    @tiran tiran closed this as completed Apr 17, 2021
    @tiran tiran closed this as completed Apr 17, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @akarinaat
    Copy link

    akarinaat commented May 25, 2023

    This definitely works: https://bugs.python.org/issue39344%5C%3E
    Moving libcrypto-1_1.dll and libssl-1_1.dll to Anaconda3/DLL

    Another reference:https://stackoverflow.com/questions/54175042/python-3-7-anaconda-environment-import-ssl-dll-load-fail-error

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes OS-windows topic-SSL type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants