jpype-project / jpype

JPype is cross language bridge to allow Python programs full access to Java class libraries.
http://www.jpype.org
Apache License 2.0
1.1k stars 179 forks source link

not able to install jpype in linux server #1184

Open SIVAPRAS329 opened 5 months ago

SIVAPRAS329 commented 5 months ago

I have downloaded the jpype package from github and unzip the contents in my linux server. i am using pip3 install to install the package. however getting below error:

gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Inative/common/include -Inative/python/include -Inative/embedded/include -Inative/jni_include -I/usr/include/python3.6m -c native/common/jp_array.cpp -o build/temp.linux-x86_64-3.6/native/common/jp_array.o -g0 -std=c++11 -O2 In file included from native/common/include/jpype.h:184, from native/common/jp_array.cpp:16: native/python/include/jp_pythontypes.h:18:10: fatal error: Python.h: No such file or directory

include

          ^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
Thrameos commented 5 months ago

You are missing the python3-dev package.

It is not uncommon to have python installed but not the header files required for compiling.

SIVAPRAS329 commented 5 months ago

How to install python-3 dev package in linux server. I am very much new to python and linux.

SIVAPRAS329 commented 5 months ago

I have installed python-3 dev package and now getting below error: native/python/pyjp_array.cpp:422:1: error: invalid conversion from ‘const char’ to ‘char’ [-fpermissive] }; ^ error: command 'gcc' failed with exit status 1

SIVAPRAS329 commented 5 months ago

I have downloaded the jpype-master.zip package into my local desktop. copied the zip file onto linux server. Unzipped the file to /tmp/jpype-master. used the below commnad to install the package.

cd /tmp/jpype-master and then

python -m pip install -e /tmp/jpype-master

i got below error. can some one please assist me why this error came and how to resolve it . I am new to python as well as linux.

Obtaining file:///tmp/jpype-master Installing collected packages: UNKNOWN Running setup.py develop for UNKNOWN Complete output from command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/jpype-master/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" develop --no-deps: running develop error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/local/lib64/python3.6'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/local/lib64/python3.6/site-packages/

This directory does not currently exist.  Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).

----------------------------------------

Command "/usr/bin/python -c "import setuptools, tokenize;file='/tmp/jpype-master/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" develop --no-deps" failed with error code 1 in /tmp/jpype-master/

Thrameos commented 5 months ago

I think there may be larger problems with your python install if it is trying to compile a C++ project with a C compiler. I would recommend getting a different python build and trying again. We have seen this before that someone was releasing busted python distributions that don't compile C++.

This isn't really a JPype problem so much as bad Python installs.