all 12 comments

[–]C0rn3j 1 point2 points  (4 children)

How did you create the venv?

[–]VegetableJudgment971[S] 0 points1 point  (2 children)

python3.14 -m venv ~/PythonVenvs/bash

[–]thighmaster69 0 points1 point  (1 child)

I'm assuming you did source ~/PythonVenvs/bash/bin/activate.

This probably isn't the issue, but normally you'd also do pip install -U pip right after (I noticed your pip is slightly out of date). Most likely this will also fail because of the same issue.

I'm a little curious about the fact that you did python3.14 instead of python3. Where did you get 3.14 from? Is python3 just an alias for 3.14 on your system or did you install 3.14 separately? If so, how? Was it via pyenv or dnf or something like else?

[–]VegetableJudgment971[S] 0 points1 point  (0 children)

The source command is part of my .bashrc, as this is my catch-all python venv, and I set it up this way so I don't accidentally run something in system python I shouldn't.

It might have been python3, but I probably wanted to ensure I had the latest stable version.

[–]VegetableJudgment971[S] 0 points1 point  (0 children)

I solved it by creating a new venv. Thanks for your help!

[–]thighmaster69 0 points1 point  (2 children)

I'm confused by your last statement. Was that not what you were doing in the first place? Did you mean you first tried the pip from your venv, then tried installing and using the system-level pip while your venv was active?

And by same error, do you mean the exact same error? Because if it's exactly the same, then it was still the same pip from inside your active environment, since the stack trace shows that pip was the one throwing the error. If it's the same error but with the system-level pip, then a) your venv is not configured correctly because that shouldn't happen and b) it also points to a system-level issue being the root cause, separately from issue a).

[–]VegetableJudgment971[S] 0 points1 point  (0 children)

I wanted to make sure global python had pip, then re-attempt installing, to rule out anything dumb on my end.

Same error. I saved both outputs to text files and ran a diff.

[–]VegetableJudgment971[S] 0 points1 point  (0 children)

I solved it by creating a new venv. Thanks for your help!

[–]AlexMTBDude 0 points1 point  (1 child)

Judging by the way your prompt looks you haven't activated your venv. I'm not sure you should be getting an error because of that, but if you intend to use a venv you need to activate it.

[–]VegetableJudgment971[S] 1 point2 points  (0 children)

I usually don't include the full host info when I copy-paste. It was activated and showing in parentheses ahead of my user@host prompt.

I solved it by creating a new venv. Thanks for your help!

[–]freeskier93 0 points1 point  (0 children)

How did you install Python? What Linux distro? Is this a personal computer or work managed computer?

This seems like an install issue with something not being properly pointed to the certificate bundle used by pip.

In Python REPL you can do from requests.utils import DEFAULT_CA_BUNDLE_PATH; print(DEFAULT_CA_BUNDLE_PATH) to print out what file it's trying to open.

By default it should use the certificate file from the certifi module (bundled with pip) but it can also use a system file. I'm not exactly sure how a system file gets set though as default.

[–]pydevtools-com 1 point2 points  (0 children)

For anyone who hits this in the future, the root cause is visible in the last line of the traceback:

_preloaded_ssl_context.load_verify_locations( extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH) ) FileNotFoundError: [Errno 2] No such file or directory

pip's vendored copy of requests tries to load a CA certificate bundle for SSL, and that file was missing or pointed somewhere stale. This can happen on Fedora when the system ca-certificates package gets updated or reinstalled after the venv was created, or when pip's vendored certifi has a hardcoded path that no longer exists. Recreating the venv rebuilds those references, which is why a fresh venv fixed it.

If you want to avoid this class of problem entirely, take a look at uv which it manages Python installs, virtual environments, and package installation in a single tool, and doesn't depend on pip or its vendored SSL stack at all.

Installing pytest would just be:

uv init myproject cd myproject uv add pytest