import jenkins in python fails on mac - python

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.

Related

Python FileNotFoundError: Could not find module 'venv\DLLs\libyara.dll' (or one of its dependencies) on Windows 11

In my Python code I use yara to compile yara rules.
The documentation located at
https://yara.readthedocs.io/en/stable/yarapython.html says that I can use it by importing it like this:
import yara
However when I run the code I get
FileNotFoundError: Could not find module 'C:\Users\bruker\Pycharmprojects\projectx\venv\DLLs\libyara.dll' (or one of its dependencies). Try using the full path with constructor syntax.
I am using a venv python enviroment for this project running in Windows 11.
I have tried the following:
pip install yara
pip install --upgrade --force-reinstall yara
pip install -I yara
pip install --ignore-installed yara
However I still get that the libyara.dll file is missing:
Traceback (most recent call last):
File "C:\Users\bruker\Pycharmprojects\projectx\deploygate.py", line 14, in <module>
import yara
File "C:\Users\bruker\Pycharmprojects\projectx\venv\lib\site-packages\yara\__init__.py", line 7, in <module>
from yara.rules import compile
File "C:\Users\bruker\Pycharmprojects\projectx\venv\lib\site-packages\yara\rules.py", line 17, in <module>
from yara.libyara_wrapper import *
File "C:\Users\bruker\Pycharmprojects\projectx\venv\lib\site-packages\yara\libyara_wrapper.py", line 315, in <module>
libyaradll = cdll.LoadLibrary(library)
File "C:\Users\bruker\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "C:\Users\bruker\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\bruker\Pycharmprojects\projectx\venv\DLLs\libyara.dll' (or one of its dependencies). Try using the full path with constructor syntax.
How can I fix the yara dll file missing? I am using Python 3.10.

Cannot import mxnet package in my environment

I want to install mxnet with gpu. and used pip install mxnet-cu90. However, when I am importing the package I come across this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Anuj\anaconda3\envs\py36\lib\site-packages\mxnet\__init__.py", line 24, in <module>
from .context import Context, current_context, cpu, gpu, cpu_pinned
File "C:\Users\Anuj\anaconda3\envs\py36\lib\site-packages\mxnet\context.py", line 24, in <module>
from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
File "C:\Users\Anuj\anaconda3\envs\py36\lib\site-packages\mxnet\base.py", line 213, in <module>
_LIB = _load_lib()
File "C:\Users\Anuj\anaconda3\envs\py36\lib\site-packages\mxnet\base.py", line 204, in _load_lib
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
File "C:\Users\Anuj\anaconda3\envs\py36\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
I tried reinstalling by downloading .whl file from this but it didn't work. Its still giving the same error.
I am using python 3.6.12.
I still don't know what was causing this problem but I solved by installing the package from conda.
First I created a brand new environment and used
conda install -c anaconda mxnet-mkl
Hopefully it works for you too.

Why is version `GLIBCXX_3.4.28' not found (required by /usr/lib/libQt5Widgets.so.5)

Folks I'm trying to run the following code on manjaro linux. But as I start the server with:
python3 darknet_server.py
It reports
Traceback (most recent call last):
File "darknet_server.py", line 342, in <module>
main()
File "darknet_server.py", line 328, in main
datafilepath=datafilepath.encode(),
File "/home/vfbsilva/Source/darknet_alexey/darknet/pythons/darknet.py", line 120, in __init__
self.lib = CDLL(self.libfilepath, RTLD_GLOBAL)
File "/home/vfbsilva/Programas/anaconda3/envs/darknet376/lib/python3.7/ctypes/__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /home/vfbsilva/Programas/anaconda3/envs/darknet376/lib/python3.7/site-packages/../../libstdc++.so.6: version `GLIBCXX_3.4.28' not found (required by /usr/lib/libQt5Widgets.so.5)
But
pacman -Qo /lib/libstdc++.so.6
/usr/lib/libstdc++.so.6 pertence a gcc-libs 10.2.0-2
Shows libstdc++.so.6 as installed. What can I do?
darknet376 comes with its own, outdated copy of libstdc++.so.6, which overrides the system version (either due to LD_LIBRARY_PATH or some RPATH or RUN_PATH setting directly in an ELF .so file).
You should be able to work around this by simply deleting the libstdc++.so.6 file (the one in the darknet376 directory tree, not the system version in /lib) because the system version is sufficiently new, so the bundled version is probably not required for running this software.

Cannot import Pytorch

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.

Error installing firebird RDBMS bindings package on windows

I am installing the fdb package on windows
This package
https://pypi.python.org/pypi/fdb
and i get this error
C:\fdb>python setup.py install
Traceback (most recent call last):
File "setup.py", line 7, in <module>
from fdb import __version__
File "C:\fdb\fdb\__init__.py", line 23, in <module>
from fdb.fbcore import *
File "C:\fdb\fdb\fbcore.py", line 26, in <module>
from . import ibase
File "C:\fdb\fdb\ibase.py", line 43, in <module>
fb_library = WinDLL(fb_library_name)
File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: expected string or Unicode object, NoneType found
Has anyone encountered this error before?.I have the python driver for firebird installed and also the python driver.
I solved it. After installing the Firebird super server, copy fbclient.dll (you will find it under C:\Program Files\Firebird\Firebird_2_5\bin) and paste it under C:\WINDOWS
If your problem persists, there is a hack I found on the firebird-python mailing list on Yahoo here: Re: Again: can't install fdb

Categories