Skip to content

How to Install Matplotlib using Conda.jl in Julia-1.7.3 #222

@glanzkaiser

Description

@glanzkaiser

I was having a trouble of plotting with:

using Plots
pyplot()

I create a folder to run my environment when I cd to that folder and type:

julia --project="."

Then I check my package status with ] st:

Status ~/LasthrimProjection/ijuliaenv/Project.toml
[8f4d0f93] Conda v1.7.0
[438e738f] PyCall v1.93.1
[d330b81b] PyPlot v2.10.0

I try this code :

using Plots
pyplot()

x=range(-2,stop=2,length=100)
y=range(sqrt(2),stop=2,length=100)
f(x,y) = x*y-x-y+1
plot(x,y,f,st=:surface,camera=(-30,30))

I get this warning (I already build PyPlot and PyCall multiple times):

Warning: You are using Matplotlib 3.3.4, which is no longer
│ officialy supported by the Plots community. To ensure smooth Plots.jl
│ integration update your Matplotlib library to a version >= 3.4.0

│ If you have used Conda.jl to install PyPlot (default installation),
│ upgrade your matplotlib via Conda.jl and rebuild the PyPlot.

│ If you are not sure, here are the default instructions:

│ In Julia REPL:
│ import Pkg; │ Pkg.add("Conda") │ import Conda │ Conda.update() │ Pkg.build("PyPlot") │

└ @ Plots /home/browni/.julia/packages/Plots/SkUg1/src/backends/pyplot.jl:29

**PyError ($(Expr(:escape, :(ccall(#= /home/browni/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'AttributeError'>
AttributeError("'Text' object has no property 'math_fontfamily'",)
File "/home/browni/.local/lib/python3.6/site-packages/matplotlib/colorbar.py", line 761, in set_label
self._set_label()
File "/home/browni/.local/lib/python3.6/site-packages/matplotlib/colorbar.py", line 731, in _set_label
self.ax.set_ylabel(self._label, **self._labelkw)
File "/home/browni/.local/lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 300, in set_ylabel
return self.yaxis.set_label_text(ylabel, fontdict, kwargs)
File "/home/browni/.local/lib/python3.6/site-packages/matplotlib/axis.py", line 1566, in set_label_text
self.label.update(kwargs)
File "/home/browni/.local/lib/python3.6/site-packages/matplotlib/text.py", line 179, in update
super().update(kwargs)
File "/home/browni/.local/lib/python3.6/site-packages/matplotlib/artist.py", line 996, in update
raise AttributeError(f"{type(self).name!r} object "

If I use Jupyter Notebook with Python kernel and I do :

pip install matplotlib

I get matplotlib-3.5.2, it is installed at /home/browni/.julia/conda/3/lib/python3.9/site-packages.

The problem still persists to plot with pyplot().

Hopefully someone can help me here. Why would PyError look for python3.6 (python from system instead of Python inside Conda inside Julia?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions