Skip to content

Conda Environments - Wrong Path Captured #463

Closed
@ghost

Description

Environment

  • Pythonnet version: 2.3
  • Python version: Python 3.5 (Conda environment)
  • Operating System: Windows 10

Details

I have many Conda Python environments, and I have installed PythonNet in only one of them.
I installed PythonNet using "conda install -c pythonnet pythonnet", and the Python.Runtime.dll is located in a conda environment named anaconda3: "C:\Users\username\Miniconda3\envs\anaconda3\Lib\site-packages"

In Visual Studio, I added a reference to the DLL and tried to follow the Embedding Python in .NET" example. My root Conda environment with no external libraries installed is running Python 3.6, so it is no surprise I was getting "Unable to load DLL 'python35'.

I went ahead and downgraded the base Conda environment to 3.5 and captured the PythonEngine.PythonPath variable and see it is pointing to the following paths:
"C:\Users\username\Miniconda3\python35.zip;C:\Users\username\Miniconda3\Lib;C:\Users\username\Miniconda3\DLLs;C:\Users\username\Documents\Visual Studio 2015\Projects\WindowsFormsApplication4\WindowsFormsApplication4\bin\x64\Debug"

So it appears that installing PythonNet in a conda environment and simply pointing to the DLL is insufficient. Is there any way to add the correct paths to the PythonEngine? I was unable to find any documentation on this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions