# Using PyPlot =\> ERROR: InitError: PyError (ccall(@pysym(:PyImport\_ImportModule), PyPtr, (Cstring,), name)

**URL:** https://discourse.julialang.org/t/using-pyplot-error-initerror-pyerror-ccall-pysym-pyimport-importmodule-pyptr-cstring-name/6733
**Category:** General Usage
**Tags:** question
**Created:** [October 27, 2017, 11:12pm UTC](https://discourse.julialang.org/t/using-pyplot-error-initerror-pyerror-ccall-pysym-pyimport-importmodule-pyptr-cstring-name/6733 "2017-10-27T23:12:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![XavierG](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xavierg/32/1768_2.png) [@XavierG](https://discourse.julialang.org/u/XavierG)
#### Post date: [October 27, 2017, 11:12pm UTC](https://discourse.julialang.org/t/using-pyplot-error-initerror-pyerror-ccall-pysym-pyimport-importmodule-pyptr-cstring-name/6733/1 "2017-10-27T23:12:52Z")

</div>

Hi,

I have Julia installed on 2 mac (macOS 10.12.6) since last June. All is perfect on both computers with ver 0.6.0 of Julia.

1. I installed today the ver 0.6.1, and now I have a problem when I invoke “using PyPlot” (see below)
2. back on my current 0.6.0, no problem when I invoke “using PyPlot”
3. to check if the problem comes or not from my computer, I created a new user account on my mac, I installed v0.6.0 and now I have also this problem with “using PyPlot” ?!?. I swiched on my second computer, I installed 0.6.0 and 0.6.1 =\> same problem with Pyplot for both versions of Julia

Apparently the problem is not coming from the config of my computers, nor from 0.6.0/0.6.1 but from PyPlot itself, right?

When I installed last June my two environments, nothing has been customized, I just have invoked Pkg.add(“PyPlot”) and using PyPlot None other package related to plotting needs has been installed.  
Is somebody knows this problem and/or has a suggestion to fix it (and why this problem occurs now)?  
Thanks in advance.  
Xavier

Pkg.add(“PyPlot”) =\> no problem raised  
using PyPlot =\>

julia\> using PyPlot  
INFO: Precompiling module PyPlot.  
INFO: Installing matplotlib via the Conda matplotlib package…  
Fetching package metadata …  
Solving package specifications: .

Package plan for installation in environment /Users/xavierg/.julia/v0.6/Conda/deps/usr:

The following NEW packages will be INSTALLED:

```
backports: 1.0-py27hb4f9756_1    
backports.functools_lru_cache: 1.4-py27h2aca819_1    
backports_abc: 0.5-py27h6972548_0    
cycler: 0.10.0-py27hfc73c78_0 
freetype: 2.8-h143eb01_0        
functools32: 3.2.3.2-py27h8ceab06_1
libpng: 1.6.32-hce72d48_2     
matplotlib: 2.1.0-py27h3078195_0  
pyparsing: 2.2.0-py27h5bb6aaf_0  
python-dateutil: 2.6.1-py27hd56c96b_1  
pytz: 2017.2-py27hb891d23_1 
singledispatch: 3.4.0.3-py27he22c18d_0
ssl_match_hostname: 3.5.0.1-py27h8780752_2
subprocess32: 3.2.7-py27h24b2887_0  
tornado: 4.5.2-py27h29aec9e_0  

```

libpng-1.6.32- 100% |################################| Time: 0:00:00 1.26 MB/s  
freetype-2.8-h 100% |################################| Time: 0:00:00 1.42 MB/s  
backports-1.0- 100% |################################| Time: 0:00:00 2.67 MB/s  
backports\_abc- 100% |################################| Time: 0:00:00 12.96 MB/s  
functools32-3. 100% |################################| Time: 0:00:00 15.96 MB/s  
pyparsing-2.2. 100% |################################| Time: 0:00:00 1.59 MB/s  
pytz-2017.2-py 100% |################################| Time: 0:00:00 1.56 MB/s  
subprocess32-3 100% |################################| Time: 0:00:00 2.62 MB/s  
cycler-0.10.0- 100% |################################| Time: 0:00:00 7.32 MB/s  
python-dateuti 100% |################################| Time: 0:00:00 1.26 MB/s  
singledispatch 100% |################################| Time: 0:00:00 12.84 MB/s  
ssl\_match\_host 100% |################################| Time: 0:00:00 9.83 MB/s  
backports.func 100% |################################| Time: 0:00:00 6.13 MB/s  
tornado-4.5.2- 100% |################################| Time: 0:00:00 1.33 MB/s  
matplotlib-2.1 100% |################################| Time: 0:00:04 1.40 MB/s  
ERROR: InitError: PyError (ccall(@pysym(:PyImport\_ImportModule), PyPtr, (Cstring,), name)

The Python package mpl\_toolkits.mplot3d could not be found by pyimport. Usually this means  
that you did not install mpl\_toolkits.mplot3d 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 mpl\_toolkits.mplot3d module, you can  
use `pyimport_conda("mpl_toolkits.mplot3d", PKG)`, where PKG is the Anaconda  
package the contains the module mpl\_toolkits.mplot3d, 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.

) \<type ‘exceptions.ImportError’\>  
ImportError(‘No module named mpl\_toolkits.mplot3d’,)

Stacktrace:  
[1] pyerr\_check at /Users/xavierg/.julia/v0.6/PyCall/src/exception.jl:56 [inlined]  
[2] pyerr\_check at /Users/xavierg/.julia/v0.6/PyCall/src/exception.jl:61 [inlined]  
[3] macro expansion at /Users/xavierg/.julia/v0.6/PyCall/src/exception.jl:81 [inlined]  
[4] pyimport(::String) at /Users/xavierg/.julia/v0.6/PyCall/src/PyCall.jl:374  
[5] **init** () at /Users/xavierg/.julia/v0.6/PyPlot/src/init.jl:205  
[6] \_include\_from\_serialized(::String) at ./loading.jl:157  
[7] \_require\_from\_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:200  
[8] \_require(::Symbol) at ./loading.jl:498  
[9] require(::Symbol) at ./loading.jl:405  
during initialization of module PyPlot

julia\>

---

<div class="post-metadata">

### Author: ![XavierG](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xavierg/32/1768_2.png) [@XavierG](https://discourse.julialang.org/u/XavierG)
#### Post date: [October 28, 2017, 7:04am UTC](https://discourse.julialang.org/t/using-pyplot-error-initerror-pyerror-ccall-pysym-pyimport-importmodule-pyptr-cstring-name/6733/2 "2017-10-28T07:04:10Z")

</div>

In waiting, I have found the following solution in 3 steps:

```
run(`install_name_tool -change @rpath/libiomp5.dylib @loader_path/libiomp5.dylib $(Pkg.dir("Conda", "deps/usr/lib/libmkl_intel_thread.dylib"))`)

Conda.update()

Pkg.build("PyCall")

```

It is suggested by ‘slowbrain’ here:

> [@Error installing PyPlot: The Python package mpl\_toolkits.mplot3d could not be found by pyimport](https://discourse.julialang.org/t/error-installing-pyplot-the-python-package-mpl-toolkits-mplot3d-could-not-be-found-by-pyimport/6372):
>
> I’m trying to install PyPlot on my system ( OSX 10.10 ) and is getting this error: $ julia \_ \_ \_ \_(\_)\_ | A fresh approach to technical computing (\_) | (\_) (\_) | Documentation: https://docs.julialang.org \_ \_ \_| |\_ \_\_ \_ | Type "?help" for help. | | | | | | |/ \_` | | | | |\_| | | | (\_| | | Version 0.6.0 (2017-06-19 13:05 UTC) \_/ |\_\_'\_|\_|\_|\_\_'\_| | Official http://julialang.org/ release |\_\_/ | x86\_64-apple-darwin13.4.0 ju…

Thanks a lot!
