pythontensorflowgoogle-colaboratorymozilla-deepspeech

tensorflow dependencies continuously gives me errors in colab during installation of deepspeech environment


when I run the following command on Google Colab

!pip3 install --upgrade pip==20.0.2 wheel==0.34.2 setuptools==46.1.3
!pip3 install --upgrade --force-reinstall -e .

Got an error

    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-probability 0.12.1 requires gast>=0.3.2, but you have gast 0.2.2 which is incompatible.
networkx 2.5.1 requires decorator<5,>=4.3, but you have decorator 5.0.9 which is incompatible.
moviepy 0.2.3.5 requires decorator<5.0,>=4.0.2, but you have decorator 5.0.9 which is incompatible.
google-colab 1.0.0 requires pandas~=1.1.0; python_version >= "3.0", but you have pandas 1.2.4 which is incompatible.
google-colab 1.0.0 requires requests~=2.23.0, but you have requests 2.25.1 which is incompatible.
google-colab 1.0.0 requires six~=1.15.0, but you have six 1.16.0 which is incompatible.
Successfully installed Mako-1.1.4 MarkupSafe-2.0.1 PrettyTable-2.1.0 PyYAML-5.4.1 absl-py-0.12.0 alembic-1.6.4 appdirs-1.4.4 astor-0.8.1 attrdict-2.0.1 attrs-21.2.0 audioread-2.1.9 beautifulsoup4-4.9.3 bs4-0.0.1 cached-property-1.5.2 certifi-2020.12.5 cffi-1.14.5 chardet-4.0.0 cliff-3.7.0 cmaes-0.8.2 cmd2-1.5.0 colorama-0.4.4 colorlog-5.0.1 decorator-5.0.9 deepspeech-training-0.9.3 ds-ctcdecoder-0.9.3 gast-0.2.2 google-pasta-0.2.0 greenlet-1.1.0 grpcio-1.38.0 h5py-3.2.1 idna-2.10 importlib-metadata-4.0.1 joblib-1.0.1 keras-applications-1.0.8 keras-preprocessing-1.1.2 librosa-0.8.0 llvmlite-0.31.0 markdown-3.3.4 numba-0.47.0 numpy-1.18.5 opt-einsum-3.3.0 optuna-2.7.0 opuslib-2.0.0 packaging-20.9 pandas-1.2.4 pbr-5.6.0 pooch-1.3.0 progressbar2-3.53.1 protobuf-3.17.1 pycparser-2.20 pyparsing-2.4.7 pyperclip-1.8.2 python-dateutil-2.8.1 python-editor-1.0.4 python-utils-2.5.6 pytz-2021.1 pyxdg-0.27 requests-2.25.1 resampy-0.2.2 scikit-learn-0.24.2 scipy-1.6.3 semver-2.13.0 setuptools-57.0.0 six-1.16.0 soundfile-0.10.3.post1 soupsieve-2.2.1 sox-1.4.1 sqlalchemy-1.4.15 stevedore-3.3.0 tensorboard-1.15.0 tensorflow-1.15.4 tensorflow-estimator-1.15.1 termcolor-1.1.0 threadpoolctl-2.1.0 tqdm-4.61.0 typing-extensions-3.10.0.0 urllib3-1.26.4 wcwidth-0.2.5 werkzeug-2.0.1 wheel-0.36.2 wrapt-1.12.1 zipp-3.4.1
WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv
WARNING: The following packages were previously imported in this runtime:
  [astor,cffi,colorama,dateutil,decorator,google,numpy,pandas,pkg_resources,pyparsing,pytz,six,wcwidth]
You must restart the runtime in order to use newly installed versions.

and when I update gast version 0.2.2 to 0.3.2 it says it requires gast version 0.2.2 again and when i downgrade from gast version 0.3.2 to 0.2.2 it says it requires gast version 0.2.2 again (vice-versa) enter image description here


Solution

  • First do not forget to restart runtime after running your current cell. i.e.

    !pip3 install folium==0.2.1
    !pip3 install --upgrade pip==20.0.2 wheel==0.34.2 setuptools==46.1.3
    !pip3 install --upgrade --force-reinstall -e .
    
    # Restart Colab after this cell
    

    I was getting the same errors. But It does not affect the training as we are re-installing the tensorflow-gpu==1.15.2 (Deepspeech's dependency) in the later step (Please setup your GPU configurations first then uninstall and reinstall the tensorflow).

    ### Setting-up GPU for training
    
    #### Checking if we have nvidia or not
    
    !nvcc --version
    !nvidia-smi
    
    #### Setting up environment variables for cuda
    
    ! echo $PATH
    
    import os
    os.environ['PATH'] += ":/usr/local/cuda-10.0/bin"
    os.environ['CUDADIR'] = "/usr/local/cuda-10.0"
    os.environ['LD_LIBRARY_PATH'] = "/usr/lib64-nvidia:/usr/local/cuda-10.0/lib64"
    
    !echo $PATH
    !echo $LD_LIBRARY_PATH
    !source ~/.bashrc
    
    !env | grep -i cuda
    
    ####  Adding freeglut and other OPENGL packaged for deepspeech requirement satisfaction
    
    %cd /content/
    !wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
    !sudo apt-get install freeglut3 freeglut3-dev libxi-dev libxmu-dev
    !sudo apt-get install build-essential dkms
    !sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
    !sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
    
    !sudo apt-get update
    !sudo apt-get install cuda-10-0
    
    !sudo rm /usr/local/cuda
    !sudo ln -s /usr/local/cuda-10.0 /usr/local/cuda
    %ls -l /usr/local/
    
    **# Finally uninstalling and reinstalling tensorflow**
    !pip3 uninstall tensorflow
    !pip3 install 'tensorflow-gpu==1.15.2'
    

    Also use following snippet once you finished installing all dependencies to fix broken dependencies

    !sudo apt-get -o Dpkg::Options::="--force-overwrite" install --fix-broken