openslide python import show:windows error - openslide

I am using python 2.7 win 32
I need to install openslide in python
in below page show
Install openslide
http://openslide.org/download/
which item download for windows.
i tried every thing.and pip installation
the error shows below
import openslide
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import openslide
File "C:\Python27\lib\site-packages\openslide\__init__.py", line 29, in >>>> <module>
from openslide import lowlevel
File "C:\Python27\lib\site-packages\openslide\lowlevel.py", line 41, in <module>
_lib = cdll.LoadLibrary('libopenslide-0.dll')
File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found
Thanks

This question may be old, but perhaps an answer will help a future viewer.
To fix this error, you need to download the openslide binaries at http://openslide.org/download/ look under (Windows Binaries)
Next, add the location of the bin folder to your system path (this will allow python to know where the module is). And that should solve the problem.
Install instructions found here: https://pypi.python.org/pypi/openslide-python

Related

Why pyexiv2 raises an error during runtime execution

I'm trying to use pyexiv2 to geotag photos from historical location data. However, my installation of pyexiv2 seems to be broken.
I'm running this script on a MacBook with MacOS Monterey. This was working perfectly on my previous MacBook so I believe it has something to do with the installation.
Here is the runtime error, it doesn't even pass import pyexiv2 at line 1 of the code.
stu#192 Development % python3 GPS-image.py /Users/stu/02.\ 2017-03-02\ 11.08.09.jpg -34.45223 132.342535
Traceback (most recent call last):
File "/Users/stu/Development/GPS-image.py", line 1, in <module>
import pyexiv2
File "/opt/homebrew/lib/python3.9/site-packages/pyexiv2/__init__.py", line 6, in <module>
from .core import *
File "/opt/homebrew/lib/python3.9/site-packages/pyexiv2/core.py", line 1, in <module>
from .lib import exiv2api
File "/opt/homebrew/lib/python3.9/site-packages/pyexiv2/lib/__init__.py", line 25, in <module>
ctypes.CDLL(os.path.join(lib_dir, 'libexiv2.dylib'))
File "/opt/homebrew/Cellar/python#3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/opt/homebrew/lib/python3.9/site-packages/pyexiv2/lib/libexiv2.dylib, 0x0006): tried: '/opt/homebrew/lib/python3.9/site-packages/pyexiv2/lib/libexiv2.dylib' (no such file), '/usr/local/lib/libexiv2.dylib' (no such file), '/usr/lib/libexiv2.dylib' (no such file)
Clearly files are missing, but why and how do I get them correctly installed?
Can someone tell me what the problem is and how to fix it?
Many thanks,
Stu

Q: How to fix the missing dependancies in pyzbar

