JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
475 stars 87 forks source link

Allow disabling Conda via PYPLOT_NO_CONDA #569

Closed Octogonapus closed 1 year ago

Octogonapus commented 1 year ago

This PR allows disabling the Conda import via a new env var PYPLOT_MATPLOTLIB_NO_CONDA. This behavior is required when loading PyPlot in an environment that does not have Conda, and where tight control over the Python distribution and version of matplotlib is required.

Fixes #568.

Octogonapus commented 1 year ago

Those test failures are unrelated and happen on master

IanButterworth commented 1 year ago

@stevengj it would be very helpful to have this 🙏

stevengj commented 1 year ago

I don't understand why this is necessary. If you configure PyCall with a PYTHON that is not is not Anaconda Python, then pyimport_conda should not try to run conda.

Octogonapus commented 1 year ago

If you configure PyCall with a PYTHON that is not is not Anaconda Python, then pyimport_conda should not try to run conda.

Ok, if that's true then this sounds like a PyCall issue instead (given https://github.com/JuliaPy/PyPlot.jl/issues/568#issuecomment-1636264150)

Octogonapus commented 1 year ago

Not a PyCall issue, either working config if you can accept a global pip install

FROM ubuntu:22.04

RUN apt-get update -y && \
    apt-get upgrade -y && \
    apt-get install -y wget python3-pip && \
    rm -rf /var/lib/apt/lists/*

RUN pip install -U pip && \
    pip install -U matplotlib==3.7.0

RUN wget -nv https://julialang-s3.julialang.org/bin/linux/x64/1.9/julia-1.9.1-linux-x86_64.tar.gz && \
    tar xf julia-1.9.1-linux-x86_64.tar.gz && \
    rm julia-1.9.1-linux-x86_64.tar.gz && \
    ln -s /julia-1.9.1/bin/julia /usr/local/bin/julia

ENV PYTHON="python3"
RUN julia -e 'import Pkg; Pkg.add("PyPlot")'
RUN julia -e 'using PyPlot'