Error installing firebird RDBMS bindings package on windows - python

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

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.

How to solve "NameError: name 'basestring' is not defined" when importing psycopg2?

I am trying to import the psycopg2 package on python 3.7.13 but I get the following error:
python -c "import psycopg2" % 11:22:56
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/mm/.pyenv/versions/3.7.13/lib/python3.7/site-packages/psycopg2/__init__.py", line 68, in <module>
from psycopg2 import extensions as _ext
File "/Users/mm/.pyenv/versions/3.7.13/lib/python3.7/site-packages/psycopg2/extensions.py", line 211, in <module>
from psycopg2. _range import Range # noqa
File "/Users/mm/.pyenv/versions/3.7.13/lib/python3.7/site-packages/psycopg2/_range.py", line 503, in <module>
oid=3904, subtype_oid=23, array_oid=3905)
File "/Users/mm/.pyenv/versions/3.7.13/lib/python3.7/site-packages/psycopg2/_range.py", line 283, in __init__
self._create_ranges(pgrange, pyrange)
File "/Users/mm/.pyenv/versions/3.7.13/lib/python3.7/site-packages/psycopg2/_range.py", line 302, in _create_ranges
if isinstance(pgrange, basestring):
NameError: name 'basestring' is not define
I am wondering how can I solve it ?
I already tried downgrading pip to 20.3 after seeing this issue https://github.com/psycopg/psycopg2/issues/1419.
Resolved this by manually transforming psycopg2 package to a python 3 compatible version running:
pip install 2to3
2to3 ~/.pyenv/versions/3.7.13/lib/python3.7/site-packages/psycopg2/ -w
Still have no idea why this error occured though.

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.

PIP Install Failing

I am learning Python and the documentation I am following suggested installing Firebird. I ran sudo pip install fdb.
I saw a build directory which I understand just contains the source code and not the binaries so I deleted that. When I do pip freeze | grep fdb, I cannot find Firebird.
I tried running sudo pip install fdb again and I am getting this error now (and the build directory is returning):
Downloading/unpacking fdb
Downloading fdb-0.9.9.tar.gz (481Kb): 481Kb downloaded
Running setup.py egg_info for package fdb
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/Users/nayef/Documents/Django/build/fdb/setup.py", line 7, in <module>
from fdb import __version__
File "fdb/__init__.py", line 23, in <module>
from fdb.fbcore import *
File "fdb/fbcore.py", line 26, in <module>
from . import ibase
File "fdb/ibase.py", line 1164, in <module>
isc_attach_database = fb_library.isc_attach_database
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, isc_attach_database): symbol not found
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/Users/nayef/Documents/Django/build/fdb/setup.py", line 7, in <module>
from fdb import __version__
File "fdb/__init__.py", line 23, in <module>
from fdb.fbcore import *
File "fdb/fbcore.py", line 26, in <module>
from . import ibase
File "fdb/ibase.py", line 1164, in <module>
isc_attach_database = fb_library.isc_attach_database
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, isc_attach_database): symbol not found
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /Users/nayef/Documents/Django/build/fdb
Storing complete log in /Users/nayef/Library/Logs/pip.log
What am I doing wrong here? I'm not sure what's wrong with pip. I never faced any issues with it.
This isn't pip failing, this is the fdb package installation failing.
It seems you have some drivers missing, specifically, the firebird header files.
Do you have firebird installed? Make sure you install the Python bindings only after the driver has been installed.

import jenkins in python fails on mac

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.

Categories