'PyCharm doesn't recognized existing packages. (no error but drive me crazy)
I am using MacBook Pro with M1 processor, and when using PyCharm it has a weird behavior: PyCharm doesn't recognize packages (installed with Conda) and marks them with a red underline, but when running the code it executes just fine.
an example of what my screen looks like after running simple code with numpy and pytorch
so far it doesn't seem to cause any code errors, but I feel it should not behave this way, and it gives me the heebie-jeebies.
Solution 1:[1]
found the solution:
Initially I set the environment only in the run configuration. to make sure PyCharm use the same environment for the IDE, it has to be set in: PyCharm > Preferences > Project: project name > Python Interpreter
Solution 2:[2]
goto: File > Settings > Interpreter
click on this:

then choose Add
then:

then choose the location of python binary and click ok
finally: Apply && Ok

Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nadav Nissim |
| Solution 2 | ibrahem |
