Python Virtual Environment throws error with Python Net 3.0.2 #2450
Unanswered
crazyoutlook
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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):
All reactions