# Fresh Julia/PyPlot install errors with \_imaging: the specified module could not be found

**URL:** <https://discourse.julialang.org/t/fresh-julia-pyplot-install-errors-with-imaging-the-specified-module-could-not-be-found/109311>\
**Category:** General Usage\
**Created:** [January 26, 2024, 4:56pm UTC](https://discourse.julialang.org/t/fresh-julia-pyplot-install-errors-with-imaging-the-specified-module-could-not-be-found/109311 "2024-01-26T16:56:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alkoedl](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@alkoedl](https://discourse.julialang.org/u/alkoedl)\
**Post date:** [January 26, 2024, 4:56pm UTC](https://discourse.julialang.org/t/fresh-julia-pyplot-install-errors-with-imaging-the-specified-module-could-not-be-found/109311/1 "2024-01-26T16:56:55Z")

</div>

After a long time with a perfectly well working PyPlot I today had to install Julia and PyPlot from scratch on a new computer. Adding PyPlot and building Conda/PyCall works. Upon “using PyPlot” conda/matplotlib are installed. However, the process errors after the installation with

```julia
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.10.0 (2023-12-25)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

(@v1.10) pkg> st
  Installing known registries into `C:\Users\alk\.julia`
Status `C:\Users\alk\.julia\environments\v1.10\Project.toml` (empty project)

(@v1.10) pkg> add PyPlot
    Updating registry at `C:\Users\alk\.julia\registries\General.toml`
   Resolving package versions...
   Installed Parsers ─────────── v2.8.1
   Installed ColorTypes ──────── v0.11.4
   Installed Conda ───────────── v1.10.0
   Installed FixedPointNumbers ─ v0.8.4
   Installed JSON ────────────── v0.21.4
   Installed PyCall ──────────── v1.96.4
   Installed PrecompileTools ─── v1.2.0
   Installed Preferences ─────── v1.4.1
   Installed VersionParsing ──── v1.3.0
   Installed PyPlot ──────────── v2.11.2
   Installed LaTeXStrings ────── v1.3.1
   Installed Reexport ────────── v1.2.2
   Installed MacroTools ──────── v0.5.13
   Installed Colors ──────────── v0.12.10
    Updating `C:\Users\alk\.julia\environments\v1.10\Project.toml`
  [d330b81b] + PyPlot v2.11.2
    Updating `C:\Users\alk\.julia\environments\v1.10\Manifest.toml`
  [3da002f7] + ColorTypes v0.11.4
  [5ae59095] + Colors v0.12.10
  [8f4d0f93] + Conda v1.10.0
  [53c48c17] + FixedPointNumbers v0.8.4
  [682c06a0] + JSON v0.21.4
  [b964fa9f] + LaTeXStrings v1.3.1
  [1914dd2f] + MacroTools v0.5.13
  [69de0a69] + Parsers v2.8.1
  [aea7be01] + PrecompileTools v1.2.0
  [21216c6a] + Preferences v1.4.1
  [438e738f] + PyCall v1.96.4
  [d330b81b] + PyPlot v2.11.2
  [189a3867] + Reexport v1.2.2
  [81def892] + VersionParsing v1.3.0
  [0dad84c5] + ArgTools v1.1.1
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [f43a241f] + Downloads v1.6.0
  [7b1f6079] + FileWatching
  [b27032c2] + LibCURL v0.6.4
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [ca575930] + NetworkOptions v1.2.0
  [de0858da] + Printf
  [9a3f8284] + Random
  [ea8e919c] + SHA v0.7.0
  [9e88b42a] + Serialization
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays v1.10.0
  [10745b16] + Statistics v1.10.0
  [fa267f1f] + TOML v1.0.3
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll v1.0.5+1
  [deac9b47] + LibCURL_jll v8.4.0+0
  [29816b5a] + LibSSH2_jll v1.11.0+1
  [c8ffd9c3] + MbedTLS_jll v2.28.2+1
  [14a3606d] + MozillaCACerts_jll v2023.1.10
  [4536629a] + OpenBLAS_jll v0.3.23+2
  [bea87d4a] + SuiteSparse_jll v7.2.1+1
  [83775a58] + Zlib_jll v1.2.13+1
  [8e850b90] + libblastrampoline_jll v5.8.0+1
  [8e850ede] + nghttp2_jll v1.52.0+1
    Building Conda ─→ `C:\Users\alk\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\51cab8e982c5b598eea9c8ceaced4b58d9dd37c9\build.log`
    Building PyCall → `C:\Users\alk\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\9816a3826b0ebf49ab4926e2b18842ad8b5c8f04\build.log`
Precompiling project...
  16 dependencies successfully precompiled in 35 seconds. 4 already precompiled.

(@v1.10) pkg> st
Status `C:\Users\alk\.julia\environments\v1.10\Project.toml`
  [d330b81b] PyPlot v2.11.2

julia> using PyPlot
[ Info: Installing matplotlib via the Conda matplotlib package...
[ Info: Running `conda install -y matplotlib` in root environment
Channels:
 - anaconda-fusion
 - defaults
 - conda-forge
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\alk\.julia\conda\3\x86_64

  added / updated specs:
    - matplotlib

The following packages will be downloaded:

    package | build
    ---------------------------|-----------------
    brotli-1.0.9 | ha925a31_2 332 KB
    contourpy-1.2.0 | py310h59b6b97_0 203 KB
    cycler-0.11.0 | pyhd3eb1b0_0 12 KB
    fonttools-4.25.0 | pyhd3eb1b0_0 632 KB
    freetype-2.12.1 | ha860e81_0 490 KB
    giflib-5.2.1 | h8cc25b3_3 88 KB
    glib-2.69.1 | h5dc1a3c_2 1.8 MB
    gst-plugins-base-1.18.5 | h9e645db_0 1.7 MB
    gstreamer-1.18.5 | hd78058f_0 1.7 MB
    icu-58.2 | ha925a31_3 9.4 MB
    jpeg-9e | h2bbff1b_1 320 KB
    kiwisolver-1.4.4 | py310hd77b12b_0 60 KB
    lerc-3.0 | hd77b12b_0 120 KB
    libclang-12.0.0 |default_h627e005_2 17.8 MB
    libdeflate-1.17 | h2bbff1b_1 153 KB
    libogg-1.3.5 | h2bbff1b_1 33 KB
    libpng-1.6.39 | h8cc25b3_0 369 KB
    libtiff-4.5.0 | h8a3f274_0 1.2 MB
    libvorbis-1.3.7 | he774522_0 202 KB
    libwebp-1.3.2 | hbc33d0d_0 73 KB
    libwebp-base-1.3.2 | h2bbff1b_0 306 KB
    matplotlib-3.8.0 | py310haa95532_0 9 KB
    matplotlib-base-3.8.0 | py310h4ed8f06_0 6.8 MB
    munkres-1.1.4 | py_0 13 KB
    openjpeg-2.4.0 | h4fc8c34_0 219 KB
    pcre-8.45 | hd77b12b_0 382 KB
    pillow-10.0.1 | py310h045eedc_0 788 KB
    ply-3.11 | py310haa95532_0 81 KB
    pyparsing-3.0.9 | py310haa95532_0 154 KB
    pyqt-5.15.10 | py310hd77b12b_0 4.1 MB
    pyqt5-sip-12.13.0 | py310h2bbff1b_0 75 KB
    python-dateutil-2.8.2 | pyhd3eb1b0_0 233 KB
    qt-main-5.15.2 | he8e5bd7_7 50.0 MB
    sip-6.7.12 | py310hd77b12b_0 521 KB
    six-1.16.0 | pyhd3eb1b0_1 18 KB
    sqlite-3.41.2 | h2bbff1b_0 894 KB
    tomli-2.0.1 | py310haa95532_0 25 KB
    tornado-6.3.3 | py310h2bbff1b_0 647 KB
    zlib-1.2.13 | hcfcfb64_5 105 KB conda-forge
    ------------------------------------------------------------
                                           Total: 101.7 MB

The following NEW packages will be INSTALLED:

  brotli pkgs/main/win-64::brotli-1.0.9-ha925a31_2
  contourpy pkgs/main/win-64::contourpy-1.2.0-py310h59b6b97_0
  cycler pkgs/main/noarch::cycler-0.11.0-pyhd3eb1b0_0
  fonttools pkgs/main/noarch::fonttools-4.25.0-pyhd3eb1b0_0
  freetype pkgs/main/win-64::freetype-2.12.1-ha860e81_0
  giflib pkgs/main/win-64::giflib-5.2.1-h8cc25b3_3
  glib pkgs/main/win-64::glib-2.69.1-h5dc1a3c_2
  gst-plugins-base pkgs/main/win-64::gst-plugins-base-1.18.5-h9e645db_0
  gstreamer pkgs/main/win-64::gstreamer-1.18.5-hd78058f_0
  icu pkgs/main/win-64::icu-58.2-ha925a31_3
  jpeg pkgs/main/win-64::jpeg-9e-h2bbff1b_1
  kiwisolver pkgs/main/win-64::kiwisolver-1.4.4-py310hd77b12b_0
  lerc pkgs/main/win-64::lerc-3.0-hd77b12b_0
  libclang pkgs/main/win-64::libclang-12.0.0-default_h627e005_2
  libdeflate pkgs/main/win-64::libdeflate-1.17-h2bbff1b_1
  libogg pkgs/main/win-64::libogg-1.3.5-h2bbff1b_1
  libpng pkgs/main/win-64::libpng-1.6.39-h8cc25b3_0
  libtiff pkgs/main/win-64::libtiff-4.5.0-h8a3f274_0
  libvorbis pkgs/main/win-64::libvorbis-1.3.7-he774522_0
  libwebp pkgs/main/win-64::libwebp-1.3.2-hbc33d0d_0
  libwebp-base pkgs/main/win-64::libwebp-base-1.3.2-h2bbff1b_0
  matplotlib pkgs/main/win-64::matplotlib-3.8.0-py310haa95532_0
  matplotlib-base pkgs/main/win-64::matplotlib-base-3.8.0-py310h4ed8f06_0
  munkres pkgs/main/noarch::munkres-1.1.4-py_0
  openjpeg pkgs/main/win-64::openjpeg-2.4.0-h4fc8c34_0
  pcre pkgs/main/win-64::pcre-8.45-hd77b12b_0
  pillow pkgs/main/win-64::pillow-10.0.1-py310h045eedc_0
  ply pkgs/main/win-64::ply-3.11-py310haa95532_0
  pyparsing pkgs/main/win-64::pyparsing-3.0.9-py310haa95532_0
  pyqt pkgs/main/win-64::pyqt-5.15.10-py310hd77b12b_0
  pyqt5-sip pkgs/main/win-64::pyqt5-sip-12.13.0-py310h2bbff1b_0
  python-dateutil pkgs/main/noarch::python-dateutil-2.8.2-pyhd3eb1b0_0
  qt-main pkgs/main/win-64::qt-main-5.15.2-he8e5bd7_7
  sip pkgs/main/win-64::sip-6.7.12-py310hd77b12b_0
  six pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_1
  sqlite pkgs/main/win-64::sqlite-3.41.2-h2bbff1b_0
  tomli pkgs/main/win-64::tomli-2.0.1-py310haa95532_0
  tornado pkgs/main/win-64::tornado-6.3.3-py310h2bbff1b_0
  zlib conda-forge/win-64::zlib-1.2.13-hcfcfb64_5

Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
ERROR: InitError: PyError (PyImport_ImportModule

The Python package matplotlib could not be imported by pyimport. Usually this means
that you did not install matplotlib in the Python version being used by PyCall.

PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package. To install the matplotlib module, you can
use `pyimport_conda("matplotlib", PKG)`, where PKG is the Anaconda
package that contains the module matplotlib, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).

Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python. As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.

) <class 'ImportError'>
ImportError('DLL load failed while importing _imaging: The specified module could not be found.')
  File "C:\Users\alk\.julia\conda\3\x86_64\lib\site-packages\matplotlib\ __init__.py", line 161, in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
  File "C:\Users\alk\.julia\conda\3\x86_64\lib\site-packages\matplotlib\rcsetup.py", line 27, in <module>
    from matplotlib.colors import Colormap, is_color_like
  File "C:\Users\alk\.julia\conda\3\x86_64\lib\site-packages\matplotlib\colors.py", line 52, in <module>
    from PIL import Image
  File "C:\Users\alk\.julia\conda\3\x86_64\lib\site-packages\PIL\Image.py", line 82, in <module>
    from . import _imaging as core

Stacktrace:
  [1] pyimport(name::String)
    @ PyCall C:\Users\alk\.julia\packages\PyCall\1gn3u\src\PyCall.jl:558
  [2] pyimport_conda
    @ C:\Users\alk\.julia\packages\PyCall\1gn3u\src\PyCall.jl:722
  [3] pyimport_conda
    @ PyCall C:\Users\alk\.julia\packages\PyCall\1gn3u\src\PyCall.jl:715 [inlined]
  [4] __init__ ()
    @ PyPlot C:\Users\alk\.julia\packages\PyPlot\2MlrT\src\init.jl:174
  [5] run_module_init(mod::Module, i::Int64)
    @ Base .\loading.jl:1128
  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base .\loading.jl:1116
  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
    @ Base .\loading.jl:1061
  [8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
    @ Base .\loading.jl:1575
  [9] _require(pkg::Base.PkgId, env::String)
    @ Base .\loading.jl:1932
 [10] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1806
 [11] #invoke_in_world#3
    @ Base .\essentials.jl:921 [inlined]
 [12] invoke_in_world
    @ Base .\essentials.jl:918 [inlined]
 [13] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1797
 [14] macro expansion
    @ Base .\loading.jl:1784 [inlined]
 [15] macro expansion
    @ Base .\lock.jl:267 [inlined]
 [16] __require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1747
 [17] #invoke_in_world#3
    @ Base .\essentials.jl:921 [inlined]
 [18] invoke_in_world
    @ Base .\essentials.jl:918 [inlined]
 [19] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1740
during initialization of module PyPlot

caused by: PyError (PyImport_ImportModule

The Python package matplotlib could not be imported by pyimport. Usually this means
that you did not install matplotlib in the Python version being used by PyCall.

PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package. To install the matplotlib module, you can
use `pyimport_conda("matplotlib", PKG)`, where PKG is the Anaconda
package that contains the module matplotlib, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).

Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python. As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.

) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'matplotlib'")

Stacktrace:
  [1] pyimport(name::String)
    @ PyCall C:\Users\alk\.julia\packages\PyCall\1gn3u\src\PyCall.jl:558
  [2] pyimport_conda
    @ C:\Users\alk\.julia\packages\PyCall\1gn3u\src\PyCall.jl:716
  [3] pyimport_conda
    @ PyCall C:\Users\alk\.julia\packages\PyCall\1gn3u\src\PyCall.jl:715 [inlined]
  [4] __init__ ()
    @ PyPlot C:\Users\alk\.julia\packages\PyPlot\2MlrT\src\init.jl:174
  [5] run_module_init(mod::Module, i::Int64)
    @ Base .\loading.jl:1128
  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base .\loading.jl:1116
  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
    @ Base .\loading.jl:1061
  [8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
    @ Base .\loading.jl:1575
  [9] _require(pkg::Base.PkgId, env::String)
    @ Base .\loading.jl:1932
 [10] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1806
 [11] #invoke_in_world#3
    @ Base .\essentials.jl:921 [inlined]
 [12] invoke_in_world
    @ Base .\essentials.jl:918 [inlined]
 [13] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1797
 [14] macro expansion
    @ Base .\loading.jl:1784 [inlined]
 [15] macro expansion
    @ Base .\lock.jl:267 [inlined]
 [16] __require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1747
 [17] #invoke_in_world#3
    @ Base .\essentials.jl:921 [inlined]
 [18] invoke_in_world
    @ Base .\essentials.jl:918 [inlined]
 [19] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1740

julia>

```

So, the actual error seems to be that \_imaging cannot be found. Checking the respective directory gives me

```julia
C:\Users\alk\.julia\conda\3\x86_64\Lib\site-packages\PIL
__pycache__
 __init__.py
__main__.py
_binary.py
_deprecate.py
_imaging.cp310-win_amd64.pyd
_imagingft.cp310-win_amd64.pyd
_imagingmath.cp310-win_amd64.pyd
_imagingmorph.cp310-win_amd64.pyd
_imagingtk.cp310-win_amd64.pyd
_tkinter_finder.py
_util.py
_version.py
...

```

So, there is at least “\_imaging.cp310-win\_amd64.pyd” is there.

This install is on a new computer running Windows 11 Enterprise. I tried installing Julia in my home directory as well as globally with admin privilages. Same result. The environment is empty before adding PyPlot. I tried installing in the global environment as well as in a temporary environment. Same result.

Interestingly, a different computer (also running Windows 11 Enterprise) that has exactly the same versions of Julia and PyPlot (1.10.0 and 2.11.2) runs PyPlot without problems. However, this installation was not done from scratch, but through upgrades with a long history. I noticed that conda seems to have a different version on the two computers:

on the working one: conda-23.3.1-py3.10.egg-info  
on the failing one: conda-23.11.0.dist-info

could this be a problem?

On both computers I’m using Julia’s internal conda/Python installation. The computers do not have an additional external Python.

Any ideas?

---

<div class="post-metadata">

**Author:** ![alkoedl](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@alkoedl](https://discourse.julialang.org/u/alkoedl)\
**Post date:** [January 28, 2024, 4:19pm UTC](https://discourse.julialang.org/t/fresh-julia-pyplot-install-errors-with-imaging-the-specified-module-could-not-be-found/109311/2 "2024-01-28T16:19:44Z")

</div>

Update in case someone else stumbles over this issue: it seems that currently `conda install matplotlib` which is implicitly run on the first `using PyPlot` installs a broken or incompatible version of the package Pillow. It might also be an issue of Python package channels or package managers (conda vs pip). After reading [this](https://stackoverflow.com/questions/66385979/dll-load-failed-while-importing-imaging) post I tried

```julia
conda upgrade Pillow

```

which upgraded conda but everything else stayed the same and the error persisted. Then I tried

```julia
python -m pip install --force-reinstall Pillow

```

This upgraded Pillow from 10.0.1 to version 10.2.0:

```julia
C:\Users\alk\.julia\conda\3\x86_64>python -m pip install --force-reinstall Pillow
Collecting Pillow
  Using cached pillow-10.2.0-cp310-cp310-win_amd64.whl.metadata (9.9 kB)
Using cached pillow-10.2.0-cp310-cp310-win_amd64.whl (2.6 MB)
Installing collected packages: Pillow
  Attempting uninstall: Pillow
    Found existing installation: Pillow 10.0.1
    Uninstalling Pillow-10.0.1:
      Successfully uninstalled Pillow-10.0.1
Successfully installed Pillow-10.2.0

```

After that I could `import matplotlib` from Python and `using PyPlot` in Julia again without error.

I’m hesitant to call this a solution since it’s a hack mixing package managers. But at least it’s a workaround that restores a working PyPlot.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [January 28, 2024, 4:38pm UTC](https://discourse.julialang.org/t/fresh-julia-pyplot-install-errors-with-imaging-the-specified-module-could-not-be-found/109311/3 "2024-01-28T16:38:16Z")

</div>

> [@alkoedl](#):
>
> it seems that currently `conda install matplotlib` which is implicitly run on the first `using PyPlot` installs a broken or incompatible version of the package Pillow.

You can also look into using PythonPlot.jl its drop-in replacement (I understand). It downloads matplotlib automatically, and its dependencies, so I suppose ok Pillow:

> [@alkoedl](#):
>
> it seems that currently `conda install matplotlib` which is implicitly run on the first `using PyPlot` installs a broken or incompatible version of the package Pillow.

---

<div class="post-metadata">

**Author:** ![alkoedl](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@alkoedl](https://discourse.julialang.org/u/alkoedl)\
**Post date:** [January 29, 2024, 7:42pm UTC](https://discourse.julialang.org/t/fresh-julia-pyplot-install-errors-with-imaging-the-specified-module-could-not-be-found/109311/4 "2024-01-29T19:42:23Z")

</div>

> [@Palli](#):
>
> You can also look into using [PythonPlot.jl](https://juliahub.com/ui/Packages/PythonPlot) its drop-in replacement

Thanks for the tip. Using PythonPlot indeed solves this problem (at least at this moment). Should have tried this by myself. I experimented with PythonPlot in the past but did not see a compelling reason to switch. Perhaps time has come now…

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [January 30, 2024, 12:32pm UTC](https://discourse.julialang.org/t/fresh-julia-pyplot-install-errors-with-imaging-the-specified-module-could-not-be-found/109311/5 "2024-01-30T12:32:57Z")

</div>

Plots.jl has a [compat] for both PyPlot.jl and PythonPlot.jl, so the latter is certainly supported, equally, at least there, and I at least think should be as, if not more, promoted, implying also that PythonCall should also be supported/promoted (over PyCall).

You will likely be missing out on some utilities such as (obscure to me) PlotPlants.jl for PyPlot.jl. And conversely there is e.g ArviZPythonPlot.jl. And I neither looked at carefully what PythonCallHelpers.jl does.

You could also migrate from PyPlot/matplotlib to e.g. [GL]Makie, and it might be even better, avoiding any (potential) issue with:

> [@alkoedl](#):
>
> Using PythonPlot indeed solves this problem (at least at this moment).

It should, at least if you only use PythonCall as you do there. You CAN use PythonCall with PyCall, which seems nonsensical to try, but at least when your dependencies depend on either (and even PythonPlot and PyPlot together, if needed?), see PythonCall’s docs.

If you, _or_ some of your dependencies (even indirect)use PyCall, then do possibly expect problems (on non-Windows), and see the docs on that, for solving. Hopefully all will migrate to PythonCall… and I will not have to cautiously explain this (which seems to not apply to Windows, then no worry):

> On this page, we give some tips for migrating between the two modules and a comparison.
> 
> ## [Tips](https://juliapy.github.io/PythonCall.jl/stable/pycall/#Tips)
> 
> - To force PythonCall […]
> - Alternatively, to force PyCall to use the same interpreter as PythonCall, set the environment variable `PYTHON` to `PythonCall.C.CTX.exe_path` and then `Pkg.build("PyCall")`. You will need to do this each time you change project, because PythonCall by default uses a different Python for each project.

IF there are potential (i.e. solvable, with right setup) problems, I got curious about the different ecosystems:

Note, already over 50 packages use PythonPlot, so it, and PythonCall, are not at all new and untested, including CatBoost, DWave, PyBracket, SQLFluff and ArviZPythonPlot.

However, more currently 250 packages have direct dependency, plus it seems 217 indirect (and maybe some, or all of those such depending, can more easily drop PyCall?) on the older PyCall, including IPython (it needs to migrate?), the recent [OlivePython.jl](https://github.com/ChifiSource/OlivePython.jl), Pandas, PandasLite, NumPyArray, JustSayIt, MRINavigator, [MLJ]ScikitLearn, JUDI, InvertibleNetworks (indirect to PyCall), for very cool invertible neural networks, [`PlotPlants.jl`](https://Yujie-W.github.io/PlotPlants.jl) “utilities to aid the plotting using PyPlot package”.

> **[GitHub - ModiaSim/ModiaPlot\_PyPlot.jl: Convenient line plots of ModiaResults...](https://github.com/ModiaSim/ModiaPlot_PyPlot.jl)**
>
> Convenient line plots of ModiaResults with PyPlot. Contribute to ModiaSim/ModiaPlot\_PyPlot.jl development by creating an account on GitHub.

> ModiaPlot\_PyPlot is typically not directly used, but is activated via package [ModiaResult](https://github.com/ModiaSim/ModiaResult.jl).

It might be migrating from PyPlot, at least I see: [GitHub - ModiaSim/SignalTablesInterface\_GLMakie.jl: SignalTables Interface to GLMakie](https://github.com/ModiaSim/SignalTablesInterface_GLMakie.jl)

[https://juliahub.com/ui/Packages/General/Peacock](https://juliahub.com/ui/Packages/General/Peacock)

> a Julia package for studying photonic crystals using the Plane Wave Expansion Method.

depends on PyPlot, thus PyCall, but all package that simply depend on PyPlot (as opposed to PyCall directly), could trivially move to (depend on) PythonPlot.

Some like PlotSeis.jl depend on PyPlot.jl, but also directly on PyCall.jl so maybe not as easy to migrate. Same applies to NTFk.jl.

What JuliaHub shows you is dependencies at some point in time, I’ve seen such outdated, and in some cases packages may have migrated to PythonCall already, and only showing PyCall. I feel like I remember at least one such case, so if you need to check the package itself to make sure.

E.g. depending on PythonCall (but not any plotting): [https://juliahub.com/ui/Packages/General/Jl2Py](https://juliahub.com/ui/Packages/General/Jl2Py) See also: [JuliaHub](https://juliahub.com/ui/Packages/General/PythonCallHelpers) E.g. PyQHA.jl depends on it.

Some dependencies are very strange, e.g. for:

> **[GitHub - goualard-f/MicroFloatingPoints.jl: A Julia package to manipulate...](https://github.com/goualard-f/MicroFloatingPoints.jl)**
>
> A Julia package to manipulate very small IEEE 754 standard-compliant floating-point numbers. - GitHub - goualard-f/MicroFloatingPoints.jl: A Julia package to manipulate very small IEEE 754 standard...

Plotting can’t be a core function, and PyPlot dependency should be dropped or made a weakdep? At least I think just depending on is NOT a problem, if you never call the plotting function.