I am currently using spyder via anaconda with python 3.8.5 on windows 10 and I am trying to use the pyzbar package to make a barcode reader. When I try to run the script I get this error message when trying to run from pyzbar.pyzbar import decode and from pyzbar import pyzbar:
Traceback (most recent call last):
File "C:\Users\norinhan\Anaconda3\lib\site-packages\pyzbar\zbar_library.py", line 58, in load
dependencies, libzbar = load_objects(Path(''))
File "C:\Users\norinhan\Anaconda3\lib\site-packages\pyzbar\zbar_library.py", line 50, in load_objects
deps = [
File "C:\Users\norinhan\Anaconda3\lib\site-packages\pyzbar\zbar_library.py", line 51, in <listcomp>
cdll.LoadLibrary(str(directory.joinpath(dep)))
File "C:\Users\norinhan\Anaconda3\lib\ctypes\__init__.py", line 459, in LoadLibrary
return self._dlltype(name)
File "C:\Users\norinhan\Anaconda3\lib\ctypes\__init__.py", line 381, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'libiconv.dll' (or one of its dependencies). Try using the full path with constructor syntax.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<ipython-input-1-95ae0761f4b5>", line 1, in <module>
from pyzbar.pyzbar import decode
File "C:\Users\norinhan\Anaconda3\lib\site-packages\pyzbar\pyzbar.py", line 7, in <module>
from .wrapper import (
File "C:\Users\norinhan\Anaconda3\lib\site-packages\pyzbar\wrapper.py", line 139, in <module>
zbar_version = zbar_function(
File "C:\Users\norinhan\Anaconda3\lib\site-packages\pyzbar\wrapper.py", line 136, in zbar_function
return prototype((fname, load_libzbar()))
File "C:\Users\norinhan\Anaconda3\lib\site-packages\pyzbar\wrapper.py", line 115, in load_libzbar
libzbar, dependencies = zbar_library.load()
File "C:\Users\norinhan\Anaconda3\lib\site-packages\pyzbar\zbar_library.py", line 60, in load
dependencies, libzbar = load_objects(Path(__file__).parent)
File "C:\Users\norinhan\Anaconda3\lib\site-packages\pyzbar\zbar_library.py", line 50, in load_objects
deps = [
File "C:\Users\norinhan\Anaconda3\lib\site-packages\pyzbar\zbar_library.py", line 51, in <listcomp>
cdll.LoadLibrary(str(directory.joinpath(dep)))
File "C:\Users\norinhan\Anaconda3\lib\ctypes\__init__.py", line 459, in LoadLibrary
return self._dlltype(name)
File "C:\Users\norinhan\Anaconda3\lib\ctypes\__init__.py", line 381, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\norinhan\Anaconda3\lib\site-packages\pyzbar\libiconv.dll' (or one of its dependencies). Try using the full path with constructor syntax.
When trying to run just import pyzbar it will compile, but it will not be able to access any of the function. When I try I get this message:
Traceback (most recent call last):
File "<ipython-input-3-26272af93b8a>", line 1, in <module>
pyzbar.pyzbar.decode()
AttributeError: module 'pyzbar' has no attribute 'pyzbar'
I have looked up the documentation for pyzbar on github which states "The zbar DLLs are included with the Windows Python wheels", but have not found this anywhere. The closest to "Windows Python wheels" I have found is the wheel package which does not contain any information about pyzbar.
Any advice on how to fix this?
Visit https://pypi.org/project/pyzbar/#files to download pyzbar-0.1.8-py2.py3-none-win_amd64.whl.
You can find all the DLL files inside the wheel package.
I have just encountered this problem.
If your OS & python are x64 version, it's just because of lack of vc 2013 x64 runtime.
You can find Visual C++ Redistributable Packages for Visual Studio 2013 here
download & install.
I was facing similar issue just installed Visual
C++ 64 bit version on my computer and restarted. Choose between vcredist_x86.exe or vcredist_x64.exe based on your machine.
https://www.microsoft.com/en-us/download/confirmation.aspx?id=40784. Hope this solves your issue as well.

OSError: [WinError 126] while importing seaborn package

I got an example project from my friend that uses seaborn package to draw maps. I've opened project in pycharm, created venv, installed all needed packages and tried to run his code. Unfortunately code returns an error while importing package seaborn:
Traceback (most recent call last):
File "C:/Users/Carlito/Desktop/Maps/map.py", line 6, in <module>
from seaborn import set
File "C:\Users\Carlito\Desktop\Maps\venv\lib\site-packages\seaborn\__init__.py", line 6, in <module>
from .rcmod import *
File "C:\Users\Carlito\Desktop\Maps\venv\lib\site-packages\seaborn\rcmod.py", line 7, in <module>
from . import palettes, _orig_rc_params
File "C:\Users\Carlito\Desktop\Maps\venv\lib\site-packages\seaborn\palettes.py", line 9, in <module>
from .utils import desaturate, set_hls_values, get_color_cycle
File "C:\Users\Carlito\Desktop\Maps\venv\lib\site-packages\seaborn\utils.py", line 6, in <module>
from scipy import stats
File "C:\Users\Carlito\Desktop\Maps\venv\lib\site-packages\scipy\__init__.py", line 136, in <module>
from . import _distributor_init
File "C:\Users\Carlito\Desktop\Maps\venv\lib\site-packages\scipy\_distributor_init.py", line 61, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2288.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126]
I have tried manually installing all dependencies of this package but it didn't work. These are packages that I've installed:
One maybe important detail, my friend uses Linux Mint, while I am trying to run the project on Windows 10.
Anyone knows what is going on here?
More info required, give this a try
Check for paths hardcoded and try changing to windows backslashes
Example
Here the filepath is given C:/Users/Carlito/Desktop/Maps/map.py, which is Linux , try
Windows
C:\Users\Carlito\Desktop\Maps\map.py
C:\\Users\\Carlito\\Desktop\\Maps\\map.py

Python 3.8.1: ModuleNotFoundError: No module named '_pywrap_tensorflow_internal' - Is tensorflow only supported up to 3.7?

I am using Python 3.8.1 on Windows 10 and am trying to install TensorFlow.
I have tried many methods to install it, but I keep getting the following error upon importing TensorFlow. This time, I installed it using
conda install -c conda-forge tensorflow
Here is the stack trace:
Using TensorFlow backend.
Traceback (most recent call last):
File "C:\Program Files (x86)\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
File "C:\Program Files (x86)\Python38-32\lib\imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files (x86)\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files (x86)\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "deep_versions.py", line 6, in <module>
import keras
File "C:\Users\rapto\AppData\Roaming\Python\Python38\site-packages\keras\__init__.py", line 3, in <module>
from . import utils
File "C:\Users\rapto\AppData\Roaming\Python\Python38\site-packages\keras\utils\__init__.py", line 6, in <module>
from . import conv_utils
File "C:\Users\rapto\AppData\Roaming\Python\Python38\site-packages\keras\utils\conv_utils.py", line 9, in <module>
from .. import backend as K
File "C:\Users\rapto\AppData\Roaming\Python\Python38\site-packages\keras\backend\__init__.py", line 1, in <module>
from .load_backend import epsilon
File "C:\Users\rapto\AppData\Roaming\Python\Python38\site-packages\keras\backend\load_backend.py", line 90, in <module>
from .tensorflow_backend import *
File "C:\Users\rapto\AppData\Roaming\Python\Python38\site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
import tensorflow as tf
File "C:\Program Files (x86)\Python38-32\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Program Files (x86)\Python38-32\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Program Files (x86)\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Program Files (x86)\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
File "C:\Program Files (x86)\Python38-32\lib\imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files (x86)\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files (x86)\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
What I have done to try to fix it: I have looked at other similar questions on here but they have been for older versions of Python. I have also looked at this GitHub post but could not resolve the issue.
I checked the TensorFlow site for Python version compatability but the latest update that I could find was a few months ago, saying that TensorFlow only supports up to Python 3.7 (https://github.com/tensorflow/tensorflow/issues/33374) Is this still the case and do I need to downgrade Python in order to use TensorFlow?
Please let me know if there is any more information I should provide (I'm still learning how to correctly ask questions here). Thank you.
Edit: I created a conda environment with Python 3.7 and I did not get the same error and importing TF seems to be working fine now. It seems that Python 3.8 is still not yet supported, so this may have been the problem.
Per the installation documents, only Python 3.5-3.7 are supported. https://www.tensorflow.org/install
I think it has to do with the version of python or TensorFlow and You should change versions of either Python or Tensorflow, as these 2 versions you are using are not compatible. You could downgrade to Python3.6 or try Tensorflow>=1.13.1 which supports Python 3.7. it should work hopefully.
Well for me, i managed to fix it by creating a venv by using conda create -n <venv name> python=3.6. Important to note that the python version specified needs to be 3.6. Then, using the same command just the difference is that i used tensor-gpu instead conda install -c conda-forge tensorflow-gpu. Note that my python versio on my machine is 3.7.8, but i guess any versions from 3.5-3.8 should be fine. Hope it still helps someone in the future!

ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None

C:\Users\meela\Anaconda3\python.exe E:/TTIGAN/test.py
You can find the C code in this temporary file: C:\Users\meela\AppData\Local\Temp\theano_compilation_error_zncbj7_k
Traceback (most recent call last):
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 81, in <module>
actual_version, force_compile, _need_reload))
ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 105, in <module>
actual_version, force_compile, _need_reload))
ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:/TTIGAN/test.py", line 1, in <module>
import skipthoughts
File "E:\TTIGAN\skipthoughts.py", line 6, in <module>
import theano
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\__init__.py", line 110, in <module>
from theano.compile import (
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\compile\__init__.py", line 12, in <module>
from theano.compile.mode import *
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\compile\mode.py", line 11, in <module>
import theano.gof.vm
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\gof\vm.py", line 674, in <module>
from . import lazylinker_c
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 140, in <module>
preargs=args)
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2388, in compile_str
(status, compile_stderr.replace('\n', '. ')))
.
Process finished with exit code 1
Same problem here, solved by installing a mingw-w64 import library for python(on Windows via conda) in your CLI type:
conda install -c anaconda libpython
I had the same problem, got me 2 days to resolve!
It was from path environment, i had another mingw path imported in variables and i removed it!
I had the same issue on my Mac. Installing theano via pip should fix this issue.
pip install theano
I had the same problem, it was caused by an old version of anaconda from 2014 that I forgot I even had. Just renaming the old directory fixed the problem.
The solution that worked for me was to uninstall my MinGW gcc compiler and reinstall the latest one. Make sure to restart your CLI before testing it.

Resources