Resnet is a popular model for image recognition.
When I tried to clone it from github and run it, I got the following error message:
ImportError: No module named 'official'
The source code includes the following import statement:
import tensorflowastf#pylint:disable=g-bad-import-order
from official.mnist import dataset
from official.utils.arg_parsers import parsers
from official.utils.logs import hooks_helper
from official.utils.misc import model_helpers
In other words, there is no module called official, but
You cannot install the module itself.
In the first place, how do I install a module called official?
I'm very sorry, but if anyone knows, please let me know.
Thank you for your cooperation.
python python3 tensorflow
The TensorFlow Models does not have the setup.py
script, although we do not know if it is for sample or under development.Therefore, you can't install the tool as it is, and it will be treated the same as the module you wrote.
To enable the import
statement below the following line, make sure that you write the directory appropriately if you want to place the program outside of the models
directory, or
from official.mnist import dataset
Add the models
directory to the environment variable PYTHONPATH
as follows:
export PYTHONPATH="$PYTHONPATH:/path/to/models
Then install the dependency packages required for official.official
directory has requirements.txt
so you can install them with pip
as follows:
pip3 install-rofficial/requirements.txt
© 2025 OneMinuteCode. All rights reserved.