Hello mates! This is a new Julia user. I was caught by a trouble to import a Py module “graphviz” to Julia.
I’ve checked that I am referring to the correct path of Py
and I’ve added my target module by
using Conda Conda.add("graphviz")
and I confirm in the library folder that it does exist in
But once I import the module
using PyCall pyimport("graphviz")
it comes up with error
ERROR: PyError (PyImport_ImportModule
The Python package graphviz could not be imported by pyimport. Usually this means
that you did not install graphviz in the Python version being used by PyCall.
PyCall is currently configured to use the Python version at:
and you should use whatever mechanism you usually use (apt-get, pip, conda,
etcetera) to install the Python package containing the graphviz module.
One alternative is to re-configure PyCall to use a different Python
version on your system: set ENV[“PYTHON”] to the path/name of the python
executable you want to use, run Pkg.build(“PyCall”), and re-launch Julia.
Another alternative is to configure PyCall to use a Julia-specific Python
distribution via the Conda.jl package (which installs a private Anaconda
Python distribution), which has the advantage that packages can be installed
and kept up-to-date via Julia. As explained in the PyCall documentation,
set ENV[“PYTHON”]=“”, run Pkg.build(“PyCall”), and re-launch Julia. Then,
To install the graphviz module, you can use
where PKG is the Anaconda package that contains the module graphviz,
or alternatively you can use the Conda package directly (via
using Condafollowed by
) <class ‘ModuleNotFoundError’>
ModuleNotFoundError(“No module named ‘graphviz’”)
@ PyCall ~/.julia/packages/PyCall/ilqDX/src/PyCall.jl:558
 top-level scope
It says the module is not found. What’s the problem?