How does PyCharm manage the PYTHONPATH when using Anaconda? Unable to find PySide2-related DLLs

110 views Asked by At

I am extremely confused as to how PyCharm manages the path. I have failed to setup PySide2 both using conda and pip.

When installed with conda I get that the shiboken2 DLL is missing. After a downgrade of PySide2 to a previous minor version it worked...Until I started PyCharm again.

When installed with pip I get that none of the PySide2 modules' DLLs can be found - QtGui, QtCore, QtWidgets etc.

I have verified the following:

  • The interpreter used by my PyCharm project is set to the one from my Anaconda virtual environment
  • The <virtual-environment>/Lib/site-packages is in the path for that interpreter (added by default)
  • The DLLs are actually on the filesystem - the DLLs are clearly located in Windows Explorer -> User files -> Anaconda3 -> envs -> -> Lib -> site-packages -> PySide2 -> ...
  • The sys.path outputs the correct PYTHONPATH
  • The run configuration points at the correct interpreter

I don't know where the shiboken2 stuff is located so let's concentrate on the pip installation.

I printed the path

import sys
print(sys.path)

and it matches.


UPDATE: Fixed the issue by installing PySide2 using conda and shiboken2 using pip with the version matching the one from conda (since pip has a more up-to-date version).

However this still doesn't answer my question. Even with PySide2 now working, I get problems in the PyCharm log regarding ALL imports like

from PySide2.QtWidgets import QPushButton
from PySide2.QtCore import QDir
...

This indicates a path problem...again.

0

There are 0 answers