Skip to content

Python Virtual Environment throws error with Python Net 3.0.2 #2446

Description

@crazyoutlook

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):

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions