Closed tischi closed 1 year ago
I'd say no, as bia-bob does not call any function from skimage. This issue is related to #42 . We should provide guidance in the installation instructions
OK, that makes sense!
pip install bia-bob
only installs anything that is necessary for bia-bob.
The code however currently contains:
class Context:
assistant = None
variables = None
verbose = False
chat = []
libraries = keep_available_packages([
"scikit-image",
"numpy",
"scipy",
"pandas",
"matplotlib",
"seaborn",
"scikit-learn",
"stackview",
"torch",
"pytorch-lightning",
"cellpose",
"stardist",
"n2v",
"pyclesperanto-prototype",
"apoc",
"napari-segment-blobs-and-things-with-membranes",
"napari-simpleitk-image-processing",
"napari-skimage-regionprops",
# to add libraries here, add their pypi package names (not their import names)
])
We need then to provide installations instructions that satisfy this list.
Ideally the list that we provide internally to chatGPT would be auto-generated.
This is one option:
import pkg_resources
installed_packages = [(d.project_name, d.version) for d in pkg_resources.working_set]
installed_packages
Ideally the list that we provide internally to chatGPT would be auto-generated.
Yes, check what this function does: https://github.com/haesleinhuepf/bia-bob/blob/4bb525d13fe7209d440841b511776bda3aa33231/src/bia_bob/_utilities.py#L150 It filters out libraries which are not installed from the given list. Also see our discussion in #30 and #28
This is one option:
import pkg_resources
Note that pkg_resources
is deprecated. https://setuptools.pypa.io/en/latest/pkg_resources.html
What about this then?
from importlib.metadata import distributions
installed_packages = [(dist.metadata['Name'], dist.version) for dist in distributions()]
It would be a matter of trying...
I would however like to have the option to have a blacklist or a whitelist of packages. For example, code using OpenCV is pretty useless for my work...
What about this then?
Can you also phrase again the goal of the modification you are propsing? I'm not sure what's the issue.
I would like to provide chatGPT dynamically with the context of the currently available libraries.
Maybe I am misunderstanding the current use of Context.libraries
...could you elaborate what this list is supposed to be used for?
The idea was to have a whitelist for libraries. If you provide all available libraries, chatGPT might come up with bad solutions, e.g. using Pillow or OpenCV, which might not be good for our purpooses... We could also put them on a blacklist if you think that makes more sense.
My reasoning comes from the lessons learned in this notebook: https://haesleinhuepf.github.io/BioImageAnalysisNotebooks/07_prompt_engineering/03_generating_code.html
understood!
ModuleNotFoundError: No module named 'skimage'
I think that must be part of
pip install bia-bob