upload-scripts
upload-scripts copied to clipboard
Module ‘encodings’ not found error when installing the dependencies
My System
OS Microsoft Windows 10 Pro 64bit version 10.0.19045 Build 19045 Python version 3.12.4 OSC tools from 28. Juni 2024
Description
After the Python update to version 3.12, I also updated the KartaView upload scripts. However, the creation of the virtual environment failed. Error message: ModuleNotFoundError: No module named ‘encodings’.
Steps to Reproduce
- start OSGeo4W shell as admin
- enter commands:
cd /d P:\KartaView\upload-scripts-master
pip3 install virtualenv
virtualenv -p python3 .
scripts\activate.bat
pip3 install -r requirements.txt
The last line results in:
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding Python runtime state: core initialized ModuleNotFoundError: No module named 'encodings'
See also log file KVI01_Log01.txt
Workaround:
The error disappears if the environment variable PYTHONHOME is set explicitly
set PYTHONHOME=P:\OSGeo4W64\apps\Python312
pip3 install -r requirements.txt
The installation then runs without errors. However, no images can be uploaded, the same error occurs here too. See log file KVI01_Log02.txt .
Explicitly setting PYTHONHOME can also fix the ModuleNotFound error here, but images still cannot be uploaded. However, this is a different issue.
I don't understand why I have to set PYTHONHOME explicitly now, my previously used version of the tools (from 17 January 2023) worked without it.