HenriquesLab / ZeroCostDL4Mic

ZeroCostDL4Mic: A Google Colab based no-cost toolbox to explore Deep-Learning in Microscopy
MIT License
559 stars 129 forks source link

Errors when running YOLO notebook while connected to a local runtime #139

Open DaniBodor opened 3 years ago

DaniBodor commented 3 years ago

Describe the bug Whenever I try to run the YOLO notebook from a local runtime I an error. As I am not sure what the correct order of events is when running a local runtime (any steps I can skip? Do I connect to the local runtime from the beginning or after having run one more cells?), I have tried a few different things, but they all result in an error. I will describe the things I have tried below.

EDIT: my bad, I have found the correct requirements file, so you can ignore the comment below. However, the problem remains

_Another potential problem is that I am not sure I have loaded the correct requirements. No 'requirements.txt' file is created when I run the dependencies cell from the notebook on a hosted runtime. Instead, I have found this requirements file, but am not sure if this is complete. My best guess is that if I have the correct requirements file and know the order of events, then the errors will be resolved._

To Reproduce

ModuleNotFoundError: No module named 'tensorflow'

- __EDITED:__ I haven't tried further steps to fix this, but this does remind me of the following error I always get when running cell 1.1 from a hosted runtime, which might be related

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorflow 2.6.0 requires h5py~=3.1.0, but you have h5py 2.10.0 which is incompatible.


- If I try to skip straight to step 3.1 without running cells and 1 and 2 first, I get this error:

NameError Traceback (most recent call last)

in 16 17 ---> 18 full_model_path = os.path.join(model_path,model_name) 19 if os.path.exists(full_model_path): 20 print(bcolors.WARNING+'Model folder already exists and will be overwritten.'+bcolors.NORMAL) NameError: name 'os' is not defined ```
guijacquemet commented 3 years ago

Hi,

Thanks for reaching out! From the error, it looks like TensorFlow is not installed properly in your environment. If you want to use GPU, make sure to also install the correct version of CUDA.

As the first cell is failing, the OS library is not loaded. This is what is giving you the subsequent error.

I hope this helps cheers Guillaume

DaniBodor commented 3 years ago

Thanks for your reply. Can you maybe explain how I can make sure that TensorFlow and CUDA are properly installed? As far as I can tell I am following all the steps listed in the Running notebooks locally tab on wiki and don't know how to proceed.

I have tried:

Also, regarding my original post, maybe I was unclear about the following:

DaniBodor commented 3 years ago

I have since also tried running RetinaNet and U-Net (3D) in a local environment using the auto-generated requirements.txt file, but have run into similar problems.

guijacquemet commented 3 years ago

Hi, Yes, the notebooks are made to be run in Google Colab and do not work straight out of the box locally.

One thing that needs to be removed (or commented out) is the Google Colab specific functions including:

In the YOLO notebook, we use : tensorflow==1.15.2 h5py==2.10

Regarding installing CUDA, check this guide for instance. Just be careful to match the CUDA version to the version of TF you want to use.

Also bear in mind that the requirement files are automatically generated at the moment and may not contain all the libraries required. So you may also need to install a few more manually. We are slowly working on a guide on how to set up the notebook so that they can work locally but this is not yet ready to share.