ariannedee / python-foundations-3-weeks

40 stars 69 forks source link

Issues with doing step 5 in the setup process for Windows 10. #4

Open Burns-13 opened 1 year ago

Burns-13 commented 1 year ago

I ran into some issues completing step 5: Make sure that you can run Python in PyCharm and installing the requirements needed for this project. PIP was having certificate issues:

C:\WINDOWS\system32>pip install requests
ERROR: Could not install packages due to an OSError: Could not find a suitable TLS CA certificate bundle, invalid path: path/to/ca-bundle.crt

I tried a few things online that I found but I couldnt find any resolution until I noted the following stackoverflow which resolved the issue. I think there was another way to explicityly list trusted hosts now seeing the solution but this it was fixed it.

https://superuser.com/questions/727924/pip-and-ssl-certificate-errors

If pip complains about Certificate errors, then add some hosts to pip.ini.
Unfortunately Python 3.x on Win10 does not have any pip.ini file, so you have to create it manually from powershell/cmd with:

    mkdir C:\ProgramData\pip

    Create a file C:\ProgramData\pip\pip.ini with notepad:

      [global]
      trusted-host = pypi.org (new-line)
                     files.pythonhosted.org

Check it with pip config -v list. You should see this in the last line:

global.trusted-host='pypi.org\nfiles.pythonhosted.org'

The \n denotates a new-line that should be part of the trusted-host entry.

I wanted to share because it was a little frustrating when I have no idea what I am looking at when it comes to certificates/python :D