So I'm trying to import jit from the numba library but the import produces an OSError and says that a specific module couldn't be found.
I tried to uninstall and reinstall numba, but it didn't change anything and I have no other idea to solve the issue.
Here is the full error:
Traceback (most recent call last):
File "D:\Users\user65\Logiciels\WinPython-64bit-3.4.4.6Qt5\python-3.4.4.amd64\lib\site-packages\llvmlite\binding\ffi.py", line 42, in <module>
lib = ctypes.CDLL(os.path.join(_lib_dir, _lib_name))
File "D:\Users\user65\Logiciels\WinPython-64bit-3.4.4.6Qt5\python-3.4.4.amd64\lib\ctypes\__init__.py", line 350, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Le module spécifié est introuvable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/Users/user65/HypotheseDecoupageReseau/CalculInfluence.py", line 6, in <module>
from numba import jit
File "D:\Users\user65\Logiciels\WinPython-64bit-3.4.4.6Qt5\python-3.4.4.amd64\lib\site-packages\numba\__init__.py", line 11, in <module>
from . import config, errors, runtests, types
File "D:\Users\user65\Logiciels\WinPython-64bit-3.4.4.6Qt5\python-3.4.4.amd64\lib\site-packages\numba\config.py", line 11, in <module>
import llvmlite.binding as ll
File "D:\Users\user65\Logiciels\WinPython-64bit-3.4.4.6Qt5\python-3.4.4.amd64\lib\site-packages\llvmlite\binding\__init__.py", line 6, in <module>
from .dylib import *
File "D:\Users\user65\Logiciels\WinPython-64bit-3.4.4.6Qt5\python-3.4.4.amd64\lib\site-packages\llvmlite\binding\dylib.py", line 4, in <module>
from . import ffi
File "D:\Users\user65\Logiciels\WinPython-64bit-3.4.4.6Qt5\python-3.4.4.amd64\lib\site-packages\llvmlite\binding\ffi.py", line 47, in <module>
lib = ctypes.CDLL(_lib_name)
File "D:\Users\user65\Logiciels\WinPython-64bit-3.4.4.6Qt5\python-3.4.4.amd64\lib\ctypes\__init__.py", line 350, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Le module spécifié est introuvable
Process finished with exit code 1
Thank you for your help :)
As said in this page you are not alone. This is the problem of the version 3.4.4
You have some options:
Try upgrading and see that the problem solves.
Aside from that people saying It's due to script\python.bat and python.exe interfering.
python.bat is currently calling ptpython when it sees it, which has not the same syntax.
You may try pip uninstall ptpython and see if it helps.
You may also copy the current python.bat as winpython.bat, and keep python.bat calling only python:
#echo off
call "%~dp0env_for_icons.bat"
cd/D "%WINPYWORKDIR%"
rem backward compatibility for python.exe
"%WINPYDIR%\python.exe" %*
After following the above solutions, llvmlite error part should be solved by now. You should have Visual Studio 2015 installed for other error parts to go away.
Although you can instead install vc_redist.x86.exe alone from this link and dont install the whole VS2015. Follow here for more information.
Check if you are using a compatible version of Python.
In my case I had to remove Python and downgrade to a previous version
Related
Operating system: Windows 10 Home
Python interpreter: Anaconda with python 3.8.8
I have installed the scipy module on anaconda using "conda install
scipy==1.6.2" and it states "# All requested packages already installed.". However, when I opened python ide and import scipy, the below error appears.
The way I try to solve is through reinstalling scipy module and "conda update --all". However, these all fails. Any ways to solve this issue. Thanks in advance.
import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\tys\.conda\envs\renv\lib\site-packages\scipy\__init__.py", line 130, in <module>
from . import _distributor_init
File "C:\Users\tys\.conda\envs\renv\lib\site-packages\scipy\_distributor_init.py", line 59, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\tys\.conda\envs\renv\lib\ctypes\__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\tys\.conda\envs\renv\lib\site-packages\scipy\.libs\libbanded5x.3OIBJ6VWWPY6GDLEMSTXSIPCHHWASXGT.gfortran-win_amd64.dll' (or one of its dependencies). Try using the full path with constructor syntax.
You should try the solution given here (https://github.com/pytroll/satpy/issues/1835):
conda install -c defaults scipy
It worked for me.
I am trying to import 2 libraries into python, and there seems to be always an issue.
I have even tried to import other libraries to see if the issue is with the specific libraries I want to use, but I still get the same issue. I need to use Pandas and Matplotlib if that helps.
I always enter:
import pandas as pd
import matplotlib as plt
For matplotlib, i get this error:
PS C:\Users\mghaf\Documents\GitHub\Modelling-Cell-Growth-in-CFU> & C:/Users/mghaf/Anaconda3/python.exe c:/Users/mghaf/Desktop/ter/Covid-File-For-CC.py
Traceback (most recent call last):
File "c:/Users/mghaf/Desktop/ter/Covid-File-For-CC.py", line 1, in <module>
import matplotlib
File "C:\Users\mghaf\AppData\Roaming\Python\Python38\site-packages\matplotlib\__init__.py", line 107, in <module>
from . import cbook, rcsetup
File "C:\Users\mghaf\AppData\Roaming\Python\Python38\site-packages\matplotlib\cbook\__init__.py", line 28, in <module>
import numpy as np
File "C:\Users\mghaf\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py", line 148, in <module>
from . import _distributor_init
File "C:\Users\mghaf\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py", line 26, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\mghaf\Anaconda3\lib\ctypes\__init__.py", line 381, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
For pandas I get this error:
PS C:\Users\mghaf\Documents\GitHub\Modelling-Cell-Growth-in-CFU> & C:/Users/mghaf/Anaconda3/python.exe c:/Users/mghaf/Desktop/ter/Covid-File-For-CC.py
Traceback (most recent call last):
File "c:/Users/mghaf/Desktop/ter/Covid-File-For-CC.py", line 1, in <module>
import pandas
File "C:\Users\mghaf\AppData\Roaming\Python\Python38\site-packages\pandas\__init__.py", line 11, in <module>
__import__(dependency)
File "C:\Users\mghaf\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py", line 148, in <module>
from . import _distributor_init
File "C:\Users\mghaf\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py", line 26, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\mghaf\Anaconda3\lib\ctypes\__init__.py", line 381, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
I am using VS code to write my code. I am using Anaconda as the base for my libraries. However, I have also used pip install and uninstall multiple times to see if the issue was from there. To no avail, it did not work. There might be some issue with the setting up of python as I have both Anaconda and Python V 3.7.x installed.
If there is anything that I need to do in my settings or anything else then I would appreciate it someone could inform me on how to do it. Thanks in Advance!
This is an issue caused due to multiple python path. To elaborate, your expected interpreter is C:/Users/mghaf/Anaconda3/python.exe as seen from your executing command.
PS C:\Us ... in-CFU> & C:/Users/mghaf/Anaconda3/python.exe c:/Us ... CC.py
Although, from the error logs, it is visible that it is using an alternate python from C:\Users\mghaf\AppData\Roaming\Python\Python38 as seen here
File "C:\Users\mghaf\AppData\Roaming\Python\Python38\site-packages\pandas\__init__.py", line 11, in <module>
I would suggest that you remove all python paths from your Windows machine apart from anything related to your Anaconda interpreter.
I've installed SciPy using pip on Windows Powershell. I used the command py -m pip install scipy. This worked. I then tried to import scipy into Python, but I get this error
Traceback (most recent call last):
File "C:\Users\monzu\Documents\model of membrane-fiber interactions.py", line 2, in <module>
import scipy
File "C:\Users\monzu\AppData\Roaming\Python\Python39\site-packages\scipy\__init__.py", line 61, in <module>
from numpy import show_config as show_numpy_config
File "C:\Users\monzu\AppData\Roaming\Python\Python39\site-packages\numpy\__init__.py", line 138, in <module>
from . import _distributor_init
File "C:\Users\monzu\AppData\Roaming\Python\Python39\site-packages\numpy\_distributor_init.py", line 26, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\monzu\AppData\Local\Programs\Python\Python39-32\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
How do I fix this?
I don't know if that's the reason and how it came, but "Python39-32" and "not a valid Win32 application" may suggest a mismatch in the versions of some libraries, 32-bit vs 64-bit, or some dependency missing? Maybe a 64-bit python/numpy? is trying to import a 32-bit DLL for the cython library (the last two lines from the exception).
EDIT: I opened the __distributo_init.py file, there are these DLL loads:
#Load Intel C, Fortran, and OMP runtime DLLs into the process
import ctypes
ctypes.CDLL(os.path.join(path, 'libmmd.dll'))
ctypes.CDLL(os.path.join(path, 'libifcoremd.dll'))
ctypes.CDLL(os.path.join(path, 'libiomp5md.dll'))
ctypes.CDLL are instances of a class where it fails.
Then:
if handle is None:
self._handle = _dlopen(self._name, mode)
else:
self._handle = handle
So maybe it can't import these libraries - are they installed?
While importing installed pytorch I am facing below issue
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda3\lib\site-packages\torch\__init__.py", line 81, in <module>
ctypes.CDLL(dll)
File "C:\Anaconda3\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
I found a possible culprit by doing a Google search. Please read below-
It's a library load issue. More details at #8836
You probably have a broken conda right now. You can use a standalone conda from here to repair it:
standalone-conda.exe update -p C:\ProgramData\Anaconda3 conda-package-handling
You should get the latest stable version, and the problems should go away.
More details can be found here.
I installed the jenkins package on a mac using sudo easy_install python-jenkins. The installation went fine, no errors, but when I open python and type in import jenkins I get the following error.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.7-intel/egg/jenkins.py", line 9, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Library/Python/2.7/site-packages/lookup3.so, 6): image not found
Googling this did not yield any helpful result.
Traceback after Editing
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "jenkins.py", line 9, in <module>
lookup3 = cdll.LoadLibrary(os.path.join(get_python_lib(), "lookup3.dynlib"))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Library/Python/2.7/site-packages/lookup3.dynlib, 6): image not found
The module in question isn't compatible with Mac OS X dynamic library conventions.
It tries to load a lookup3.so file, but on Mac it'll be lookup3.dynlib instead. You can verify this by looking at the /Library/Python/2.7/site-packages directory. Then just edit the jenkins.py module and replace the .so extension with .dynlib.
I'd also report this to the issue tracker of the module; a simple if platform.system() == 'Darwin': switch would keep things loadable across platforms.
Update: Actually, the module stubbornly expects the lookup3.so module to be located in the site-packages directory instead of with the module itself. It is thus not easy_install compatible. It'll work when you move all the files (unaltered) out of the .egg directory straight into your /Library/Python/2.7/site-packages/ directory.
OSError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/lookup3.so, 6): image not found
From the directory,
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages,
ln -s lookup3.cpython-36m-darwin.so lookup3.so
worked for me.
You can try:
pip uninstall jenkins
pip install python-jenkins
worked for me.
I found the lookup.so jenkins.py is trying to load in:
/Users/MY-USER/Documents/Telnyx/dev/tdm-get-ips/venv/lib/python3.7/site-packages/lookup3.cpython-37m-darwin.so
so i changed
python3.7/site-packages/jenkins.py
Line:
lookup3 = cdll.LoadLibrary(os.path.join(get_python_lib(), "lookup3.so"))
for:
lookup3 = cdll.LoadLibrary(os.path.join(get_python_lib(), "lookup3.cpython-37m-darwin.so"))
And it started working properly.