Qt5 QML module is not installed

qml module is not installed qmlregistertype
qml module not found
qml2_import_path
module "qtquick" is not installed
qqmlapplicationengine failed to load component
module not installed terraform
qmldir
qt list installed modules

I'm confused about modules in Qt QML. I've read all the docs, but it doesn't make clear some basic ideas.

I understand that i can put a bunch of QML files into a directory and add a qmldir file to describe an identified module. When i do this and adjust the QML_IMPORT_PATH, QtCreator is happy and stops underlining the import ModuleName 1.0 line.

So creator is happy, but it does not work. I get module is not installed. my questions are:

  • what does it mean by "installed". I have directory of files, but i haven't "installed" them anywhere.
  • should i be building/compiling the module to make a DLL/.so ?
  • does the module QML files go into the resources of the main app, otherwise where are they to be found?
  • my main.qml file is part of the app resources, how does the app locate the resources of the module at runtime.

Sorry, for all these questions, but the basics of these modules is just not clear. I don't understand if a "module" is just the sharing of files or is it a compiled unit.

thanks for any help.

Module not installed, with entries for every QML module. It used to work fine before (I restored the element folder with qmldir and all the .qml files from a recent  Qt5 QML module is not installed. zzwdkxx 2019-06-13 22:53:31 1248

In my case (I have all QML files in qrc resources) worked to add qmldir to resources also and call method addImportPath("qrc:/") of QQmlApplicationEngine.

My main.cpp looks like:

QQmlApplicationEngine engine;
engine.addImportPath("qrc:/");
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

Important parts of my .pro file looks like:

RESOURCES += qml.qrc \
    MyModule/mymodule.qrc

QML_IMPORT_PATH += $$PWD

My qmldir:

module MyModule

MyItem          2.0 MyItem20.qml
MyItem          2.1 MyItem21.qml

My qrc:

<RCC>
    <qresource prefix="/MyModule">
        <file>MyItem20.qml</file>
        <file>MyItem21.qml</file>
        <file>qmldir</file>
    </qresource>
</RCC>

And finally my main.qml:

import QtQuick 2.5
import QtQuick.Window 2.2

import MyModule 2.0

Window {
    visible: true
    width: 640
    height: 480

    MyItem {
        anchors.fill: parent
    }
}

QtCreator is happy (not underlining components and imports) and module is loaded. Hope this helps.

Identified Modules, Identified modules are modules that are installed and identifiable to the QML engine modules to be imported with a unique identifier that remains the same no  Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

I want to expand on arxarian's answer - which I think is the best technique for integrating modules - but couldn't fit those thoughts in a comment, so here's a new answer.

It's important to first understand that qml modules and their associated resources are runtime entities and are assumed to separately exist at some location relative to the executable unless they're included in the application resources. By including them in the resources, they are still runtime entities, but they exist under the qrc:/ root path within the application binary. This hiding of the modules is the primary reason why I think this is the best technique, unless you want your modules to be open to revision after deployment, or to be independently deployable as precompiled plugins (i.e., in the resource storage of a dynamically linked library).

So here's my explanation of the important elements of arxarian's answer:

  1. engine.addImportPath("qrc:/"); is needed in the C++ code prior to loading the qml to instruct the engine to look for qml modules in the application resource storage.
  2. RESOURCES += MyModule/mymodule.qrc is needed in the project (.pro) file to add the module's files to the application resource storage.
  3. QML_IMPORT_PATH += $$PWD in the project file tells Qt Creator to look for the module starting from the root of the project source tree. In my case I had to set this to a subdirectory (e.g., "ui/modules") because my module directories started there. The import path should include the root(s) beneath all module directories. As far as I can tell, this instruction is only for the Qt Creator IDE and does not impact the build - that's why #1 is needed.
  4. The contents of the qmldir file is as is standard for all qml modules, but it's inclusion in the module's .qrc resource file is not intuitive until you think about what's happening with runtime storage. It needs to be in the .qrc so that it is included in the application resource storage, so that the engine can find it at runtime to define the module. <qresource prefix="/MyModule"> in the module's .qrc file defines the module subdirectory relative to the qrc:/ root in the application resource storage.
  5. The import MyModule <version> statement in qml is now setup for success. On startup the engine will have located the module in its directory under qrc:/, parsed the qmldir file there to define the module and established the name and version from those entries.

Hopefully this helps others understand what's going on, and please let me know if I've misunderstood anything.

QT Creator 4.7.0 (Qt 5.11.1) C++ module is not installed error, It got the module is not installed error all the time, even I tried several tricks from main.qml import QtQuick 2.7 import QtQuick.Controls 2.0 Dependencies for QML in Raspbian are somewhat confusing. Try checking if you have these packages installed, using apt-get install, or apt-cache search first to see what every single package does: qtdeclarative5-* qml-module-qtquick* qtquick1-* qtquickcontrols5-* qml-module-qtquick2 After that, Qt Creator should compile without problems.

A similar issue cost me a bit of time so I just post it here to perhaps save the next guy some effort.

My problem was that an invisible character had sneaked into the module name. Probably through copy and paste. Here my issue:

Example error output:

MyEngine failed to load component
qrc:/qml/main.qml:53 Type MyComponent unavailable
file:///Users/<pathToProject>/MyProject/qml/MyModule/MyComponent.qml:-1 No such file or directory

It all looks fine and the path displayed is indeed the correct one. So what is wrong?

Now, copy that path to a Terminal window:

file:///Users/<pathToProject>/MyProject/qml/MyModule/<feff>MyComponent.qml

There it is, the:

"<feff>"

Solved the issue by manually retyping the component name in the qmldir file, and thus effectively deleting the invisible character.

qml-module-qtquick-controls_5.5.1-1ubuntu1_amd64.deb 16.04 , qml-module-qtquick-controls - Qt 5 Quick Controls QML module Installed size, 2.76 MB. Category, libs sudo apt-get install qml-module-qtquick-controls  Identified modules are modules that are installed and identifiable to the QML engine by a URI in the form of a dotted identifier string, which should be specified by the module in its qmldir file. This enables such modules to be imported with a unique identifier that remains the same no matter where the module is located on the local file system.

I had the same problem and have now fixed it. I found a QML plugin for iOS. There are several things that need to be taken care of:

1. The plugin pro file needs an addition:

uri = IosTestPulgin

# this for error:
# static plugin for module "QtQuick" with name "IosTestPulgin" 
# has no metadata URI
QMAKE_MOC_OPTIONS += -Muri=$$uri

# thanks from:https://github.com/wang-bin/QtAV/issues/368

2. The QML plugin qmldir file needs an additional line like this:

classname IosqmlpluginPlugin
# for ERROR: Plugin iostestqmlplugin is missing a classname entry,
# please add one to the qmldir file.
# look for qt document http://doc.qt.io/qt-5.6/qtqml-modules-qmldir.html

3 The client project pro file needs an addition like this:

ios {
    IOSTestPlugin_BUNDLE.files += $$files($$[QT_INSTALL_QML]/IosTestPulgin/qmldir)
    IOSTestPlugin_BUNDLE.path =  IosTestPulgin
    QMAKE_BUNDLE_DATA += IOSTestPlugin_BUNDLE
}
# for ios error: module is not installed
# this means external qml static plugin must add the plugin dir by manual
# in the app root dir

Catkin/CMake Bundling for Snapcraft "Qrc module is not installed , I'm working on bundling a ROS + Qt5 application into a snap - and can't Window" is not installed qrc:/main_window.qml:4 module "Ros" is not  The directory can then be installed into the QML import path as a module. Note that defining a module is not the only way to share common QML types within a project - a simple QML document directory import may also be used for this purpose. Supported QML Module Types. There are two different types of modules supported by QML: Identified Modules

kde - QtLocation and QtPositioning not installed, qtpositioning5-dev for /usr/include/x86_64-linux-gnu/qt5/QtPositioning/​QtPositioning. Install them along with QML bindings with sudo apt install  Legacy modules are modules whose specification qmldir file does not contain a module identifier directive. A legacy module may be either installed into the QML import path (as an installed legacy module) or imported by clients with a relative import (as a located legacy module).

Qml module is not installed, Models” is not installed. I searched on the internet but noting more than what I've already done comes up. Qt 5 Qt Quick 2 QML module. Previously registered  Except the testing modules, which will remain source compatible, these modules will remain source and binary compatible throughout Qt 5. Essential modules are general and useful for a majority of Qt applications. A module that is used for a special purpose is considered an add-on module even if it is available on all supported platforms.

QML module not found. Error importing Marble in QML • KDE , I go to qml install path and indeed there is a folder for /usr/lib/x86_64-linux-gnu/​qt5/qml/org/kde/marble but there is no qmldir here neither other  On a fresh Lubuntu 13.04 installation, I installed Qt5 from the official ubuntu repositories. But this installation of Qt5 can't find the QtQuick module. What am I missing? qmlscene test.qml test

Comments
  • For me, the "module ... is not installed" error was entirely fixed by one sub-topic of this answer: stackoverflow.com/a/49326965/10278 -- I forgot the <file> entry for qmldir inside the qrc file.
  • Thanks for explaining, but I'm still mostly in the dark. I've figured out that if i set addImportPath to an absolute path, it works. But i want the QML referenced to be local to the project. relative paths fail because they don't work from the resultant build directory. I've also figured out how to compile the module + its resources to a DLL. But i've no idea how to load this DLL. arranging it to be in the import path doesn't work because, i think the DLL needs a qmldir. The DLL will register the types inside it, but that would involve loading it first. sort of chicken & egg??
  • Just provide the qmldir for the DLL plugin, it is about 3 lines long, put qmldir next to your plugin, put this all in a folder with the proper name, as I stated in the answer, and put the folder next to an executable. This should work. Have you tried that?
  • Thank you. After a long road and much searching, this helps a lot!
  • <qresource prefix="/MyModule"> i think this part is most important!
  • your remark that "qmldir file's inclusion in the module's .qrc resource file is not intuitive" led me to my mistake! I've been debugging "module xyz is not installed" for way too long, and that was my silly mistake: i forgot to list the qmldir file in my qrc. THANK YOU!