pyjnius icon indicating copy to clipboard operation
pyjnius copied to clipboard

Conda does not set up properly path for JDK for pyjnius

Open dzieciou opened this issue 5 years ago • 0 comments

I have installed pyjnius with conda. However, when I try to import pyjnius it fails

> from jnius import autoclass

File
 "C:\Users\OEM\Miniconda3\envs\example-env\lib\site-packages\jnius\__init__.py",
 line 12, in <module>
     from .jnius import *  # noqa ImportError: DLL load failed: The specified module could not be found.

Together with pyjnius conda installs also openjdk. Next, pyjnius looks for jvm.dll in one of PATH directories. DLL could be found in

C:\Users\OEM\Miniconda3\pkgs\openjdk-11.0.1-1017\Library\bin\server

but conda does not include it in PATH. It adds another folder in PATH:

C:\Users\OEM\Miniconda3\envs\example2-env\Library\jre\bin\server

while this directory is missing: JRE has not been installed, only JDK. I can, obviously, include first directory in my PATH, however, this would bypass conda virtual environments concept. How can I solve this problem in an elegant way?

Here's environment.yml to reproduce the problem:

name: example-env
channels:
  - conda-forge
dependencies:
  - python=3.7
  - Cython
  - pyjnius

Next, I create and activate as follows:

conda env update --file environment.yml
conda activate example-env

dzieciou avatar Sep 24 '19 10:09 dzieciou