'Focal-loss pip installation screwed my conda env for supported GPU tensorflow installation
When I did pip install focal-loss <2022-04-20 Wed 10:00> I got this: Installing collected packages: tensorboard-data-server, tf-estimator-nightly, tensorflow-io-gcs-filesystem, tensorboard, libclang, keras, flatbuffers, tensorflow, focal-loss 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:\Ahmed\code\enviorment\conda_env_dir\tf220\Lib\site-packages\tensorflow\lite\experimental\microfrontend\python\ops\_audio_microfrontend_op.so'
Consider using the --user
option or check the permissions.
Now pip list shows tensorboard 2.8
spyder 5.2.2 spyder-kernels 2.2.1 tensorboard 2.8.0 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.0 tensorflow-gpu 2.2.0 tensorflow-gpu-estimator 2.2.0 tensorflow-io-gcs-filesystem 0.24.0
after I run
pip install focal-loss --user*
I end up with unwantedly installed tensorflow 2.8:
Installing collected packages: tensorflow, focal-loss 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. Successfully installed focal-loss-0.0.7 tensorflow-2.8.0
Now I got tensorflow-2.8.0 installed in my conda env originaly created for gpu supported tensorflow-2.2.0
I tried to remove it using
- pip uninstall tensorflow-2.8.0*
Now I got ModuleNotFoundError: No module named 'tf'
- I restarted the conda session and my script craches on this error: AttributeError: module 'tensorflow.python.util.dispatch' has no attribute 'add_fallback_dispatch_list'
- As a last trial I tested the rollback to previous configuration of my conda env using conda list --revisions command, but I the proposed revisons were outdated and did not show much details about current and prvious pip packages installation that I hoped to get back to. So I choose the one befor the last. After running my script, my code still crashes into this error: AttributeError: module 'tensorflow.python.util.dispatch' has no attribute 'add_fallback_dispatch_list' for which I did not find solution on the net.
I wander why for the focal-loss package the pip packages manager do not show prerequests and warnings about incompatible/compatible tensorflow versions and (y/n) options to accept/deny insatallation.
Is there pip command to rollback to previous configuration inside coonda env
Solution 1:[1]
There is some version mismatch problem among packages in your system. You can try again using:
!pip install --upgrade tensorflow-gpu # which will install latest tensorflow version in your environment.
and then install your required package (focal-loss) as below:
!pip install focal-loss # this will install latest focal-loss=0.0.7
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | TFer2 |