1

My Python3 project needs the QtSvg module (from PyQt5) on Python3. How can I (automatically) install the missing QtSvg using PyCharm into a venv, etc.?

I'm aware of the fact that there are OS distribution-specific packages on top of the base python3-pyqt5 which bring in QtSvg separately. However, I want to allow the users of my PyPI package (linuxns-rel) to simply install my package through pip3.

Is installing QtSvg for PyQt5 via PyCharms package management possible at all? I tried installing PyQt5 via PyCharms project package management to install it into a project-specific venv, but this always fails to bring in QtSvg.

Note: manually removing PyQt5 using the project-specific venv/bin/pip3 and then installing PyQt5 again using --no-cache-dir with the venv/bin/pip3 finally brings in a working PyQt5.

Were I am bitten by a broken PyQt5 package then? How do I correctly install a fully PyQt5 from within PyCharm into a venv?

TheDiveO
  • 2,183
  • 2
  • 19
  • 38
  • Yes, PyQt5 has been installed via pip3. `import PyQt5` works, but `import PyQt5.QtSvg` fails. – TheDiveO Aug 04 '18 at 15:28
  • PyQt is version 5.11.2 – TheDiveO Aug 04 '18 at 15:30
  • 1
    Yes, actually used `from PyQt5 import QtWidgets, QtSvg, QtCore` and this fails with `ImportError: cannot import name 'QtSvg'`. – TheDiveO Aug 04 '18 at 15:31
  • Hm, doesn't work on Kubuntu 18.04LTS using PyCharm 2018.2 and installing into a venv. Strange, as I tried a lot of things before posting my question. – TheDiveO Aug 04 '18 at 15:36
  • Yes, basic UIs work, only QtSvg fails. – TheDiveO Aug 04 '18 at 15:38
  • Argh, removed PyQt5 using venv pip3 in terminal session; then installed PyQt5 via venv pip3 again using --no-cache-dir just in case ... and now it works. So this is some caching/PyCharm/pip3 installation hiccup. – TheDiveO Aug 04 '18 at 15:41
  • the problem is pycharm then, it is not venv, if you want help share the configuration you have in pycharm – eyllanesc Aug 04 '18 at 15:42
  • How is PyCharm not venv when I created a venv project-specific interpreter and I've now used the venv that I created in PyCharm? Where's the gotcha, as this would be really good to know? – TheDiveO Aug 04 '18 at 15:43
  • 1
    I recommend you edit your question and point out that the problem is PyCharm also changing the tags – eyllanesc Aug 04 '18 at 15:45

0 Answers0