IBM_DB Package Installation Python 3.4 - python

I am having difficulty installing the ibm_db package for Python 3.4 on a 32 bit windows virtual server. I have tried easy_install, pip, and installing the pacakge manually. When I used pip install I am able to reference the package with import ibm_db, but I am not able to use it without getting the following error:
Traceback (most recent call last):
File "C:/Python34/Lib/site-packages/ibm_db-2.0.6-py3.4.egg/ibm_db.py", line 10, in <module>
__bootstrap__()
File "C:/Python34/Lib/site-packages/ibm_db-2.0.6-py3.4.egg/ibm_db.py", line 9, in __bootstrap__
imp.load_dynamic(__name__,__file__)
ImportError: DLL load failed: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
When I use easy_install I am unable to reference the library using import ibm_db. I was wondering if there was a simple solution to this.

How to make ibm_db work on MAC
Make sure that you has IBM DB2 EXPRESS 2 installed on your machine:
https://www.ibm.com/analytics/us/en/db2/trials/?S_CMP=ECDDWW01&S_TACT=ACDB201
To install the DB2 EXPRESS 2 extact the files into your computer and:
cd ~/Downloads/expc ; sudo ./db2_install
Make sure that you has your $HOSTNAME variable properly configured:
echo "127.0.0.1 $HOSTNAME" >>/etc/hosts
Create another user using mac gui
(System Preferences -> Users & Groups). Use Standard (Non-Admin) privileges.
Create the instance with these commands:
cd /opt/IBM/db2/V10.1/instance ; sudo ./db2icrt -u <newuser> <newuser>
Export the following variables
$ sudo -s
$ export IBM_DB_LIB=/Users/<newuser>/sqllib/lib64
$ export IBM_DB_DIR=/Users/<newuser>/sqllib
$ export ARCHFLAGS="-arch x86_64"
Intall ibm_db
pip3 install ibm_db

Try easy_install ibm_db, it worked for me on both Linux and Windows.

Similar problem has been addressed here:
https://groups.google.com/forum/#!topic/ibm_db/-HaQ48BhcfQ
Please check if that helps!

Related

Python doesn't recognize standard library modules

