Error importing jpype module - python

Could someone please advise in resolving the below error?
Python 3.5.1 / jpype1-py3 0.5.5.2 installed on 64 bit windows machine.
I've cannot find _jtype anywhere in Lib or Lib/site-packages.
Regards
Steve
>>> import jpype
Traceback (most recent call last):
File "", line 1, in
import jpype
File "C:\Program Files\Python35\lib\site-packages\jpype\__init__.py", line 18, in
from ._jpackage import *
File "C:\Program Files\Python35\lib\site-packages\jpype\_jpackage.py", line 18, in
import _jpype
ImportError: DLL load failed: The specified module could not be found.

According to this thread, you need to make sure setup.py is pointing to the correct jvm directory. looking into setup.py of you can see that it searches for JAVA_HOME system variable:
java_home = os.getenv('JAVA_HOME', '')
found_jni = False
if os.path.exists(java_home):
platform_specific['include_dirs'] += [os.path.join(java_home, 'include')]
# The code goes on
It may be that you didn't configure this system variable.
Since you installed via pip, and probalby didn't touch te setup.py file, I recommend you to do the following:
1-) Uninstall the package, and delete the build directories
2-) Set JAVA_HOME variable following this
3-) Download JPype manually from github and install it using python setup.py install
Good luck, tell me if it works

Related

Running numpy using anaconda and VS Code

I am trying to get VScode to work with anaconda but having issues with numpy. I have managed to get VScode to use the right python environment From VScode (ctrl+shift+P, type Python:Select Interpreter and select the appropriate option).
However, when I type "import numpy" in to my script, I get the following error message:
C:\ProgramData\Anaconda3\envs\sandpit\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\sandpit\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
from . import multiarray
File "C:\ProgramData\Anaconda3\envs\sandpit\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
from . import overrides
File "C:\ProgramData\Anaconda3\envs\sandpit\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\[NAME]\Documents\python\sandpit\hello.py", line 2, in <module>
import numpy
File "C:\ProgramData\Anaconda3\envs\sandpit\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\ProgramData\Anaconda3\envs\sandpit\lib\site-packages\numpy\core\__init__.py", line 54, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.8 from "C:\ProgramData\Anaconda3\envs\sandpit\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
I have successfully called the 'import numpy' command from the anaconda command prompt so it seems the issue is just with VS-Code?
I have also tried to reinstall numpy from the environment with the following command conda install numpy --force-reinstall but this has no effect?
Try launching VS Code from your activated conda environment. Errors like this typically come up if you managed to run code before your shell had a chance to do a conda environment activation.
There is one step more
Launch Anaconda 3 powershell
conda init cmd.exe #to allow cmd to run VScode
Lauch VScode by the hitting the command code.

Import CV2: DLL load failed: The specified module could not be found while successful pip installation

I was working with Python 3.7 and OpenCV 4.2 in Pycharm IDE (Windows10). The system environment variables were changed by one of my co-workers by accident (we don't know what happened exactly). Then I found that my code did not work with this error!:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
Then I used this command:
pip uninstall opencv-python
pip uninstall opencv-contrib-python
pip install opencv-python
All of them executed successfully, but when I write import cv2 the above error is appeared. By the way, the system knows command Python, it shows the right path to the python.exe. Moreover, commands like import numpy works correctly! How can I fix this problem?
I found the answer! There was an extra cv2.py file in site-packages/cv2 path. So, I removed it and the code worked

IfxPy module import error after succesfull installation

I am experiencing an issue with IfxPy installation.
The operating system is windows 64 bit and the 64-bit version of Python 3.7.4 is runned.
After pip installation of the wheel file IfxPy-3.0.3-cp37-cp37m-win_amd64.whl from - https://pypi.org/project/IfxPy/#files the pip list command or help(modules) command from interpreteur shows that the module is installed:
>>> help("modules")
Please wait a moment while I gather a list of all available modules... IfxPy [...other modules...]
I try to find the location of the module, and it is
>>> imp.find_module('IfxPy') (<_io.BufferedReader name='C:\\Python\\lib\\site-packages\\IfxPy.pyd'>,
'C:\\Python\\lib\\site-packages\\IfxPy.pyd', ('.pyd', 'rb', 3))
The PATH environmental variable contains the abovementioned path.
However, when I try to import the module from IDLE interpreteur I get the error:
>>> import IfxPy
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
import IfxPy ImportError: DLL load failed: The specified module could not be found.
What could be the potential source of the error and how can it be solved? Thanks for help.

Pylucene 4.9.0 Ubuntu 14.04 Installation ImportError

I've been trying to install Pylucene on my Mac for a little over a week, and have given up on that in favor of trying to install it with Ubuntu through a virtual machine. I thought the installation process had gone well, so I fired up Python in the terminal and tried to import lucene and received the following ImportError:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/parallels/anaconda/lib/python2.7/site-packages/lucene/__init__.py", line 7, in <module>
import _lucene
ImportError: libverify.so: cannot open shared object file: No such file or directory
So, it looks like there is a module _lucene that does not exist. But I thought this would have been part of what I had just installed? Any insight here would be appreciated.
I had to add extra paths to my LD_LIBRARY_PATH environment variable to get things working. The test here in the conda build script actually shows those variables.
export LD_LIBRARY_PATH=$PREFIX/lib:$PREFIX/jre/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$PREFIX/jre/lib/amd64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$PREFIX/jre/lib/amd64/server:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$PREFIX/lib/python2.7/site-packages:$LD_LIBRARY_PATH
$PREFIX here is the path to the anaconda folder. I currently install miniconda at /usr/conda on my systems.

Trying to install Python audiolab module, module not found

Not well experienced with doing installs. I finally got scikits.audiolab-0.11.0 installed, I think. Now the module cannot be found.
from audiolab import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named audiolab
Does this need that I need to add it to my PATH or something? And how should I do that?
Below are 1. the last few lines of messages I got from the scikits.audiolab-0.11.0 install, and then below that 2. the results from echo $PATH on my machine.
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scikits.audiolab-0.11.0-py2.7-macosx-10.6-intel.egg
Processing dependencies for scikits.audiolab==0.11.0
Searching for numpy==1.6.1
Best match: numpy 1.6.1
Adding numpy 1.6.1 to easy-install.pth file
Using /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Finished processing dependencies for scikits.audiolab==0.11.0
echo $PATH
Macintosh:~ wolf$ echo $PATH
/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
You should make sure that wherever the audiolab package is stored, that that filepath is on your PYTHONPATH.
PATH is used to launch programs, PYTHONPATH is where Python looks for modules.

Categories