There are two possible problems here:

  1. make sure Project is on the python path, otherwise it cannot find code
  2. code is an internal module in the python standard library which might cause name clashes, see https://docs.python.org/2/library/code.html . To avoid this, change the folder name to src, or anything else but code.
Answer from Nora on Stack Overflow
🌐
GitHub
github.com › Techainer › mlchain-python › issues › 22
ModuleNotFoundError: No module named 'code.server'; 'code' is not a package · Issue #22 · Techainer/mlchain-python
October 27, 2020 - Some may encounter this at mlchain run Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker worker.init_process() File "/u...
Author: Techainer
Discussions

python - No Module named utils.utils , utils is not a package - Stack Overflow
I have a Project where there is a python(.py) file inside a Directory say A, under the folder A , I have a file having the code: from utils.utils import csv_file_transform where utils is a sibling More on stackoverflow.com
🌐 stackoverflow.com
i have a problem with importing packages in python
I think it would be a lot more easy if you would copy the code including the module name. Have you installed the module with pip or conda? Are you in the right env? More on reddit.com
🌐 r/vscode
14
0
August 3, 2023
python - ModuleNotFoundError: No module named utils - Stack Overflow
I'm trying to run the python code in jupyter. The error I'm getting is: from utils import get_data ModuleNotFoundError: No module named 'utils' Which relates to line: from utils import get_data I ... More on stackoverflow.com
🌐 stackoverflow.com
ModuleNotFoundError: No module named 'utils.json_util'; 'utils' is not a package
I've added these lines of code in comfyui_to_python.py: but now: (env) (base) PS D:\pinokio\api\comfy.git\app\custom_nodes\ComfyUI-to-Python-Extension> python comfyui_to_python.py current_di... More on github.com
🌐 github.com
13
February 9, 2025
🌐
freeCodeCamp
freecodecamp.org › news › module-not-found-error-in-python-solved
ModuleNotFoundError: no module named Python Error [Fixed]
September 12, 2022 - In some cases, you may have installed the module you need, but trying to use it still throws the ModuleNotFound error. In such cases, it could be that you spelled it incorrectly. Take, for example, this code:
🌐
OneUptime
oneuptime.com › home › blog › how to fix 'modulenotfounderror' in python
How to Fix 'ModuleNotFoundError' in Python
January 24, 2026 - # For namespace packages, ensure you're importing correctly # and the parent directory is in sys.path · Relative imports require the code to be part of a package: # utils/helper.py from .
🌐
Stack Overflow
stackoverflow.com › questions › 71460475 › no-module-named-utils-utils-utils-is-not-a-package
python - No Module named utils.utils , utils is not a package - Stack Overflow
I am not sure if that is your case, but if you have a file with the same name in root dir and in some nested dir, and you assume you import it from a nested dir (as you see in your IDE with all imports explicitly written, it seems to be OK in IDE), your code will probably try to import the first file from the root dir (python has its own approach to dll hell), and, as it is readable, but probably your root dir has no init.py, it will not be considered a valid module thus give you an error as if you don't put __init__py into the nested dir.
🌐
Towards Data Science
towardsdatascience.com › home › programming › how to fix modulenotfounderror and importerror
How to Fix ModuleNotFoundError and ImportError | Towards Data Science
September 13, 2020 - Now we're up to speed with how the basic import statement is executed and what is the difference between absolute and relative imports we can now go ahead and discuss what to do when your Python application fails with either ModuleNotFoundError ** or** ImportError . In most of the cases, either of the errors occur due to the fact that Python is unable to resolve the module's name in sys.path .
🌐
YouTube
youtube.com › watch
ModuleNotFoundError no module named utils (VSCode / Visual Studio Code) How To Fix - YouTube
Sign Up 👻👻👉 https://semicolon.dev/YouTube(We're free online community, meet other makers!)ModuleNotFoundError no module named utilsHow to install curlHow
Published: August 16, 2022
Find elsewhere
🌐
Reddit
reddit.com › r/vscode › i have a problem with importing packages in python
r/vscode on Reddit: i have a problem with importing packages in python
August 3, 2023 -

In my python script I wrote:

import package.module
package.module.b()

for some reason it cant find the package and also calls it a module in the error

ModuleNotFoundError: No module named 'package'

i checked the spelling and the names of the module and the package

if you explain this it would me a lot thanks!

