haesleinhuepf / BioImageAnalysisNotebooks

Python Jupyter notebooks for BioImageAnalysis, GPU-accelerated image processing, bio-image data science and more
https://haesleinhuepf.github.io/BioImageAnalysisNotebooks
BSD 3-Clause "New" or "Revised" License
115 stars 32 forks source link

Error in importing the package #33

Closed Mojzaar closed 1 year ago

Mojzaar commented 1 year ago

when I use: import pyclesperanto_prototype as cle I get this error:


TypeError Traceback (most recent call last) /tmp/ipykernel_9974/4056458295.py in 1 from skimage.io import imread ----> 2 from pyclesperanto_prototype import imshow 3 import pyclesperanto_prototype as cle 4 import matplotlib.pyplot as plt

~/.local/lib/python3.8/site-packages/pyclesperanto_prototype/init.py in ----> 1 from ._tier0 import 2 from ._tier1 import 3 from ._tier2 import 4 from ._tier3 import 5 from ._tier4 import *

~/.local/lib/python3.8/site-packages/pyclesperanto_prototype/_tier0/init.py in 34 from ._push import push 35 from ._push import push as asarray ---> 36 from ._plugin_function import plugin_function 37 from ._types import Image 38 from ._cl_info import cl_info

~/.local/lib/python3.8/site-packages/pyclesperanto_prototype/_tier0/_plugin_function.py in 6 7 from ._create import create_like ----> 8 from ._types import Image, is_image 9 from ._push import push 10

~/.local/lib/python3.8/site-packages/pyclesperanto_prototype/_tier0/_types.py in 1 import numpy as np ----> 2 from ._pycl import OCLArray, _OCLImage 3 import pyopencl as cl 4 from typing import Union 5

~/.local/lib/python3.8/site-packages/pyclesperanto_prototype/_tier0/_pycl.py in 4 5 import numpy as np ----> 6 import pyopencl as cl 7 from pyopencl import characterize 8 from pyopencl import array

~/.local/lib/python3.8/site-packages/pyopencl/init.py in 28 29 # must import, otherwise dtype registry will not be fully populated ---> 30 import pyopencl.cltypes # noqa: F401 31 32 import logging

~/.local/lib/python3.8/site-packages/pyopencl/cltypes.py in 20 21 import numpy as np ---> 22 from pyopencl.tools import get_or_register_dtype 23 import warnings 24

~/.local/lib/python3.8/site-packages/pyopencl/tools.py in 134 135 import numpy as np --> 136 from pytools import memoize, memoize_method 137 from pyopencl._cl import bitlog2, get_cl_header_version # noqa: F401 138 from pytools.persistent_dict import KeyBuilder as KeyBuilderBase

~/.local/lib/python3.8/site-packages/pytools/init.py in 811 812 --> 813 class keyed_memoize_on_first_arg(Generic[T, P, R]): # noqa: N801 814 """Like :func:memoize_method, but for functions that take the object 815 in which memoization information is stored as first argument.

/usr/local/lib/python3.8/typing.py in inner(*args, *kwds) 259 except TypeError: 260 pass # All real errors (not unhashable args) are raised below. --> 261 return func(args, **kwds) 262 return inner 263

/usr/local/lib/python3.8/typing.py in __class_getitem(cls, params) 888 # Generic and Protocol can only be subscripted with unique type variables. 889 if not all(isinstance(p, TypeVar) for p in params): --> 890 raise TypeError( 891 f"Parameters to {cls.name__}[...] must all be type variables") 892 if len(set(params)) != len(params):

TypeError: Parameters to Generic[...] must all be type variables

haesleinhuepf commented 1 year ago

If I interpret the information here correctly, this means the version of pyopencl you have installed is only compatible with Python 3.9. Can you follow the installation instructions here and try again?

haesleinhuepf commented 1 year ago

I presume this was solved. If not, please create another issue.