On my system, ‘requests’ is found here:
/usr/lib/python3.10/site-packages/requests/
/usr/lib/python3.10/site-packages/jedi/third_party/typeshed/third_party/2and3/requests/
/usr/lib/python3.10/site-packages/jedi/third_party/django-stubs/django-stubs/contrib/sites/requests.pyi
The first line is the one that should be available everywhere.
(I didn’t knowingly install anything that pulls in ‘jedi’, so it might be part of the OS.)
Compare your sys.path results below, and you’ll notice that
when you’re working in ‘PycharmProjects’,
there’s no access to system python’s site-packages.
“PycharmProjects/Learn Python/The Great Beans”
seems to be like a virtual env that does not include system site-packages.
So even when ‘requests’ is properly installed in system site-packages,
you can’t import it while you’re in “The Great Beans”.
You would have to install ‘requests’ within that environment.
Does PyCharm have a way to do that?
(If not, maybe the way is ‘pip install --user’ within that env.)
sys.path
system python:
['',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/home/loganh/.local/lib/python3.10/site-packages',
'/usr/lib/python3.10/site-packages']
pycharm:
['/home/loganh/PycharmProjects/The Great Beans',
'/home/loganh/PycharmProjects/The Great Beans',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/home/loganh/PycharmProjects/Learn Python/The Great Beans/lib/python3.10/site-packages']
The other problems flow from the fact that you didn’t know the above point,
and tried re-installing system-level ‘requests’ instead.
attempted reinstalling requests … doesn’t seem to want to work anyway.
If you meant only “doesn’t seem to want to work in PyCharm”,
then the info above probably solves that problem…