🌐
OneUptime
oneuptime.com › home › blog › how to fix 'importerror: no module named' in python
How to Fix 'ImportError: No module named' in Python
January 26, 2026 - Relative imports only work inside packages and can cause confusion. # Project structure: # myproject/ # __init__.py # main.py # utils/ # __init__.py # helpers.py # In helpers.py - WRONG if running helpers.py directly from ..main import something # ImportError or ImportError-related failure if run as a script # Solution 1: Run as a module # python -m myproject.utils.helpers # Solution 2: Use absolute imports from myproject.main import something # Solution 3: Add to path (not recommended for production) import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).parent.parent)) from main import something
🌐
Stack Overflow
stackoverflow.com › questions › 62704653 › modulenotfounderror-no-module-named-utils
python - ModuleNotFoundError: No module named utils - Stack Overflow
I'm trying to run the python code in jupyter. The error I'm getting is: from utils import get_data ModuleNotFoundError: No module named 'utils' Which relates to line: from utils import get_data I ...
🌐
GitHub
github.com › pydn › ComfyUI-to-Python-Extension › issues › 105
ModuleNotFoundError: No module named 'utils.json_util'; 'utils' is not a package · Issue #105 · pydn/ComfyUI-to-Python-Extension
February 9, 2025 - I've added these lines of code in comfyui_to_python.py: but now: (env) (base) PS D:\pinokio\api\comfy.git\app\custom_nodes\ComfyUI-to-Python-Extension> python comfyui_to_python.py current_di...
Author: pydn
🌐
Medium
medium.com › @ryan_forrester_ › fixing-no-module-named-errors-in-python-a-complete-guide-b989b7a2bd19
Fixing ‘No Module Named’ Errors in Python: A Complete Guide | by ryan | Medium
May 14, 2025 - When Python can’t find a module you’re trying to import, it throws a `ModuleNotFoundError`. Here’s what it looks like:
🌐
Codemia
codemia.io › home › knowledge hub › modulenotfounderror no module named 'utils'
ModuleNotFoundError No module named 'utils' | Codemia
September 23, 2025 - The `utils` module might be an external library that needs to be installed before use. If it is not included in the Python Standard Library, it needs to be installed via a package manager like pip.
🌐
Tutorial Reference
tutorialreference.com › home › python › examples › faq › how to resolve "modulenotfounderror: no module named ..." in python
How to Resolve "ModuleNotFoundError: No Module Named ..." in Python | Tutorial Reference
The site-packages directory (where pip installs third-party packages). If the module is not found in any of these locations, Python raises a ModuleNotFoundError.
Top answer
1 of 16
327

Based on your comments to orip's answer, I guess this is what happened:

  1. You edited __init__.py on Windows.
  2. The Windows editor added something nonprinting, perhaps a carriage-return (end-of-line in Windows is CR/LF; in Unix it is LF only), or perhaps a Ctrl + Z (windows end-of-file).
  3. You used WinSCP to copy the file to your Unix box.
  4. WinSCP thought: "This has something that's not basic text; I'll put a .bin extension to indicate binary data."
  5. The missing __init__.py file (now called __init__.py.bin) means Python doesn't understand toolkit as a package.
  6. You create the __init__.py file in the appropriate directory and everything works...?
2 of 16
116

I ran into something very similar when I did this exercise in LPTHW; I could never get Python to recognise that I had files in the directory I was calling from. But I was able to get it to work in the end. What I did, and what I recommend, is to try this:

(NOTE: From your initial post, I am assuming you are using an *NIX-based machine and are running things from the command line, so this advice is tailored to that. Since I run Ubuntu, this is what I did)

  1. Change directory (cd) to the directory above the directory where your files are. In this case, you're trying to run the mountain.py file, and trying to call the toolkit.interface.py module, which are in separate directories. In this case, you would go to the directory that contains paths to both those files (or in other words, the closest directory that the paths of both those files share). Which in this case is the toolkit directory.

  2. When you are in the toolkit directory, enter this line of code on your command line:

    export PYTHONPATH=.

    This sets your PYTHONPATH to ".", which basically means that your PYTHONPATH will now look for any called files within the directory you are currently in, (and more to the point, in the sub-directory branches of the directory you are in. So it doesn't just look in your current directory, but in all the directories that are in your current directory).

  3. After you've set your PYTHONPATH in the step above, run your module from your current directory (the toolkit directory). Python should now find and load the modules you specified.

🌐
PyDevTools
pydevtools.com › home › python developer tooling handbook › how to › how to fix modulenotfounderror: no module named 'package'
Fix ModuleNotFoundError: No Module Named (Any Package) | pydevtools
September 7, 2026 - Quick fix: run your code through uv with uv run python app.py instead of python app.py. uv run selects your project’s environment, so the packages you added with uv add are the packages your code sees.