[GH-ISSUE #209] ModuleNotFoundError on existing module and fine working script #191

Closed
opened 2026-02-26 12:20:46 +03:00 by kerem · 5 comments
Owner

Originally created by @PierreBarreau on GitHub (Nov 2, 2021).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/209

Hi (first question on GitHub, hope I'm doing it good)

I'm facing an issue on the import of the Cisco Meraki SDK (an SDK to manage network devices), it's the first time where hidden-imports or paths can't solve my issue. I'm using:

  • Python 3.7.4
  • meraki-1.12.0
  • auto-py-to-exe-2.10.1
  • pyinstaller-4.6

The command I use to compile on auto_py_to_exe : pyinstaller --noconfirm --onefile --console --no-embed-manifest "path/to/file/list_all_clients.py".

The error appear when launching the exe compiled as shown bellow (code working perferctly in .py):

image

I think the issue comes from the format of the import in the __init__py of meraki. But I'm not good enough understand and solve this. In the code of init.py, the line is written like this

image

If changing the order of the imports, to be sure it's not related to one :

image

I get the same error :

image

I tried to modify the line to be "import rest_session" but unsuccessfully (doing it like this make the .py fail too). I think it comes from the . which for me means it's in current repository.

I also tried to add a path to the lib repository : pyinstaller --noconfirm --onefile --console --no-embed-manifest --paths "path/to/lib/meraki" "path/to/file/list_all_clients.py" without success. Same for the hidden imports.

I don't know if I gave enough information to try to debug.

Thanks in advance,

Originally created by @PierreBarreau on GitHub (Nov 2, 2021). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/209 Hi (first question on GitHub, hope I'm doing it good) I'm facing an issue on the import of the Cisco Meraki SDK (an SDK to manage network devices), it's the first time where hidden-imports or paths can't solve my issue. I'm using: - Python 3.7.4 - meraki-1.12.0 - auto-py-to-exe-2.10.1 - pyinstaller-4.6 The command I use to compile on auto_py_to_exe : `pyinstaller --noconfirm --onefile --console --no-embed-manifest "path/to/file/list_all_clients.py"`. The error appear when launching the exe compiled as shown bellow (code working perferctly in .py): ![image](https://user-images.githubusercontent.com/34342495/139876082-f628c581-920b-452f-ad4b-80975f2fa02d.png) I think the issue comes from the format of the import in the __init__py of meraki. But I'm not good enough understand and solve this. In the code of __init__.py, the line is written like this ![image](https://user-images.githubusercontent.com/34342495/139876378-98d8df0f-8173-489a-b93c-15dd1713b24f.png) If changing the order of the imports, to be sure it's not related to one : ![image](https://user-images.githubusercontent.com/34342495/139877396-63e31cfe-6cc7-43e2-97a7-ee96d1f6de0a.png) I get the same error : ![image](https://user-images.githubusercontent.com/34342495/139877692-7f5e8443-bd05-40c6-9e83-94c078c610be.png) I tried to modify the line to be "import rest_session" but unsuccessfully (doing it like this make the .py fail too). I think it comes from the . which for me means it's in current repository. I also tried to add a path to the lib repository : `pyinstaller --noconfirm --onefile --console --no-embed-manifest --paths "path/to/lib/meraki" "path/to/file/list_all_clients.py"` without success. Same for the hidden imports. I don't know if I gave enough information to try to debug. Thanks in advance,
kerem 2026-02-26 12:20:46 +03:00
  • closed this issue
  • added the
    Stale
    label
Author
Owner

@brentvollebregt commented on GitHub (Nov 3, 2021):

By any chance have you named one of your files meraki.py? Second question would be just to check if you have run your script by itself (without turning it into an exe).

<!-- gh-comment-id:958667697 --> @brentvollebregt commented on GitHub (Nov 3, 2021): By any chance have you named one of your files `meraki.py`? Second question would be just to check if you have run your script by itself (without turning it into an exe).
Author
Owner

@PierreBarreau commented on GitHub (Nov 3, 2021):

I don't have any file named meraki.py and yes I already ran the script as .py without any failure.

I also tried to move my lib repository from it's original position in the Python3-6 repository (where pip putted it) into the repository of my script (still working in .py but still not working as .exe (even with the hidden-imports and paths)

<!-- gh-comment-id:958714355 --> @PierreBarreau commented on GitHub (Nov 3, 2021): I don't have any file named `meraki.py` and yes I already ran the script as `.py` without any failure. I also tried to move my lib repository from it's original position in the Python3-6 repository (where pip putted it) into the repository of my script (still working in `.py` but still not working as `.exe` (even with the hidden-imports and paths)
Author
Owner

@brentvollebregt commented on GitHub (Nov 4, 2021):

@PierreBarreau could you please provide a minimal reproducible example?

<!-- gh-comment-id:960524983 --> @brentvollebregt commented on GitHub (Nov 4, 2021): @PierreBarreau could you please provide a **minimal** reproducible example?
Author
Owner

@github-actions[bot] commented on GitHub (Jan 4, 2022):

This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment on this issue or it will be closed in 5 days.

<!-- gh-comment-id:1004453487 --> @github-actions[bot] commented on GitHub (Jan 4, 2022): This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment on this issue or it will be closed in 5 days.
Author
Owner

@github-actions[bot] commented on GitHub (Jan 9, 2022):

Closing issue due to no activity in more than 60 days.

<!-- gh-comment-id:1008202070 --> @github-actions[bot] commented on GitHub (Jan 9, 2022): Closing issue due to no activity in more than 60 days.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/auto-py-to-exe#191
No description provided.