Closed maxmiao closed 8 months ago
Hi Max, I think I know what this issue is. We recently ran into this while working on the PlantCV v4 release. There's some sort of issue of compatibility between the plotnine
package and numpy
and/or matplotlib
that we were not able to easily resolve. We ended up replacing plotnine
with the altair
package in the version 4 branch and that fixed the issues.
Unless we hit an unforeseen snag, our plan is to release v4 on Friday, which will fix the issue. That's our easiest path forward anyhow, it would be hard to port the updates to the plotting functions backwards into v3
Hi, I have the same issue as Max above and even tried working on a Windows laptop to see if that would resolve the issue. I am working on the VIS interactive tutorial as a starting point but when i run the first cell i get the error message above with the end reading "cannot import name 'multitype_sort' from 'mizani.utils' (/srv/conda/envs/notebook/lib/python3.10/site-packages/mizani/utils.py)" While i am not super familiar, I assume jupyter notebooks would automatically use the most recent version of plantCV and therefore not hit any snags if the latest version was working. Is there something on my end that i might be doing wrong to create this error? Thanks, Jesse P.S. I really appreciate that PlantCV exists and what y'all have done to keep it so accessible!
Hi @jslyons, mizani
that is mentioned in the error is a dependency of plotnine
, which we removed in PlantCV v4. So I think what is going on is that for some reason when you are installing it is selecting PlantCV v3. As a place to start, with the PlantCV conda environment activated, can you run conda list
and paste here the output?
Hi, thank you for your response. I think it was an issue with the jupyter notebook I was using somehow. I began a more current tutorial and everything worked fine!
Hello,
I am having some unexpected issue on installing plantCV. I installed plantcv using 'pip' and when I typed
'from plantcv import plantcv as pcv'
File ~/anaconda3/lib/python3.9/site-packages/plantcv/plantcv/init.py:20 18 from plantcv.plantcv.rgb2gray_cmyk import rgb2gray_cmyk 19 from plantcv.plantcv.gaussian_blur import gaussian_blur ---> 20 from plantcv.plantcv import transform 21 from plantcv.plantcv import hyperspectral 22 from plantcv.plantcv import spectral_index
File ~/anaconda3/lib/python3.9/site-packages/plantcv/plantcv/transform/init.py:15 13 from plantcv.plantcv.transform.nonuniform_illumination import nonuniform_illumination 14 from plantcv.plantcv.transform.resize import resize, resize_factor ---> 15 from plantcv.plantcv.transform.warp import warp, warp_align 16 from plantcv.plantcv.transform.gamma_correct import gamma_correct 18 all = ["get_color_matrix", "get_matrix_m", "calc_transformation_matrix", "apply_transformation_matrix", 19 "save_matrix", "load_matrix", "correct_color", "create_color_card_mask", "quick_color_check", 20 "find_color_card", "rescale", "nonuniform_illumination", "resize", "resize_factor", 21 "warp", "rotate", "warp", "warp_align", "gamma_correct"]
File ~/anaconda3/lib/python3.9/site-packages/plantcv/plantcv/transform/warp.py:10 8 from plantcv.plantcv import fatal_error 9 from plantcv.plantcv import color_palette ---> 10 from plantcv.plantcv.visualize import overlay_two_imgs 11 from plantcv.plantcv.transform import rescale 12 from skimage import img_as_ubyte
File ~/anaconda3/lib/python3.9/site-packages/plantcv/plantcv/visualize/init.py:3 1 from plantcv.plantcv.visualize.pseudocolor import pseudocolor 2 from plantcv.plantcv.visualize.colorize_masks import colorize_masks ----> 3 from plantcv.plantcv.visualize.histogram import histogram 4 from plantcv.plantcv.visualize.clustered_contours import clustered_contours 5 from plantcv.plantcv.visualize.colorspaces import colorspaces
File ~/anaconda3/lib/python3.9/site-packages/plantcv/plantcv/visualize/histogram.py:10 8 from plantcv.plantcv._debug import _debug 9 import pandas as pd ---> 10 from plotnine import ggplot, aes, geom_line, labels, scale_color_manual 13 def _hist_gray(gray_img, bins, lower_bound, upper_bound, mask=None): 14 """Prepare the ready to plot histogram data. 15 16 Inputs: (...) 35 :return hist_gray_data: numpy.ndarray 36 """
File ~/anaconda3/lib/python3.9/site-packages/plotnine/init.py:1 ----> 1 from .qplot import qplot # noqa: F401 2 from .ggplot import ggplot, ggsave # noqa: F401 3 from .ggplot import save_as_pdf_pages # noqa: F401
File ~/anaconda3/lib/python3.9/site-packages/plotnine/qplot.py:9 6 import numpy as np 7 from patsy.eval import EvalEnvironment ----> 9 from .ggplot import ggplot 10 from .mapping.aes import aes, ALL_AESTHETICS, SCALED_AESTHETICS 11 from .labels import labs
File ~/anaconda3/lib/python3.9/site-packages/plotnine/ggplot.py:17 14 from patsy.eval import EvalEnvironment 16 from .mapping.aes import aes, make_labels ---> 17 from .layer import Layers 18 from .facets import facet_null 19 from .facets.layout import Layout
File ~/anaconda3/lib/python3.9/site-packages/plotnine/layer.py:6 3 import pandas as pd 5 from .exceptions import PlotnineError ----> 6 from .utils import array_kind, ninteraction 7 from .utils import check_required_aesthetics, defaults 8 from .mapping.aes import aes, NO_GROUP, SCALED_AESTHETICS
File ~/anaconda3/lib/python3.9/site-packages/plotnine/utils.py:22 20 from matplotlib.patches import Rectangle 21 from mizani.bounds import zero_range ---> 22 from mizani.utils import multitype_sort 24 from .mapping import aes 25 from .exceptions import PlotnineError, PlotnineWarning
ImportError: cannot import name 'multitype_sort' from 'mizani.utils' (/Users/maxmiao/anaconda3/lib/python3.9/site-packages/mizani/utils.py)
I am not really sure why this is happening? the utils.py is in the mizani package is present and so I don't know if I should just ignore this or not?
Thanks, Max