I am trying to install some software (pulp) with Ansible. The actual installer comes in an Ansible collection, which in turn depends on a downloaded role (geerlingguy.postgresql).
The role is installed, and I can access it from one of my own playbooks. But when the tasks in the pulp.pulp_installer try to access the geerlingguy.postgresql role, they can't find it.
I followed the instructions on the Pulp Web site, which says to install the geerlingguy.postgresql role just like any other role with
ansible-galaxy install geerlingguy.postgresql
Specifically, when I try to run the installer, I get this error message:
ERROR! the role 'geerlingguy.postgresql' was not found in pulp.pulp_installer:ansible.builtin
The error appears to be in '/home/kkeane/.ansible/collections/ansible_collections/pulp/pulp_installer/roles/pulp_database/tasks/install_postgres.yml': line 130, column 15, but may
be elsewhere in the file depending on the exact syntax problem.
I installed the geerlingguy.postgresql role into the standard ~/.ansible location:
tree -L 3 ~/.ansible/
/home/kkeane/.ansible/
├── collections
│ └── ansible_collections
│ ├── ansible
│ ├── community
│ └── pulp
├── cp
├── galaxy_token
├── roles
│ └── geerlingguy.postgresql
│ ├── LICENSE
│ ├── README.md
│ ├── defaults
│ ├── handlers
│ ├── meta
│ ├── molecule
│ ├── tasks
│ ├── templates
│ └── vars
└── tmp
I can also access the role directly from one of my own playbooks.
The error message suggests that Ansible is only looking inside the pulp.pulp_installer and ansible.builtin collections, instead of using my full role path.
Do collections in fact use a different role path? If so, how do I get it to find the geerlingguy.postgresql role?
It appears that this was due to a bug in the specific version of Ansible that I used (2.9.6). Based on comparing the source code, version 2.9.19 seems to have this issue fixed. Unfortunately, on my version of Ubuntu (20.04), the latest version of Ansible is 2.9.6, and even the Ansible ppa does not have a newer version of the 2.9 series.
So I had to update to Ansible 2.10. That process is as follows. Note that you must use the package name ansible-base; if you install the package ansible, you will just reinstall the broken version.
Keep in mind that upgrading to 2.10 may have other side effects; there were substantial changes to Ansible between 2.9 and 2.10.
apt remove --purge --auto-remove ansible
add-apt-repository ppa:ansible/ansible
apt-get update
apt install ansible-base
Edit: there may be a possibility to install 2.9.19 on Ubuntu, after all, using pip instead of apt.
I started using direnv recently.
I created a .envrc file in my project’s root directory.
There is only one line in .envrc:
export GOPATH=$(pwd)
I use vim with coc & gopls to write go, but when I open main.go coc shows this error
Error [compiler] could not import os (no package for import os)
This is my project structure
.
├── .envrc
├── bin -> /root/go/bin
├── out
├── pkg -> /root/go/pkg
└── src
├── github.com -> /root/go/src/github.com
├── golang.org -> /root/go/src/golang.org
└── monkey
├── lexer
│ ├── lexer.go
│ └── lexer_test.go
├── main.go
├── out
├── repl
│ └── repl.go
└── token
└── token.go
I am using go version go1.10.3 darwin/amd64 with glide version v0.13.1
Project is located at /Users/robopuff/Development/GoRethink and it's tree looks like this:
.
├── glide.lock
├── glide.yaml
├── main.go
├── rethinkdb_data
│ ├── 001fbc34-bd63-445f-8590-709ac7475294
│ ├── log_file
│ ├── metadata
│ └── tmp
└── vendor
├── github.com
│ ├── cenkalti
│ │ └── backoff
│ ├── golang
│ │ └── protobuf
│ ├── hailocab
│ │ └── go-hostpool
│ ├── opentracing
│ │ └── opentracing-go
│ └── sirupsen
│ └── logrus
├── golang.org
│ └── x
│ ├── crypto
│ ├── net
│ └── sys
└── gopkg.in
├── fatih
│ └── pool.v2
└── gorethink
└── gorethink.v4
After running go run main.go I am welcomed with an error
❯ go run main.go
main.go:7:2: cannot find package "gopkg.in/gorethink/gorethink.v4" in any of:
/usr/local/go/src/gopkg.in/gorethink/gorethink.v4 (from $GOROOT)
/Users/robopuff/go/src/gopkg.in/gorethink/gorethink.v4 (from $GOPATH)
Shouldn't go compiler first of all look at vendor?
The proper answer for that one is to read through Docs, especially Workspaces and understand it.
I am running the test scripts for my app and I am getting the following error.
Xamarin.UITest.dll version (1.3.8.0) and test-cloud.exe version (1.0.0.0) are incompatible
Any advise ?
There is a matching version test-cloud.exe within each Xamarin.UITest.XXXXX Nuget package and that is the .exe that you should use to run your tests with.
Example:
/packages/Xamarin.UITest.1.3.8.1491-dev
.
├── Xamarin.UITest-License.rtf
├── Xamarin.UITest.1.3.8.1491-dev.nupkg
├── lib
│ ├── Xamarin.UITest.dll
│ └── Xamarin.UITest.xml
└── tools
└── test-cloud.exe
/packages/Xamarin.UITest.1.3.8
.
├── Xamarin.UITest-License.rtf
├── Xamarin.UITest.1.3.8.nupkg
├── lib
│ ├── Xamarin.UITest.dll
│ └── Xamarin.UITest.xml
└── tools
└── test-cloud.exe
I observed one thing.
The package folder for my solution has Xamarin.UITest of 1.0.0.0 and my UITest project had 1.3.8 version. Can you tell me that how to push it to github ?
I think I did everything I could in the last 20 hours, but nothing seems to work. My app is running and working -- just as it should -- the only problem I have is that I cannot create a .app bundle from it. I tried both Py2App and cx_Freeze but non of them is working. Because of the multi-platform support I would stick with the latter -- if possible.
The setup.py looks like this:
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
OPTIONS = {'build_exe': {'includes': ['sip',
'PyQt5',
'PyQt5.QtCore',
'PyQt5.QtGui',
'PyQt5.QtWidgets',
'PyQt5.QtMultimediaWidgets',
'PyQt5.QtMultimedia',
'PyQt5.QtNetwork']}}
EXECUTABLES = [Executable('main.py', base=base)]
NAME = 'coublet'
VERSION = '0.5.70'
setup(name = NAME,
version = VERSION,
options = OPTIONS,
executables = EXECUTABLES)
The error message I have is this:
objc[28404]: Class NotificationReceiver is implemented in both
/Users/.../build/coublet-0.5.70.app/Contents/MacOS/QtWidgets and
/usr/local/Cellar/qt5/5.3.1/lib/QtWidgets.framework/Versions/5/QtWidgets. One of
the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7fc4b96e98b0) is not the object's thread
(0x7fc4b95dbc80).
Cannot move to target thread (0x7fc4b96e98b0)
On Mac OS X, you might be loading two sets of Qt binaries into the same process.
Check that all plugins are compiled against the right Qt binaries. Export
DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
This application failed to start because it could not find or load the Qt
platform plugin "cocoa".
Available platform plugins are: cocoa, minimal, offscreen.
Reinstalling the application may fix this problem.
Abort trap: 6
My system Info:
Mac OS X : 10.9.4
Python : 3.4.1
cx_Freeze : 0.9
PyQt5: : 5.3.1
- - -
Packages installed via: Homebrew and PIP
.app structure:
build/coublet-0.5.70.app
└── Contents
├── Frameworks
├── Info.plist
├── MacOS
│ ├── PyQt5.QtCore.so
│ ├── PyQt5.QtGui.so
│ ├── PyQt5.QtMultimedia.so
│ ├── PyQt5.QtMultimediaWidgets.so
│ ├── PyQt5.QtNetwork.so
│ ├── PyQt5.QtWidgets.so
│ ├── Python
│ ├── QtCore
│ ├── QtCore.so
│ ├── QtGui
│ ├── QtGui.so
│ ├── QtMultimedia
│ ├── QtMultimedia.so
│ ├── QtMultimediaWidgets
│ ├── QtMultimediaWidgets.so
│ ├── QtNetwork
│ ├── QtNetwork.so
│ ├── QtOpenGL
│ ├── QtWidgets
│ ├── QtWidgets.so
│ ├── _bisect.so
│ ├── _bz2.so
│ ├── _codecs_cn.so
│ ├── _codecs_hk.so
│ ├── _codecs_iso2022.so
│ ├── _codecs_jp.so
│ ├── _codecs_kr.so
│ ├── _codecs_tw.so
│ ├── _datetime.so
│ ├── _hashlib.so
│ ├── _heapq.so
│ ├── _json.so
│ ├── _lzma.so
│ ├── _md5.so
│ ├── _multibytecodec.so
│ ├── _opcode.so
│ ├── _pickle.so
│ ├── _posixsubprocess.so
│ ├── _random.so
│ ├── _scproxy.so
│ ├── _sha1.so
│ ├── _sha256.so
│ ├── _sha512.so
│ ├── _socket.so
│ ├── _ssl.so
│ ├── _struct.so
│ ├── array.so
│ ├── binascii.so
│ ├── grp.so
│ ├── imageformats
│ │ ├── libqdds.dylib
│ │ ├── libqgif.dylib
│ │ ├── libqicns.dylib
│ │ ├── libqico.dylib
│ │ ├── libqjp2.dylib
│ │ ├── libqjpeg.dylib
│ │ ├── libqmng.dylib
│ │ ├── libqsvg.dylib
│ │ ├── libqtga.dylib
│ │ ├── libqtiff.dylib
│ │ ├── libqwbmp.dylib
│ │ └── libqwebp.dylib
│ ├── libcrypto.1.0.0.dylib
│ ├── liblzma.5.dylib
│ ├── library.zip
│ ├── libreadline.6.dylib
│ ├── libssl.1.0.0.dylib
│ ├── main
│ ├── math.so
│ ├── platforms
│ │ ├── libqcocoa.dylib
│ │ ├── libqminimal.dylib
│ │ └── libqoffscreen.dylib
│ ├── pyexpat.so
│ ├── readline.so
│ ├── select.so
│ ├── sip.so
│ ├── termios.so
│ ├── time.so
│ ├── unicodedata.so
│ └── zlib.so
└── Resources
The question is I think pretty obvious: what am I doing wrong? (or what am I not doing?)
When building an app with cx_Freeze on MacOSX all dependent libraries (.so files on MacOSX) are packaged into the application bundle. It is this that makes the application portable to other systems, without requiring a second install of Qt.
When launching the Application, the libraries should therefore be loaded from within the bundle. However, in your case the system libraries are still being loaded:
/Users/.../build/coublet-0.5.70.app/Contents/MacOS/QtWidgets
/usr/local/Cellar/qt5/5.3.1/lib/QtWidgets.framework/Versions/5/QtWidgets
The result One of the two will be used. Which one is undefined. means that either of these could be loaded. If it picks the correct one, great! If it doesn't you've got two separate sets of libraries loading simultaneously, and that fails shortly afterwards. As an aside, you may find that if you try your Application on another system it will work fine! Sometimes.
For an overview of the problem I suggest taking a look at the following bug #33.
Before you begin
Make sure you have an up-to-date version of cx_Freeze installed. I would suggest trying to clone the repository and installing from there.
Secondly, ensure that the Qt plugins are being correctly built into your application. Cx_Freeze previously looked for the qt-menu.nib file to determine if it was building a Qt application. This is no longer available in Qt5, but you can pass it on the command-line when building your app. Set it to whatever you want, it really doesn't matter:
python setup.py bdist_mac --qt-menu-nib=/usr/local/Cellar/qt5/5.3.1/plugins/platforms/
This may be enough to fix your problem. But if not, you have two options:
Option 1
Each library file contains the paths to it's dependencies. If you're receiving this error, it means some of those paths are either a) still pointing to the original file, or b) not specific enough (and being found on your PATH or DYLD_LIBRARY_PATH). However, you can re-write paths using install_name_tool from the command line (as described here:
install_name_tool -change /usr/local/Cellar/qt5/5.3.1/lib/QtWidgets.framework/Versions/5/QtWidgets #executable_path/QtWidgets build/MyApp.app/Contents/MacOS/qt_plugins/platforms/libqcocoa.dylib
install_name_tool -change /usr/local/Cellar/qt5/5.3.1/lib/QtCore.framework/Versions/5/QtCore #executable_path/QtCore build/MyApp.app/Contents/MacOS/qt_plugins/platforms/libqcocoa.dylib
install_name_tool -change /usr/local/Cellar/qt5/5.3.1/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport #executable_path/QtPrintSupport build/MyApp.app/Contents/MacOS/qt_plugins/platforms/libqcocoa.dylib
install_name_tool -change /usr/local/Cellar/qt5/5.3.1/lib/QtGui.framework/Versions/5/QtGui #executable_path/QtGui build/MyApp.app/Contents/MacOS/qt_plugins/platforms/libqcocoa.dylib
This rewrites the paths in the libraries to point into your application folder, using #executable_path as the base. You will need to do this for all the paths that you find loading incorrectly. I'd suggest wrapping it up into an script, to run automatically after the build.
If you want to look at which libraries a file is referencing you can use otool. For example, in a successfully built application of mine:
otool -L libqcocoa.dylib
libqcocoa.dylib:
#executable_path/../Resources/qt_plugins/platforms/libqcocoa.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 20.0.0)
...
There was an updated workaround in the issue tracker that suggests that just importing the correct module in your app will get it to function, however it seems unlikely that you've made an application without QtWidgets.
Option 2
If the above doesn't work, there is another approach outlined here. This is a bit of a sledgehammer approach in that it simply prevents loading of plugins at all.
Add a qt.conf file next to the executable (in the .app bundle that contains:
[Paths]
Plugins = '.'
Either set the environment variable QT_PLUGIN_PATH="" (you can do this within your application before importing PyQt. Or call QtGui.QApplication.setLibraryPaths([]) before creating your application object.
The result is no plugins, so your application will not have access to the MacOSX Cocoa style and UI (e.g. file, colour dialogs).
Use this command :
pip install opencv-python-headless
It resolved the same issue in my case.
This is in addition to #mfitzp's answer.
This QT Plugins Document came in handy.
To look for default locations that your QT app is trying to search you can use following command:
$sudo dtruss MacOS/ncher
getattrlist("/ncher.app\0", 0x7FFF954B51A4, 0x7FFF5C8FDD20) = 0 0
getattrlist("/ncher.app/Contents\0", 0x7FFF954B51A4, 0x7FFF5C8FDD20) = 0 0
getattrlist("/ncher.app/Contents/MacOS\0", 0x7FFF954B51A4, 0x7FFF5C8FDD20) = 0 0
stat64("/ncher.app/Contents/MacOS\0", 0x7FFF5C8FDED8, 0x7FFF5C8FDD20) = 0 0
stat64("/ncher.app/Contents/MacOS/platforms/.\0", 0x7FFF5C8FDF58, 0x7FFF5C8FDD20) = -1 Err#2
open("/dev/tty\0", 0x1000000, 0x1FF) = 5 0
fcntl(0x5, 0x2, 0x1) = 0 0
close(0x5) = 0 0
write_nocancel(0x2, "This application failed to start because it could not find or load the Qt platform plugin \"cocoa\".\n\nReinstalling the application may fix this problem.\n\0", 0x97) = 151 0
sigprocmask(0x3, 0x7FFF5C8FE6B4, 0x0) = 0x0 0
__pthread_sigmask(0x3, 0x7FFF5C8FE6C0, 0x0) = 0 0
__pthread_kill(0x603, 0x6, 0x0) = 0 0
kevent64(0x4, 0x0, 0x0) = -1 Err#4
You can see this QT app trying to look into MacOS/platforms, once i copied my libqcocoa.dylib plugin (its path were modified by install_name_tool command as per #mfitzp's answer) there, my application worked like charm.
BTW it is advisable by MAC codesigning guide to have this directory structure correctly setup, DONT put Frameworks, plugins in ncher.app/Contents/MacOS directory
I had this problem in the context of just starting a Qt Widgets app from Qt Creator.
What helped me was to set the variable QT_PLUGIN_PATH to the value <Qt-dir>/plugins (where <Qt-dir> is the absolute path to the folder in the Qt directory containing, among others, bin, doc, include, lib and of course plugins).
This probably did not fix the root cause of the problem but it was a quick fix that's working fine so far.