ModOrganizer2 / modorganizer

Mod manager for various PC games. Discord Server: https://discord.gg/ewUVAqyrQX if you would like to be more involved
http://www.nexusmods.com/skyrimspecialedition/mods/6194
GNU General Public License v3.0
2.2k stars 163 forks source link

MO2.5 encounters an error on startup, but it seems to work normally. #1928

Closed cmradix closed 11 months ago

cmradix commented 11 months ago

The problem:

It looked like it was trying to read my local environment's psutil and raised an unknown error

To Reproduce:

Steps to reproduce the behavior:

  1. Download MO2.5 Release version or any RC version 2.running MO2 3.Get error

Environment:

Details:

psutil version 5.9.6 has been installed in local environment(Python 3.11.6) the path has been correctly set.

Link to Mod Organizer logs:

[2023-11-27` 19:10:24.151 D] command line: '"E:\Games\Skyrim_MO2\ModOrganizer.exe" '
[2023-11-27 19:10:24.152 I] starting Mod Organizer version 2.5.0 revision 22714e5c in E:/Games/Skyrim_MO2, usvfs: 0.5.5.1
[2023-11-27 19:10:24.152 I] data path: E:/Games/Skyrim_MO2
[2023-11-27 19:10:24.152 I] working directory: E:/Games/Skyrim_MO2
[2023-11-27 19:10:24.152 D] timing: MOApplication setup() 0 ms
[2023-11-27 19:10:24.707 E] Failed to import plugin from E:/Games/Skyrim_MO2/plugins/basic_games.
[2023-11-27 19:10:24.707 E] failed to initialize plugin E:/Games/Skyrim_MO2/plugins/basic_games: ImportError: DLL load failed while importing _psutil_windows: 找不到指定的模块。(The specified module could not be found.)
[2023-11-27 19:10:24.707 E] 
[2023-11-27 19:10:24.707 E] At:
[2023-11-27 19:10:24.707 E]   C:\Users\USERNAME\AppData\Roaming\Python\Python311\site-packages\psutil\_pswindows.py(35): <module>
[2023-11-27 19:10:24.707 E]   <frozen importlib._bootstrap>(241): _call_with_frames_removed
[2023-11-27 19:10:24.707 E]   <frozen importlib._bootstrap_external>(940): exec_module
[2023-11-27 19:10:24.707 E]   <frozen importlib._bootstrap>(705): _load_unlocked
[2023-11-27 19:10:24.707 E]   <frozen importlib._bootstrap>(1150): _find_and_load_unlocked
[2023-11-27 19:10:24.707 E]   <frozen importlib._bootstrap>(1176): _find_and_load
[2023-11-27 19:10:24.707 E]   <frozen importlib._bootstrap>(241): _call_with_frames_removed
[2023-11-27 19:10:24.707 E]   <frozen importlib._bootstrap>(1233): _handle_fromlist
[2023-11-27 19:10:24.707 E]   C:\Users\USERNAME\AppData\Roaming\Python\Python311\site-packages\psutil\__init__.py(109): <module>
[2023-11-27 19:10:24.707 E]   <frozen importlib._bootstrap>(241): _call_with_frames_removed
[2023-11-27 19:10:24.707 E]   <frozen importlib._bootstrap_external>(940): exec_module
[2023-11-27 19:10:24.707 E]   <frozen importlib._bootstrap>(705): _load_unlocked
[2023-11-27 19:10:24.707 E]   <frozen importlib._bootstrap>(1149): _find_and_load_unlocked
[2023-11-27 19:10:24.707 E]   <frozen importlib._bootstrap>(1176): _find_and_load
[2023-11-27 19:10:24.708 E]   E:\Games/Skyrim_MO2/plugins\basic_games\origin_utils.py(12): <module>
[2023-11-27 19:10:24.708 E]   <frozen importlib._bootstrap>(241): _call_with_frames_removed
[2023-11-27 19:10:24.708 E]   <frozen importlib._bootstrap_external>(940): exec_module
[2023-11-27 19:10:24.708 E]   <frozen importlib._bootstrap>(705): _load_unlocked
[2023-11-27 19:10:24.708 E]   <frozen importlib._bootstrap>(1150): _find_and_load_unlocked
[2023-11-27 19:10:24.708 E]   <frozen importlib._bootstrap>(1176): _find_and_load
[2023-11-27 19:10:24.708 E]   E:\Games/Skyrim_MO2/plugins\basic_games\basic_game.py(391): setup
[2023-11-27 19:10:24.708 E]   E:\Games/Skyrim_MO2/plugins\basic_games\__init__.py(16): <module>
[2023-11-27 19:10:24.708 E]   <frozen importlib._bootstrap>(241): _call_with_frames_removed
[2023-11-27 19:10:24.708 E]   <frozen importlib._bootstrap_external>(940): exec_module
[2023-11-27 19:10:24.708 E]   <frozen importlib._bootstrap>(705): _load_unlocked
[2023-11-27 19:10:24.708 E]   <frozen importlib._bootstrap>(1149): _find_and_load_unlocked
[2023-11-27 19:10:24.708 E]   <frozen importlib._bootstrap>(1176): _find_and_load
[2023-11-27 19:10:24.708 E] 
[2023-11-27 19:10:28.668 I] using game plugin 'Skyrim Special Edition' ('SkyrimSE', variant Steam, steam id '489830') at E:/SteamLibrary/steamapps/common/Skyrim Special Edition
Holt59 commented 11 months ago

Did you use the installer to update? If you use the archive version and extracted over a 2.4 installation then you will need to clean old files manually, as explained in the release notes.

cmradix commented 11 months ago

Did you use the installer to update? If you use the archive version and extracted over a 2.4 installation then you will need to clean old files manually, as explained in the release notes.

I have tried multiple times to do a fresh installation, including changing the installation location, but it had no effect.

Silarn commented 11 months ago

It looks like it's trying to load a system python library instead of using the packaged python libraries. It really shouldn't do this by default, though at one point there was a setting to allow this. I do not recommend it.

cmradix commented 11 months ago

It looks like it's trying to load a system python library instead of using the packaged python libraries. It really shouldn't do this by default, though at one point there was a setting to allow this. I do not recommend it.

I conducted a rough and simple survey and came up with the following questions:

  1. I noticed that the reference address in the log is C:\Users\USERNAME, and I don't know whether this is a BUG or a privacy mechanism.
  2. When I block the import psutil in plugins\basic_games\origin_utils.py, the problem disappears. I searched all the files, and it seems that only it uses psutil. Obviously, as long as I don't use Origin, it won't affect me, and I can ignore this error.
Silarn commented 11 months ago
  1. Intended.
  2. I guess that's fine as a workaround but it shouldn't be using external python libraries.
ThePagi commented 11 months ago

This is also happening to me, even after uninstalling, removing leftover files and reinstalling. MO is trying to use my user installation of Python 3.11, which I'm using for various stuff so who knows what state it's in. For now I downloaded an older version (Mod Organizer 2-6194-2-4-3-1640472667) that works perfectly fine.

cmradix commented 11 months ago

This is also happening to me, even after uninstalling, removing leftover files and reinstalling. MO is trying to use my user installation of Python 3.11, which I'm using for various stuff so who knows what state it's in. For now I downloaded an older version (Mod Organizer 2-6194-2-4-3-1640472667) that works perfectly fine.

You can try going to the settings and then disable the Python proxy in the plugins. However, be aware that this will prevent all plugins that rely on Python from working.

Alternatively, you can use an editor to open [INSTALL DIRECTORY]\plugins\basic_games\origin_utils.py and delete or comment out the line import psutil. Doing so will temporarily eliminate error reports.

Regardless, this is just a temporary solution to alleviate the experience. It only makes the warning invisible but does not solve the underlying problem. Of course, you can also choose to ignore it, as it's just a minor warning. You may choose to wait for Silarn to address this issue in subsequent releases.

Holt59 commented 11 months ago

@cmradix @ThePagi

Can you try the runner.dll from this PR? Direct link: https://github.com/ModOrganizer2/modorganizer-plugin_python/files/13536824/runner.zip

The file should go in plugins/plugin_python/dlls (backup the previous one before if you need to reinstall it).

cmradix commented 11 months ago

@cmradix @ThePagi

你能试试这个PR吗?直接链接: https://github.com/ModOrganizer2/modorganizer-plugin_python/files/13536824/runner.zip`runner.dll`

该文件应该进入(如果需要重新安装,请先备份前一个文件)。plugins/plugin_python/dlls

it works, the error has disappeared. and after the error was fixed, the startup speed noticeably increased.

Silarn commented 11 months ago

Yeah, probably because it's no longer attempting to load every Python package on the system path. I'll probably put out a dev 2.5.1 build soon with a few fixes.

Armingleggings commented 10 months ago

@cmradix @ThePagi

Can you try the runner.dll from this PR? Direct link: https://github.com/ModOrganizer2/modorganizer-plugin_python/files/13536824/runner.zip

The file should go in plugins/plugin_python/dlls (backup the previous one before if you need to reinstall it).

I used MO2 a long time ago... probably 8 months or more since I used it. I was on version 2.2.1 if that helps with timing. I wanted to start clean so I installed into a new folder entirely. When I ran the exe, I got the same error listed above with freeze this and that. I downloaded this runner file and it worked - cleared all the errors. I don't know if that helps, but there you go.

I have made some path file updates for python to support some development I was doing. I've also been playing with Stable Diffusion which may have involved some config that got in the way. I hope that gives enough detail to narrow down why some of us are getting errors.

cmradix commented 10 months ago

@cmradix @ThePagi Can you try the runner.dll from this PR? Direct link: https://github.com/ModOrganizer2/modorganizer-plugin_python/files/13536824/runner.zip The file should go in plugins/plugin_python/dlls (backup the previous one before if you need to reinstall it).

I used MO2 a long time ago... probably 8 months or more since I used it. I was on version 2.2.1 if that helps with timing. I wanted to start clean so I installed into a new folder entirely. When I ran the exe, I got the same error listed above with freeze this and that. I downloaded this runner file and it worked - cleared all the errors. I don't know if that helps, but there you go.

I have made some path file updates for python to support some development I was doing. I've also been playing with Stable Diffusion which may have involved some config that got in the way. I hope that gives enough detail to narrow down why some of us are getting errors.

I'm not quite sure what you mean, but if you've encountered a similar issue, I suggest using version 2.4 until the update to 2.5.1. The root of the problem is the incorrect use of the system's Python by the Python proxy plugin, instead of the Python that's pre-installed in the plugin. Anyway, this issue will be fixed in the next version.

If you still have similar issues, I recommend opening a new issue with your log. This issue will be closed, so please do not reopen or respond to it.

Sakurasrb commented 5 months ago

@cmradix @ThePagi

你可以尝试runner.dll这个PR吗?直接链接:https://github.com/ModOrganizer2/modorganizer-plugin_python/files/13536824/runner.zip

该文件应该进入plugins/plugin_python/dlls(如果需要重新安装,请先备份前一个文件)。

@cmradix @ThePagi

Can you try the runner.dll from this PR? Direct link: https://github.com/ModOrganizer2/modorganizer-plugin_python/files/13536824/runner.zip

The file should go in plugins/plugin_python/dlls (backup the previous one before if you need to reinstall it).

It works, finally! Thanks my friend :)

cmradix commented 5 months ago

@cmradix @ThePagi 你可以尝试这个PR吗?直接链接:https://github.com/ModOrganizer2/modorganizer-plugin_python/files/13536824/runner.zip`runner.dll 该文件应该进入(如果需要重新安装,请先备份前一个文件)。plugins/plugin_python/dlls`

@cmradix @ThePagi Can you try the from this PR? Direct link: https://github.com/ModOrganizer2/modorganizer-plugin_python/files/13536824/runner.zip`runner.dll The file should go in (backup the previous one before if you need to reinstall it).plugins/plugin_python/dlls`

It works, finally! Thanks my friend :)

This fix has already been merged into version 2.5.1 RC 2, so theoretically, you shouldn't need to use the patch from this issue. 2.5.1 RC 2

Sakurasrb commented 5 months ago

@cmradix @ThePagi 你可以尝试这个PR吗?直接链接:https://github.com/ModOrganizer2/modorganizer-plugin_python/files/13536824/runner.ziprunner.dll 该文件应该进入(如果需要重新安装,请先备份前一个文件)。plugins/plugin_python/dlls

@cmradix @ThePagi Can you try the from this PR? Direct link: https://github.com/ModOrganizer2/modorganizer-plugin_python/files/13536824/runner.ziprunner.dll The file should go in (backup the previous one before if you need to reinstall it).plugins/plugin_python/dlls

It works, finally! Thanks my friend :)

This fix has already been merged into version 2.5.1 RC 2, so theoretically, you shouldn't need to use the patch from this issue. 2.5.1 RC 2

I just found I was still using 2.5.0, so no wonder I met this issue... Thanks for your notice, I will try 2.5.1 instead.