I have a Python file that I'm trying to import into a session. The file structure looks like the following
-object_detection
--__init__.py
--export_inference_graphy.py
--protos
---__init__.py
---pipeline_pb2.py
From the export_inference_graph file, I'm trying to import pipeline_pb2.
However, I get the following error.
from object_detection.protos import pipeline_pb2
Traceback (most recent call last):
File "<ipython-input-60-76f12fdd6acf>", line 1, in <module>
from object_detection.protos import pipeline_pb2
ModuleNotFoundError: No module named 'object_detection.protos'; 'object_detection' is not a package
I've also tried the following and each has resulted in the same error.
import sys
sys.path.append('/protos')
import pipeline_pb2
from ..protos import pipeline_pb2
Related
Does anyone know how to solve this problem?
PS C:\Users\lukman\Desktop\token_multi_sender> python3 main.py
Traceback (most recent call last):
File "C:\Users\lukman\Desktop\token_multi_sender\main.py", line 6, in <module>
from token_multi_sender import TokenMultiSender
File "C:\Users\lukman\Desktop\token_multi_sender\token_multi_sender.py", line 6, in <module>
from web3 import Web3
ModuleNotFoundError: No module named 'web3'
this the beginning of my main.py
from typing import List
from dotenv import dotenv_values
from config import Config
from token_multi_sender import TokenMultiSender
and this is in my token_multi_sender.py
import json
import time
from typing import List, Dict, Callable
from web3 import Web3
from config import Config
from utils import load_json_from_file, WalletType
I am already including web3 but still have this
I want to import module in another direcotory.
But when i import it, this error occurs.
how can i import file in another directory in emr notebook?
I tried below code.
import utils.mysql_util
Traceback (most recent call last):
ModuleNotFoundError: No module named 'utils'
the file that i execute location is batch_pipeline/logdata.
module that i want to import is in batch_pipeline/utils.
I have a utils file from a GitHub repo and I added some simple functions to it (to unpick and pickle) and the import statement
from utils import existing_module, unpicklefile
returns the following
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: cannot import name 'unpicklefile' from 'utils'
but the other functions import fine, so this isn't a sys.path error.
Help :D
when I run the command to import my python file, i am getting import error saying no modue named app.management.commands.
>>> from app.management.commands import scripty
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named app.management.commands
Can anyone please help me.
Is app.management.commands in your sys path?
Looks like you have to import it using <project_name>.app.management.commands.
When I try to import multiprocessing in Python 2.7.5 on OS X 10.6.8, I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/__init__.py", line 65, in <module>
from multiprocessing.util import SUBDEBUG, SUBWARNING
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/util.py", line 40, in <module>
from subprocess import _args_from_interpreter_flags
ImportError: cannot import name _args_from_interpreter_flags
I also tried to install python2.7.6 with homebrew, but this error still occurs.
It sounds like a circular import issue. Try adding this to the the rest of your imports:
from subprocess import _args_from_interpreter_flags
There is a comment above the function in subprocess.py:
# XXX This function is only used by multiprocessing and the test suite,
# but it's here so that it can be imported when Python is compiled without
# threads.
May be related.