The ImportError: cannot import name 'net_if_addrs'

Hello. When I trained classification and mulitask-classification models in container whose tag was nvcr.io/nvidia/tao/tao-toolkit:4.0.0-tf1.15.5, I met the problems like the picture below in the process of Tao training.

How could I do to deal with the problem ?

I test with below step and cannot reproduce the import error.
Could you also test as below?

$ docker run --runtime=nvidia -it --rm nvcr.io/nvidia/tao/tao-toolkit:4.0.0-tf1.15.5 /bin/bash

>>> import psutil
>>> psutil.__version__
'5.9.3'
>>> from psutil import net_if_addrs
>>>

I also try nvcr.io/nvidia/tao/tao-toolkit:4.0.1-tf1.15.5 . There is no issue.

$ docker run --runtime=nvidia -it --rm nvcr.io/nvidia/tao/tao-toolkit:4.0.1-tf1.15.5 /bin/bash
>>> import psutil
>>> psutil.__version__
'5.9.4'
>>> from psutil import net_if_addrs
>>>

Thank you very much ! I followed your command and tested the codes sucessfully.

However. Could I install jupyter notebook in the container nvcr.io/nvidia/tao/tao-toolkit:4.0.0-tf1.15.5 to run to notebooks from NVIDIA-AI-IOT/nvidia-tao (github.com) ?

For running notebook, please download notebook from the guide in TAO Toolkit Quick Start Guide - NVIDIA Docs

Excuse me. I got the same error after I ran the setup_env.sh. Which parts in the setup_env.sh should be edited ?

The contents below are the commands I ran.

import os
if os.environ["GOOGLE_COLAB"] == "1":
    os.environ["bash_script"] = "setup_env.sh"
else:
    os.environ["bash_script"] = "setup_env_desktop.sh"

!sed -i "s|PATH_TO_COLAB_NOTEBOOKS|$COLAB_NOTEBOOKS_PATH|g" $COLAB_NOTEBOOKS_PATH/tensorflow/$bash_script

!sh $COLAB_NOTEBOOKS_PATH/tensorflow/$bash_script

The contents below are the setup_env.sh

#!/bin/sh

# Install Python 3.6 as the default version
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt-get update
sudo apt-get install python3.6 -y
apt install python3-pip -y
apt-get install python3.6-distutils
apt-get install python3.6-dev

# Set Python 3.6 as the default version
rm /usr/bin/python
ln -sf /usr/bin/python3.6 /usr/bin/python3
ln -sf /usr/bin/python3.6 /usr/local/bin/python

python3.6 -m pip install --upgrade pip
python3.6 -m pip install google-colab
python3.6 -m pip install nvidia-pyindex

# Install Tensorflow
python3.6 -m pip install https://developer.download.nvidia.com/compute/redist/nvidia-horovod/nvidia_horovod-0.20.0+nv20.10-cp36-cp36m-linux_x86_64.whl
python3.6 -m pip install https://developer.download.nvidia.com/compute/redist/nvidia-tensorflow/nvidia_tensorflow-1.15.4+nv20.10-cp36-cp36m-linux_x86_64.whl

# Install Cmake
cd /tmp
wget https://github.com/Kitware/CMake/releases/download/v3.14.4/cmake-3.14.4-Linux-x86_64.sh
chmod +x cmake-3.14.4-Linux-x86_64.sh
./cmake-3.14.4-Linux-x86_64.sh --prefix=/usr/local --exclude-subdir --skip-license
rm ./cmake-3.14.4-Linux-x86_64.sh

# Install dependencies
python3.6 -m pip install nvidia-eff==0.5.3
python3.6 -m pip install nvidia-tao==4.0.0
python3.6 -m pip install --ignore-installed PyYAML -r /root/nvidia-tao/tensorflow/requirements-pip.txt -f https://download.pytorch.org/whl/torch_stable.html --extra-index-url https://developer.download.nvidia.com/compute/redist

# Install code related wheels
python3.6 -m pip install nvidia-tao-tf1==4.0.0.657.dev0 

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks

Did you download notebook from TAO Toolkit Quick Start Guide - NVIDIA Docs and run it?
It is not related to colab.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.