title: PyInstaller SSL error with requests module - missing module ssl (_ssl)
body: <p>In my python script, I use the requests module to call an API to GET and POST data.</p>
  <p>Python environment: anaconda3, python 3.7 / packages: requests 2.24.0, pyinstaller 3.6, openssl 1.1.1h...</p>
  <p>I have the following problem with the EXE-file generated by PyInstaller: When I run this file, I get the following error message. This error doesn't occur when I run my script from Python:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;site-packages\PyInstaller\loader\rthooks\pyi_rth_certifi.py&quot;, line 13, in &lt;module&gt;
    File &quot;c:\programdata\anaconda3\envs\...\lib\site-packages\PyInstaller\loader\pyimod03_importers.py&quot;, line 623, in exec_module
    File &quot;ssl.py&quot;, line 98, in &lt;module&gt;
  ImportError: DLL load failed: The specified module could not be found.
  [20188] Failed to execute script pyi_rth_certifi
  </code></pre>
  <p>If I follow to the excepted error lines (ssl.py):</p>
  <pre><code>import _ssl             # if we can't import it, let the error propagate
  </code></pre>
  <p><strong>Why can't ssl be imported?</strong></p>
  <p>I searched a long time in serveral post on SO but all these answers didn't help, ex.:</p>
  <p><a href="https://stackoverflow.com/questions/10667960/python-requests-throwing-sslerror">Python Requests throwing SSLError</a></p>
  <p><a href="https://stackoverflow.com/questions/42982143/python-requests-how-to-use-system-ca-certificates-debian-ubuntu">Python Requests - How to use system ca-certificates (debian/ubuntu)?</a></p>
  <p><a href="https://stackoverflow.com/questions/21201238/twilio-python-module-errors-after-compiling/21206079#21206079">Twilio Python Module Errors After Compiling</a></p>
  <p><a href="https://stackoverflow.com/questions/17158529/fixing-ssl-certificate-error-in-exe-compiled-with-py2exe-or-pyinstaller">Fixing SSL certificate error in exe compiled with py2exe (or PyInstaller)</a></p>
  <p><strong>Does anyone have an idea how to fix this?</strong>
  If you need more informations, please write a comment. THX</p>
  <hr />
  <p><strong>EDIT: (for Mooncrater's comment)</strong></p>
  <p>added Screenshot from python console, entered:</p>
  <pre><code>import _ssl
  </code></pre>
  <p><a href="https://i.stack.imgur.com/le4nA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/le4nA.png" alt="import _ssl" /></a></p>
  <hr />
  <p><strong>EDIT 2:</strong></p>
  <p>Tested &quot;FIX&quot; from SO Question:
  <a href="https://stackoverflow.com/questions/57253470/python-ssl-import-error-in-pyinstaller-generated-executable/57258734#57258734">Python SSL Import Error in PyInstaller generated executable</a></p>
  <p>-&gt; this didn't fix my problem</p>
  <hr />
  <p><strong>EDIT 3: Answer by cbolwerk</strong></p>
  <p>THX for your answer, this works!</p>
  <p><a href="https://stackoverflow.com/questions/54175042/python-3-7-anaconda-environment-import-ssl-dll-load-fail-error/60405693#60405693">Python 3.7 anaconda environment - import _ssl DLL load fail error</a></p>
  <p>An additional fix is to install the latest OpenSSL Lib, I used 1.1.1h package in my python script, on my PC was installed  an older version and that causes the error too.</p>
  <p>cbolwerk's answer I tested on a PC where NO OpenSSL is installed and , as I wrote, it works!</p>