Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29259

Import error even though file is clearly in path

$
0
0

I am running a script and I am getting the error:

Traceback (most recent call last):
  File "common/tensorflow/run_tf_benchmark.py", line 30, in <module>
    from common.base_benchmark_util import BaseBenchmarkUtil
ModuleNotFoundError: No module named 'common'

I am running on an ec2 instance with the following AMI: Deep Learning AMI (Ubuntu 16.04) Version 25.0 (ami-025c308193ac1a136) and I am also working in the tensorflow_p36 anaconda environment that comes from the AMI. My Ubuntu directory is structured as so:

home
--ubuntu
  --benchmark_models
    --benchmark    
      --common
        --__init__.py
        --base_benchmark_util.py
        --tensorflow
          --run_tf_benchmark.py
          --__init__.py

Note, there are other files in the directory, but these are the relevant python files. Currently, the imports at the top of run_tf_benchmark.py are

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function


import sys
sys.path.append('/home/ubuntu/benchmark_models/benchmarks/common')
print(sys.path)
from argparse import ArgumentParser
from common.base_benchmark_util import BaseBenchmarkUtil

and the printed sys.path is

['/home/ubuntu/benchmark_models/benchmarks/common/tensorflow', '/home/ubuntu/src/cntk/bindings/python',
 '/home/ubuntu/benchmark_models/models/image_recognition/tensorflow/mobilenet_v2', '/home/ubuntu/models',
 '/home/ubuntu/models/research', '/home/ubuntu/models/research/slim', 
'/home/ubuntu/anaconda3/lib/python36.zip', '/home/ubuntu/anaconda3/lib/python3.6', 
'/home/ubuntu/anaconda3/lib/python3.6/lib-dynload', '/home/ubuntu/anaconda3/lib/python3.6/site-packages',
 '/home/ubuntu/benchmark_models/benchmarks/common']

I can clearly see common in the python path, but the import error still happens. What am I doing wrong?


Viewing all articles
Browse latest Browse all 29259

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>