Using npm list will show a tree of installed packages, versions and relations:
Although Julia package management is differ (e.g normally no duplicate copy of a package exists), But is there any way to:
Know why one package have been installed?
or build a package dependency tree.
I don't think there's a simple function, but it shouldn't be too hard to do with these two functions:
julia> Pkg.dependents("Cairo")
10-element Array{AbstractString,1}:
"Tk"
"Gtk"
"Mamba"
"Drawing"
"GtkUtilities"
"ProfileView"
"Brim"
"Winston"
"EcologicalNetwork"
"VennEuler"
julia> Pkg.installed()
Dict{ASCIIString,VersionNumber} with 119 entries:
"Libz" => v"0.0.2"
"Gtk" => v"0.9.3"
"Interact" => v"0.3.0"
"ForwardDiff" => v"0.1.4"
"Benchmark" => v"0.1.0"
"AxisAlgorithms" => v"0.1.4"
"Cairo" => v"0.2.31+"
"HttpParser" => v"0.1.1"
"DataFrames" => v"0.6.10"
"Requests" => v"0.3.4"
"QuartzImageIO" => v"0.1.0+"
"Markdown" => v"0.3.0"
"Requires" => v"0.2.2"
"ArgParse" => v"0.3.0"
⋮ => ⋮
simple code bellow will printout the requires-by result for a package:
whorequires(pkgname) = whorequires(pkgname, 0);
function whorequires(pkgname, i)
deps = Pkg.dependents(pkgname);
[print('-') for j=1:i];
println(pkgname);
length(deps) > 0 && [whorequires(dep,i+1) for dep in deps];
end
julia> whorequires("JuliaParser");
JuliaParser
-CodeTools
--Atom
-ASTInterpreter
--Gallium
-Jewel
EDIT (to cover issue commented by #amrods)
whorequires(pkgname) = whorequires(pkgname, 0, Dict{ASCIIString,Vector{ASCIIString}}());
function whorequires(pkgname, i, m)
[print('-') for j=1:i];
if (haskey(m,pkgname))
println("$pkgname *[duplicated]* is required by ", length(m[pkgname]), " packages");
else
println(pkgname);
m[pkgname] = Pkg.dependents(pkgname);
if (length(m[pkgname]) > 0)
for dep in m[pkgname]
whorequires(dep,i+1,m);
end
end
end
end
There is a package, although not registered, which does this: https://github.com/peng1999/PkgDependency.jl
It's quite straightforward to use
pkg> add https://github.com/peng1999/PkgDependency.jl
julia> using PkgDependency
julia> PkgDependency.tree("HTTP")
HTTP v0.9.13
NetworkOptions v1.2.0
IniFile v0.5.0
URIs v1.3.0
MbedTLS v1.0.3
MbedTLS_jll v2.16.8+1
JLLWrappers v1.3.0
Preferences v1.2.2
TOML v1.0.3
Artifacts v1.3.0
It relies on a new (>1.4) experimental API, which can be used on its own to list (direct) dependencies, but it's quite ugly:
julia> using Pkg
julia> Pkg.dependencies()[Pkg.project().dependencies["HTTP"]].dependencies
Dict{String, Base.UUID} with 5 entries:
"Dates" => UUID("ade2ca70-3891-5945-98fb-dc099432e06a")
"Base64" => UUID("2a0f44e3-6c83-55bd-87e4-b1978d98bd5f")
"Sockets" => UUID("6462fe0b-24de-5631-8697-dd941f90decc")
"IniFile" => UUID("83e8ac13-25f8-5344-8a64-a9f2b223428f")
"MbedTLS" => UUID("739be429-bea8-5141-9913-cc70e7f3736d")
If you only want the list for dependencies of the currently active project, then Pkg.project().dependencies is enough.
I've opened a Pkg.jl issue to discuss this here.
Related
I'm trying to follow this tutorial which uses GraphViz to display a diagram. When running the first piece of code:
using Decapodes, Decapodes.Diagrams
using Catlab.Present, Catlab.Graphics
Variable = #decapode Decapodes2D begin
C::Form0{X}
end;
draw_equation(decapode) = to_graphviz(decapode, node_labels=true, prog="neato",
node_attrs=Dict(:shape=>"oval"),
graph_attrs=Dict(:nodesep=>"4.0"))
draw_equation(Variable)
I get the following output in the Julia REPL:
Catlab.Graphics.Graphviz.Graph("G", true, "neato", Catlab.Graphics.Graphviz.Statement[Catlab.Graphics.Graphviz.Node("n1", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:label => "C:Ω₀"))], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:nodesep => "4.0", :rankdir => "LR"), OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:height => "0.05", :margin => "0", :shape => "oval", :width => "0.05"), OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:arrowsize => "0.5"))
I expect the diagram to show up in another window, but no such window is created.
I'm running MacOS Monterey 12.4, Julia 1.7, and have GraphViz installed via Home-brew as well as the GraphViz.jl package. How can I view the diagram?
You need to use Graphviz to generate the image.
Assuming graphviz is in your system path you can do:
using Catlab
open("out.pdf","w") do f
write(f, Catlab.Graphics.Graphviz.run_graphviz(draw_equation(Variable);format="pdf"))
end
if I want to have a dictionary for entries in a TOML file, how can I set that up in Julia?
I want it to be something like:
["hello"]
world = Dict("z" => 25, "c" => 1)
Currently you can also use TOML module built into Pkg module without installing anything:
julia> using Pkg
julia> Pkg.TOML.print(Dict("hello" => Dict("world" => Dict("hellow" => "wurld"))))
[hello.world]
hellow = "wurld"
You can quite simply use TOML by doing the following:
add https://github.com/JuliaLang/TOML.jl.git in the package manager.
import TOML
TOML.print(Dict("hello" => Dict("world" => Dict("hellow" => "wurld"))))
which will output:
[hello.world]
hellow = "wurld"
See the TOML.jl for more info.
I am running ldd command on libqqnx.so on my target board. This list few certain dependent libraries and then throw error called ldd: Library cannot be found. If I do same on libcpp.so.4 of qnx then it does not show such errors.
My question is, the file libqqnx.so is corrupted or should it be listing some more dependent lib files?
output1:
# ldd /opt/qt/plugins/platforms/libqqnx.so:
libqqnx.so => /opt/qt/plugins/platforms/libqqnx.so (0x78000000)
libscreen.so.1 => /proc/boot/libscreen.so.1 (0x78040000)
libpps.so.1 => /opt/qt/lib/libpps.so.1 (0x78031000)
libm.so.2 => /proc/boot/libm.so.2 (0x78060000)
libfreetype.so.1 => /usr/lib/libfreetype.so.1 (0x78090000)
libQt5DBus.so.5 => /opt/qt/lib/libQt5DBus.so.5 (0x780e0000)
libQt5Gui.so.5 => /opt/qt/lib/libQt5Gui.so.5 (0x78200000)
libQt5Core.so.5 => /opt/qt/lib/libQt5Core.so.5 (0x78600000)
libGLESv2.so.1 => /usr/lib/graphics/iMX6X/libGLESv2.so.1 (0x78037000)
libEGL.so.1 => /proc/boot/libEGL.so.1 (0x78053000)
libcpp.so.5 => /opt/qt/lib/libcpp.so.5 (0x78140000)
libz.so.2 => /proc/boot/libz.so.2 (0x781a0000)
libslog2.so.1 => /proc/boot/libslog2.so.1 (0x78083000)
libicui18n.so.49 => /opt/qt/lib/libicui18n.so.49 (0x78a00000)
libicuuc.so.49 => /opt/qt/lib/libicuuc.so.49 (0x78b10000)
libicudata.so.49 => /opt/qt/lib/libicudata.so.49 (0x78c00000)
ldd: Library cannot be found
output2:
# ldd /proc/boot/libcpp.so.4:
libcpp.so.4 => /proc/boot/libcpp.so.4 (0x78000000)
#
It looks for me that ldd is looking for more libraries but it doesn't find them.
If you know another directory that has other libraries (.so* files) allow qnx to search on it for the missing libraries. You can use LD_LIBRARY_PATH.
For example: export LD_LIBRARY_PATH=/opt/qt/some_dir
More info here
I created a simple c++ library. Running ldd give
ldd libTESTPlugin.so.1.0.0 | grep -i qt
libQt5Widgets.so.5 => /lib64/libQt5Widgets.so.5 (0x00007f5345f14000)
libQt5Gui.so.5 => /lib64/libQt5Gui.so.5 (0x00007f5345a71000)
libQt5Core.so.5 => /lib64/libQt5Core.so.5 (0x00007f53455e7000)
libQtXml.so.4 => /lib64/libQtXml.so.4 (0x00007f5344074000)
libQtCore.so.4 => /lib64/libQtCore.so.4 (0x00007f5343b71000)
libQtGui.so.4 => /lib64/libQtGui.so.4 (0x00007f5342e4b000)
libQtNetwork.so.4 => /lib64/libQtNetwork.so.4 (0x00007f5342afa000)
libQtSvg.so.4 => /lib64/libQtSvg.so.4 (0x00007f53428a0000)
libQtWebKit.so.4 => /lib64/libQtWebKit.so.4 (0x00007f53403b3000)
libQtSql.so.4 => /lib64/libQtSql.so.4 (0x00007f5340170000)
libQtLocation.so.1 => /lib64/libQtLocation.so.1 (0x00007f5336a09000)
libQtSensors.so.1 => /lib64/libQtSensors.so.1 (0x00007f53367d5000)
libQtOpenGL.so.4 => /lib64/libQtOpenGL.so.4 (0x00007f5334ccb000)
libQtDeclarative.so.4 => /lib64/libQtDeclarative.so.4 (0x00007f5329d06000)
libQtScript.so.4 => /lib64/libQtScript.so.4 (0x00007f5329845000)
libQtXmlPatterns.so.4 => /lib64/libQtXmlPatterns.so.4 (0x00007f53291c0000)
so my lib is linked with both qt4 and qt5. It is giving me some integration issue with one other software which is linked with only qt5.
Is there a way to specify the linking only with Qt5 and NOT with Qt4?
Try to set Qt5 as default qt version using QT_SELECT environment variable:
export QT_SELECT = <Qt version>
For example:
export QT_SELECT = qt5
Also, if you are using Qt Creator, check again your build configuration.
PS:
I am not sure if they still include qtchooser, but you can try to run this command to list all installed versions on your system:
qtchooser -list-versions
Maybe you link with another lib also using Qt, like for example QWT. If you choose the wrong version of such lib it might load the wrong versions of dynamic Qt libs.
See https://stackoverflow.com/a/51282459/1328780 for a solution in case of QWT.
I recently installed Qt4 even though I already had some Qt5 libraries installed, because an application seemed to require Qt4. Tragically, that application also used mayavi, which would now segfault when it tried to import its mlab module. I managed to isolate the cause of the segfault to the following imports, both of which are necessary to cause the crash:
me#Bedrock:~$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
>>> from pyface import api as pyface
QMetaType::registerType: Binary compatibility break -- Size mismatch for type 'QUuid' [30]. Previously registered size 16, now registering size 0.
Aborted (core dumped)
me#Bedrock:~$
Googling around has led to some suggestions as to how to set environment variables in .bashrc :
export QTCHOOSER_RUNTOOL=qtconfig
export QT_SELECT=4
export QT_API='pyside'
export ETS_TOOLKIT='qt4'
I've used these, somewhat blindly, but without success.
Am I correct in believing my problems are due to a Qt4/Qt5 conflict, and if so, what should I do about it?
=============================================================================
I've investigated a little further. I now can get this crash with the following two imports:
me#Bedrock:~/Downloads/temp3/mne-python$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from vtk.vtkCommonCore import *
>>> from PySide.QtGui import *
QMetaType::registerType: Binary compatibility break -- Size mismatch for type 'QUuid' [30]. Previously registered size 16, now registering size 0.
Aborted (core dumped)
vtk.vtkCommonCorecontains a single line, which imports vtkCommonCorePython, and this is an .so file.
Similarly, PySide.QtGui is also a .so file.
So, my next step was to see which .so files /usr/local/lib/python2.7/dist-packages/PySide/QtGui.so and /usr/lib/python2.7/dist-packages/vtk/vtkCommonCorePython.x86_64-linux-gnu.so depend upon.
What I found was this:
me#Bedrock:/usr/lib/python2.7/dist-packages/vtk$ ldd -v vtkCommonCorePython.x86_64-linux-gnu.so
linux-vdso.so.1 => (0x00007fff28fc0000)
libvtkCommonCorePython27D-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonCorePython27D-6.2.so.6.2 (0x00007f0488925000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f04885a2000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f04881d9000)
libvtkWrappingPython27Core-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkWrappingPython27Core-6.2.so.6.2 (0x00007f0487fac000)
libvtkCommonCore-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonCore-6.2.so.6.2 (0x00007f0487a7d000)
libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f04874ef000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f04871e6000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0486fcf000)
/lib64/ld-linux-x86-64.so.2 (0x000055b9eee1f000)
libvtksys-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtksys-6.2.so.6.2 (0x00007f0486d8a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0486b6c000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f0486952000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f048674e000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f048654a000)
and this:
me#Bedrock:/usr/local/lib/python2.7/dist-packages/PySide$ ldd -v /usr/local/lib/python2.7/dist-packages/PySide/QtGui.so
linux-vdso.so.1 => (0x00007fff37bfc000)
libpyside-python2.7.so.1.2 (0x00007ff4672cf000)
libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007ff466cfa000)
libshiboken-python2.7.so.1.2 (0x00007ff466ac6000)
libQtGui.so.4 => /usr/lib/x86_64-linux-gnu/libQtGui.so.4 (0x00007ff465dd2000)
libQtCore.so.4 => /usr/lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007ff4658de000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff46555c000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff465346000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff464f7c000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff464d5f000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff464b45000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff464940000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007ff46473d000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff464434000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007ff4641f0000)
libaudio.so.2 => /usr/lib/x86_64-linux-gnu/libaudio.so.2 (0x00007ff463fd7000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007ff463cc6000)
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007ff463aa0000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007ff4637f6000)
libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007ff4635a3000)
libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007ff46339a000)
libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007ff463180000)
libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007ff462f70000)
libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007ff462d65000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007ff462b53000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007ff462819000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff462610000)
/lib64/ld-linux-x86-64.so.2 (0x000055bd99ece000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007ff4623e7000)
libXt.so.6 => /usr/lib/x86_64-linux-gnu/libXt.so.6 (0x00007ff46217d000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007ff461f79000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007ff461d09000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007ff461b00000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007ff4618fb000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007ff4616d8000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007ff4614d2000)
Only /usr/local/lib/python2.7/dist-packages/PySide/QtGui.so seems to have any direct connection to the Qt libraries, so I don't understand how/why the vtk import interferes with anything Qt related.
Finally, I became curious about which version of Qt the /usr/lib/x86_64-linux-gnu/libQt...so files were using. So, I tried this:
me#Bedrock:~$ qmake --version
QMake version 2.01a
Using Qt version 4.8.7 in /usr/lib/x86_64-linux-gnu
I also checked my version of vtk
>>> vtk.VTK_MAJOR_VERSION
6
>>> vtk.VTK_MINOR_VERSION
2
>>>
and, separately, my version of PySide:
>>> import PySide
>>> PySide.__version__
'1.2.4'
At this point, I'm only more puzzled. Is my problem a Qt4/Qt5 conflict? (I think so) If not, why do I get Seg Faults with the error :
QMetaType::registerType: Binary compatibility break -- Size mismatch for type 'QUuid' [30]. Previously registered size 16, now registering size 0.
Aborted (core dumped)
If so, why do I only seem to be using one version of Qt? Most importantly, how can I fix this?
With default configurations of Qt builds, a given process can only use one version of Qt. If you're loading a Python module that uses Qt 5, and another that uses Qt 4, there will be issues as plenty of symbols overlap.
To use Qt 4 in parallel with Qt 5 in an application, you must compile one of the Qt versions in its own namespace, and rebuild the module(s) that use that Qt version. That way the symbols won't clash and the same process can use multiple Qt versions.