artemmavrin / focal-loss

TensorFlow implementation of focal loss
https://focal-loss.readthedocs.io
Apache License 2.0
186 stars 43 forks source link

installing focal loss leads to tensorflow stopping #17

Open AliSaeed86 opened 2 years ago

AliSaeed86 commented 2 years ago

just to notify others, when i installed focal loss using pip install focal-loss, i couldn't import tensorflow nor keras libraries. so to avoid this happen to you, please note that you have to put --user after the line code of focal installation, just as below:

pip install focal-loss --user

artemmavrin commented 2 years ago

Hi, can you please clarify what you mean by "tensorflow stopping" or "I couldn't import tensorflow nor keras libraries"? Thanks!

AliSaeed86 commented 2 years ago

Hi @artemmavrin, i used pip install focal-loss to install focal loss, after installation is completed, i could import tensorflow, it threw an error while executing import tensorflow as tf. unfortunately, i don't remember what was the error exactly, however after i reinstall it using pip install focal-loss --user, it worked properly. so that i wanted to share this issue hopefully it helps someone out there.

note: i am using windows 10 , tesnorflow 2.6 , python 3.8.10.

ahmedmaalej commented 2 years ago

I run into the same problem. It seems that there is a dependency conflict caused by the latest release of focal-loss (cosidering this post date/time) when installed in virtual env. Using pip install focal-loss, leads the package to look for latest tensorflow/tensorboard versions and install them by default. Which in my case, when running it inside my conda virtual enviorment (set up for tf gpu 2.2.0) corrupted my env, and never been able to use the GPU supported tf 2.2.0 on my machine. And I got these messages:

Attempting uninstall: tensorboard Found existing installation: tensorboard 2.2.2 Uninstalling tensorboard-2.2.2: Successfully uninstalled tensorboard-2.2.2 *ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'D:\\me\\code\\enviorment\\conda_env_dir\\tf220\\Lib\\site-packages\\tensorflow\\lite\\experimental\\microfrontend\\python\\ops\\_audio_microfrontend_op.so' Consider using the--useroption or check the permissions.*

I tried to roll back to previous version of my conda env using conda list --revisions command but is did not work. I finally recreated a new envioment and used pip install focal-loss --user as advised by AliSaeed86, and worked fine. Inspite of showing the following warning and error:

`WARNING: The script tensorboard.exe is installed in 'C:\Users\ahmed\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts estimator_ckpt_converter.exe, import_pb_to_tensorboard.exe, saved_model_cli.exe, tensorboard.exe, tf_upgrade_v2.exe, tflite_convert.exe, toco.exe and toco_from_protos.exe are installed in 'C:\Users\ahmed\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
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-gpu 2.2.0 requires tensorboard<2.3.0,>=2.2.0, but you have tensorboard 2.8.0 which is incompatible.