How can I resolve the error: module "QtCharts" is not installed?
-
I tried to run the following code, but I got the error: module "QtCharts" is not installed.
import QtQuick 2.15 import QtCharts 2.15 Rectangle { id: root width: 1392 * scaleFactor height: 436 * scaleFactor color: theme.item.color7 ChartView { title: "Line Chart" anchors.fill: parent antialiasing: true LineSeries { name: "Line" XYPoint { x: 0; y: 0 } XYPoint { x: 1.1; y: 2.1 } XYPoint { x: 1.9; y: 3.3 } XYPoint { x: 2.1; y: 2.1 } XYPoint { x: 2.9; y: 4.9 } XYPoint { x: 3.4; y: 3.0 } XYPoint { x: 4.1; y: 3.3 } } } }
I have confirmed the following:
- The Qt Charts module is installed for my current Qt version, and other modules located in the same path are working fine.
- I have added QT += charts in my .pro file.
Any help would be greatly appreciated! Thank you. :)
-
@SGaist
Hi,thank you so much for your warm reply!Yes, I did re-run qmake after -- I also double-checked that the .exe file has the latest modified timestamp.
Additionally, I tried uninstalling and reinstalling the Qt Charts module.
Unfortunately, the issue still persists.If you have any other ideas, I'd be truly grateful -- and honestly, your reply already made my day. :-)
@daddyKiko57 As a quick sanity check: Are you able to run the official Qt Charts examples?
If the official examples work but your app doesn't, set the environment variables
QML_IMPORT_TRACE=1
andQT_DEBUG_PLUGINS=1
before running your app from Qt Creator. What do you see in the Application Output pane? -
Hi and welcome to devnet,
Did you re-run qmake after adding the charts module ?
-
@SGaist
Hi,thank you so much for your warm reply!Yes, I did re-run qmake after -- I also double-checked that the .exe file has the latest modified timestamp.
Additionally, I tried uninstalling and reinstalling the Qt Charts module.
Unfortunately, the issue still persists.If you have any other ideas, I'd be truly grateful -- and honestly, your reply already made my day. :-)
-
@SGaist
Hi,thank you so much for your warm reply!Yes, I did re-run qmake after -- I also double-checked that the .exe file has the latest modified timestamp.
Additionally, I tried uninstalling and reinstalling the Qt Charts module.
Unfortunately, the issue still persists.If you have any other ideas, I'd be truly grateful -- and honestly, your reply already made my day. :-)
@daddyKiko57 As a quick sanity check: Are you able to run the official Qt Charts examples?
If the official examples work but your app doesn't, set the environment variables
QML_IMPORT_TRACE=1
andQT_DEBUG_PLUGINS=1
before running your app from Qt Creator. What do you see in the Application Output pane? -
@daddyKiko57 As a quick sanity check: Are you able to run the official Qt Charts examples?
If the official examples work but your app doesn't, set the environment variables
QML_IMPORT_TRACE=1
andQT_DEBUG_PLUGINS=1
before running your app from Qt Creator. What do you see in the Application Output pane?@JKSH
Thank a lot for your concise reply—it really solved my problem! :)Although I didn’t set the QML_IMPORT_PATH, I had bundled all dependencies into the .../target/debug folder for debugging convenience. Qt then loaded QML modules from there by default, but since QtCharts was missing, a runtime error occurred.
After deleting everything except third-party libraries in the folder and rebuilding, Qt now loads modules from the installation directory, and everything works fine.
Your explanation gave me a much clearer picture of how Qt handles QML module loading, especially the fallback behavior—I am truly grateful!
-
-
@daddyKiko57 As a quick sanity check: Are you able to run the official Qt Charts examples?
If the official examples work but your app doesn't, set the environment variables
QML_IMPORT_TRACE=1
andQT_DEBUG_PLUGINS=1
before running your app from Qt Creator. What do you see in the Application Output pane?This post is deleted!