Environment
Pythonnet version: 3.0.2
Python version: 3.10, 3.11
Operating System: Windows Server 2019 Datacenter
.NET Runtime: 6.0
Details
- Describe what you were trying to get done.
Running Python Net with Python 3.10 and 3.11 virtual environment does not work. It works fine if I use Python 3.10 and 3.11 root directory. I have a dot net application which used Python Net to invoke some python methods. As long as I am running using python root installation directory, it works fine. When I use corresponding virtual environments then it does not work. I am getting below error. I tried to re-install encodings but it did not help.
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'
Running Python 3.10 and 3.11 virtual environment with Python Net.
- If there was a crash, please include the traceback here.
Python path configuration:
PYTHONHOME = 'C:\PythonVirtualEnv\Python311venv'
sys.path = [
'',
'C:\PythonVirtualEnv\Python311venv\Lib\site-packages',
'C:\PythonVirtualEnv\Python311venv\Lib',
]
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'
Current thread 0x00007c90 (most recent call first):
Environment
Pythonnet version: 3.0.2
Python version: 3.10, 3.11
Operating System: Windows Server 2019 Datacenter
.NET Runtime: 6.0
Details
Running Python Net with Python 3.10 and 3.11 virtual environment does not work. It works fine if I use Python 3.10 and 3.11 root directory. I have a dot net application which used Python Net to invoke some python methods. As long as I am running using python root installation directory, it works fine. When I use corresponding virtual environments then it does not work. I am getting below error. I tried to re-install encodings but it did not help.
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'
Minimal, Complete, and Verifiable example
this will help us understand the issue.
Running Python 3.10 and 3.11 virtual environment with Python Net.
Python path configuration:
PYTHONHOME = 'C:\PythonVirtualEnv\Python311venv'
sys.path = [
'',
'C:\PythonVirtualEnv\Python311venv\Lib\site-packages',
'C:\PythonVirtualEnv\Python311venv\Lib',
]
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'
Current thread 0x00007c90 (most recent call first):