Kotlin / kotlin-numpy

Kotlin bindings for NumPy
Apache License 2.0
316 stars 11 forks source link

Cannot install native libraries on MacOS #24

Closed dosier closed 4 years ago

dosier commented 4 years ago

I am running MacOS 10.15.7 (Catalina), when trying to install the native library I get the following error:

(Kotlin) stanbend@stans-iMac ~ % pip install ktnumpy          
Collecting ktnumpy
  Using cached ktnumpy-0.1.5.tar.gz (41 kB)
    ERROR: Command errored out with exit status 1:
     command: /Users/stanbend/opt/anaconda3/envs/Kotlin/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/j5/p1sw619n41lgj1nm_ndm65sc0000gn/T/pip-install-irv98gvs/ktnumpy/setup.py'"'"'; __file__='"'"'/private/var/folders/j5/p1sw619n41lgj1nm_ndm65sc0000gn/T/pip-install-irv98gvs/ktnumpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/j5/p1sw619n41lgj1nm_ndm65sc0000gn/T/pip-pip-egg-info-qeru8bpu
         cwd: /private/var/folders/j5/p1sw619n41lgj1nm_ndm65sc0000gn/T/pip-install-irv98gvs/ktnumpy/
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/j5/p1sw619n41lgj1nm_ndm65sc0000gn/T/pip-install-irv98gvs/ktnumpy/setup.py", line 67, in <module>
        include_dirs=get_java_includes() + ['src/main/ktnumpy/jni/include', get_numpy_include()]
      File "/private/var/folders/j5/p1sw619n41lgj1nm_ndm65sc0000gn/T/pip-install-irv98gvs/ktnumpy/buildScr/python/utils.py", line 76, in get_java_includes
        java_include = os.path.join(java_home, 'include')
      File "/Users/stanbend/opt/anaconda3/envs/Kotlin/lib/python3.7/posixpath.py", line 80, in join
        a = os.fspath(a)
    TypeError: expected str, bytes or os.PathLike object, not NoneType
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I tried with python 3.7 and python 3.8 and with numpy 1.19.2.

devcrocod commented 4 years ago

Do you have JDK?

dosier commented 4 years ago

Do you have JDK?

Yes, I have jdk1.8.0_261.jdk

devcrocod commented 4 years ago

Do you have 'JAVA_HOME'? To find out, run this command in the terminal: echo $JAVA_HOME

This error is just due to the fact that the installation script does not find java. Setting the JAVA_HOME variable should fix this problem.

dosier commented 4 years ago

Thanks, adding export JAVA_HOME=$(/usr/libexec/java_home) to my .bash_profile fixed the issue!