I can't import standard library modules (like ssl and tkinter) when I'm not running Python from "/Python3.8.10/Modules" directory:
/Python3.8.10/Modules/# python
>>> import ssl
Traceback(most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
Same error happens if I try to import "_ssl" directly.
When I'm running Python in /Python3.8.10/Modules" directory everything works fine.
What could be causing this error?
I am using Debian and I used this tutorial https://linuxhint.com/install-python-debian-10/ to install it.
Judging from your comment you didn't install Python, but just downloaded and unzipped the Source Code.
I am on Debian. I unzipped (untar-ed) Python-3.8.10.tgz (Which comes from the Python website).
If you download the tar ball directly you still have to build Python by cd-ing into the Location you extracted it to and then running:
$ ./configure --enable-optimizations
$ make -j 4
$ sudo make altinstall # altinstall will install Python3.8 at /usr/bin/Python3.8 instead of /usr/bin/Python which could overwrite previously installed versions.
$ sudo ln -s /usr/bin/python /usr/bin/python3.8 # ONLY if you want Python3.8 to be available as just python
Edit: Those are just the commands that i remembered out of my head which worked for me on various systems. They also have some requirements (build-essentials and make being two of them) so this might not work for you.
See here or probably on any site when searching for build Python from source in your favorite search engine.

ImportError: No module named ansible after installing Ansible 2.9 via PIP

Would like to know if anyone encountered this same concern I've been receiving:
Traceback (most recent call last):
File "/usr/local/ansible2.9/bin/ansible-playbook", line 34, in <module>
from ansible import context
ImportError: No module named ansible
So we have 2 ansible versions installed on our server and would like to run some jobs in ansible 2.9, we created separate environments per versions. So I activated ansible 2.9 env then proceeded to run the usual command "ansible-playbook playbook.yml .... " but we're getting this error.
The package was installed via pip, please see below:
[root#jenkins local]# virtualenv-2.7 --no-site-packages /usr/local/ansible2.9
New python executable in /usr/local/ansible2.9/bin/python2.7
Also creating executable in /usr/local/ansible2.9/bin/python
Installing setuptools, pip, wheel...done.
[root#jenkins local]# source /usr/local/ansible2.9/bin/activate
(ansible2.9) [root#jenkins local]# pip2.7 install git+git://github.com/ansible/ansible.git#stable-2.9
Please note that all required libraries have been installed. Python 2.7 is also installed. I'm using RHEL 6. Ansible 2.7 environment works fine, but this recently installed version is throwing "ImportError: No module named ansible"
Any idea how to fix this? Thanks!
Found the solution. It seems that the permission of the Ansible 2.9 has not been set properly. Fixed it with this commands:
chmod -R 644 /usr/local/ansible2.9/
find /usr/local/ansible2.9/ -type d -print0 |xargs -0 chmod 755
Also, for Ansible 2.9 together with openstack, openstacksdk will not suffice, still need to install 'future' library.
Command: pip install ansible openstacksdk future
Source:
Issue - https://github.com/ansible/ansible/issues/68616
Fix - https://github.com/atodorov/lorax/commit/5103e0b585564c62e3007b68d945fc56a542c474

Curl is configured to use SSL, but we have not been able to determine which SSL backend it is using

When I perform pip install thumbor I get the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/t9/***********************/T/pip-install-knrabyuy/pycurl/setup.py", line 913, in <module>
ext = get_extension(sys.argv, split_extension_source=split_extension_source)
File "/private/var/folders/t9/***********************/T/pip-install-knrabyuy/pycurl/setup.py", line 582, in get_extension
ext_config = ExtensionConfiguration(argv)
File "/private/var/folders/t9/***********************/T/pip-install-knrabyuy/pycurl/setup.py", line 99, in __init__
self.configure()
File "/private/var/folders/t9/***********************/T/pip-install-knrabyuy/pycurl/setup.py", line 316, in configure_unix
specify the SSL backend manually.''')
__main__.ConfigurationError: Curl is configured to use SSL, but we have not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually.
I've tried brew install curl (which was successfull) however I get the same error when I perform pip install thumbor.
Any idea why?
It seems like it's pycurl install error.
When installing on centos try this:
export PYCURL_SSL_LIBRARY=openssl
If you install on macos try this one:
export PYCURL_SSL_LIBRARY=openssl
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include
then run pip install pycurl
I was receiving this error when deploying to Beanstalk since I need pycurl for Celery. While in many discussions people recommend different ssl options, my solution was not to use any of these options. Python config file for deploying looks as follows:
packages:
yum:
git: []
postgresql93-devel: []
libcurl-devel: []
libjpeg-turbo-devel: []
commands:
01_download_pip3:
command: 'curl -O https://bootstrap.pypa.io/get-pip.py'
02_install_pip3:
command: 'python3 get-pip.py'
03_pycurl_uninstall:
command: '/usr/bin/yes | sudo /opt/python/run/venv/bin/pip3 uninstall pycurl'
04_pycurl_reinstall:
command: 'sudo /opt/python/run/venv/bin/pip3 install pycurl'
I did not set any environment variables within the software configuration of Beanstalk.
On MacOS Mojave this worked for me:
export PYCURL_SSL_LIBRARY=openssl
export LDFLAGS=-L/usr/local/opt/openssl/lib;export CPPFLAGS=-I/usr/local/opt/openssl/include;pip3 install pycurl --compile --no-cache-dir
I couldn't get past this error with Python 3.6 from Software Collections, so I installed Python 3.5 from the same repository.
Then I installed Pycurl with:
sudo yum install sclo-python35-python-pycurl
Which worked just fine. The reason I used 3.5 is because there wasn't a similar package for 3.6. So you might want to try finding Pycurl on your package manager for the version you're using and install it that way instead.

Cannot import psycopg2 from python3 on fedora 27

I've just upgraded to Fedora 27, and have been unable to get psycopg2 working.
I'd very much appreciate any help anyone can provide.
As a simple test case, I've been executing
>>> import psycopg2
at the interactive shell. This works fine for Python 2.7, but fails for Python 3.x.
With Python 3.4 and 3.5, I get the message:
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named 'psycopg2'
With Python 3.6, I see:
Traceback (most recent call last):
File "", line 1, in
File "/home/jazcap53/.local/lib/python3.6/site-packages/psycopg2/init.py", line 50, in
from psycopg2._psycopg import ( # noqa
ImportError: /home/jazcap53/.local/lib/python3.6/site-packages/psycopg2/.libs/libresolv-2-c4c53def.5.so: symbol __res_maybe_init, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
I installed Fedora 27 from DVD-ROM. I find psycopg2 packages located at
/usr/lib64/python2.7/site-packages
and
/home/jazcap53/.local/lib/python3.6/site-packages
My Python packages were all either included with Fedora, or installed via dnf. They are:
python3-3.6.3-2.fc27.x86_64
python35-3.5.4-1.fc27.x86_64
python34-3.4.7-1.fc27.x86_64
python2-2.7.14-2.fc27.x86_64
Some packages I have installed that may be relevant are:
python2-devel-2.7.14-2.fc27.x86_64
python3-devel-3.6.3-2.fc27.x86_64
libpqxx-1:5.0.1-2.f27.x86_64
libpqxx-devel-1:5.0.1-2.f27.x86_64
libgcc-7.2.1-2.fc27.x86_64
postgresql-devel-9.6.6-1.fc27.x86_64
P.S.: If I'm asking this question in the wrong place, please direct me to the right place.
Edit:
I noticed that:
/usr/lib64/python2.7/site-packages/
contains subdirectories
psycopg2 and
psycopg2-2.7.3-py2.7.egg-info
but
/usr/lib64/python3.4/site-packages/ and
/usr/lib64/python3.5/site-packages/
contain nothing related to psycopg2
and
/usr/lib64/python3.6/site-packages/
contains subdirectory
psycopg2-2.7.3-py3.6.egg-info
but not psycopg2 itself
As you may have noticed, each version of Python has its own package hierarchy. So the installation on Python 3.6 will not give you access on 3.4 and 3.5.
With that said, there seems to be some problem with the system's standard lib with Python 3.6. One solution to that could be to install without binaries, like this:
python3.6 -m pip uninstall psycopg2
python3.6 -m pip install --no-binary :all: psycopg2
To install psycopg2 on 3.4 and 3.5 you would run these with or without the --no-binary option:
python3.4 -m pip install psycopg2
python3.5 -m pip install psycopg2
If you have automatic installs / docker install you need to ensure you add the following line to requirements.txt to ensure psycopg2 installs from source, rather than using the binary, or you'll continue to experience the above issue upon deployment.
psycopg2>=2.7,<2.8 --no-binary psycopg2

debugging python setup.py for an open source library - bcfg2

When I install bcfg2 - http://bcfg2.org using
pip install git+git://git.mcs.anl.gov/bcfg2.git#egg=Bcfg2
or
pip install bcfg2
I am able to get bcfg2 working. Calling sudo bcfg2-admin init, shows me the set-up configuration steps/stdin prompt as expected.
When I introduce the -e option like this (in a new/clean virtualenv),
pip install -e git+git://git.mcs.anl.gov/bcfg2.git#egg=Bcfg2
And I attempt to call sudo bcfg2-admin init, I get an error message:-
calvin$ bcfg2-admin init
Traceback (most recent call last):
File "/Users/calvin/.virtualenvs/bcfg2/bin/bcfg2-admin", line 7, in <module>
execfile(__file__)
File "/Users/calvin/.virtualenvs/bcfg2/src/bcfg2/src/sbin/bcfg2-admin", line 6, in <module>
import Bcfg2.Server.Core
ImportError: No module named Bcfg2.Server.Core
This leads me to think that there is something wrong with the way setup.py is written for bcfg2. The file is located here - https://github.com/Bcfg2/bcfg2/blob/master/setup.py
Appreciate any input from pythonistas who are experts with python packaging and the configuration of setup.py.
You've installed to a virtual environment (-e). However when you run this with sudo python gets executed as root without the virtual environment available.
If you run sudo su you should be dropped into a root shell. You can then activate the virtual environment and run bcfg2-admin.
The setup.py has a bug.
Figured it out, fixed it and sent a pull request to bcfg2 maintainers.
Reference - https://github.com/Bcfg2/bcfg2/pull/28

Categories

Resources