open a new terminal and follow these (use “python” and “pip” if “python3” and “pip3” does not work):
- create a test folder and cd into it:
mkdir test && cd test
- create clean environment
python3 -m venv .venv
(do MacOS use python or python3 for v3.x? ) - and activate it:
.venv/Scripts/activate
- install pymongo only :
pip3 install pymongo
- you should see this clean list:
pip3 list
(versions might change)Package Version
dnspython 2.3.0
pip 22.2.2
pymongo 4.3.3
setuptools 63.2.0 - and start python repl:
python3
- copy-paste your code above (replace password) and run in the repl.
if your code works this way, then the installation pycharm uses might be broken and need a repair or full reinstllation. (or pycharm is broken)
if not, then either your system has a problem or you messed with some settings in Atlas (I can’t point any).