I installed the p4 library on my local archlinux machine and everything works smoothly.
I was now trying to do the same on a couple of virtual machines (with same OS also 64 bits) but can't get it running...
The installation goes well and doesn't complain, but when I try to import it I get:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "P4.py", line 312, in <module>
import P4API
ImportError: /usr/lib/python2.7/site-packages/P4API.so: undefined symbol: TLSv1_method
If I look in the symbols with
nm -A /usr/lib/python2.7/site-packages/P4API.so
I can see that in fact all the SSL-related symbols are undefined (while being defined on the working one), but why on earth?
I have openssl installed and Python is installed in exactly the same way, I can't find any other library that should be useful.
Any idea?
EDIT:
apparently the only difference is that in the wrong installation of P4 P4API.so is missing librt from the "ldd" output (and librt is actually there).
Not sure how it would relate to the TLS problem, and trying to reinstall glibc and then
p4python but no luck still..
Rebuilding the P4Python against the "rt" and "ssl" libraries fixes this.
Take the P4 API off the perforce site (e.g. for Linux take this: http://filehost.perforce.com/perforce/r13.2/bin.linux26x86_64/p4api.tgz)
Take the source code of P4Python off http://public.perforce.com/guest/robert_cowham/perforce/API/python/main/p4python.zip
tar xf the P4 API archive
Unzip the p4pthon archive
Edit setup.cfg to point to the P4API directory
Edit setup.py and go to line 120 and add "ssl" and "rt" so it looks like this
else: # Assume Linux
libraries = ["client", "rpc", "supp", "ssl", "rt"] # P4API libs
extra_compile_args = ["-DOS_LINUX", "-D%s" % p4_api_ver]
Do sudo python setup.py install
Related
I've just installed virt-manager with pkgin on NetBSD 9.2 just because I want to emulate the virtual machines with qemu + nvmm on NetBSD 9.2. The installation of virt-manager went ok. But,when I ran it,an error came up :
netbsd-marietto# virt-manager
Traceback (most recent call last):
File "/usr/pkg/share/virt-manager/virt-manager.py", line 386, in <module>
main()
File "/usr/pkg/share/virt-manager/virt-manager.py", line 247, in main
from virtManager import cli
File "/usr/pkg/share/virt-manager/virtManager/cli.py", line 29, in <module>
import libvirt
ImportError: No module named libvirt
Googling a little bit maybe I've found the solution here :
https://www.unitedbsd.com/d/285-linux-user-and-netbsd-enthusiast-hoping-to-migrate-some-day
where "kim" said :
Looking at pkgsrc/sysutils/libvirt/PLIST it doesn't look like the package provides any Python bindings -- which is what the "ImportError: No module named libvirt" error message is about. You could try py-libvirt from pkgsrc-wip and see how that works out.
I tried to start the compilation like this :
netbsd-marietto# cd /home/mario/Desktop/pkgsrc-wip/py-libvirt
netbsd-marietto# make
but I've got this error :
make: "/home/mario/Desktop/pkgsrc-wip/py-libvirt/Makefile" line 15: Could not find ../../wip/libvirt/buildlink3.mk
make: "/home/mario/Desktop/pkgsrc-wip/py-libvirt/Makefile" line 16: Could not find ../../lang/python/distutils.mk
make: "/home/mario/Desktop/pkgsrc-wip/py-libvirt/Makefile" line 17: Could not find ../../mk/bsd.pkg.mk
make: Fatal errors encountered -- cannot continue
If u want to see the content of the Makefile,it is :
gedit /home/mario/Desktop/pkgsrc-wip/py-libvirt/Makefile
#$NetBSD: Makefile,v 1.32 2018/11/30 09:59:40 adam Exp $
PKGNAME= ${PYPKGPREFIX}-${DISTNAME:S/-python//}
DISTNAME= libvirt-python-5.8.0
CATEGORIES= sysutils python
MASTER_SITES= https://libvirt.org/sources/python/
MAINTAINER= pkgsrc-users#NetBSD.org
HOMEPAGE= https://libvirt.org/sources/python/
COMMENT= libvirt python library
LICENSE= gnu-lgpl-v2
USE_TOOLS+= pkg-config
.include "../../wip/libvirt/buildlink3.mk"
.include "../../lang/python/distutils.mk"
.include "../../mk/bsd.pkg.mk"
Can someone help me to fix the error ? very thanks.
You are getting those errors because your copy of pkgsrc wip is not inside a pkgsrc tree.
Please follow the pkgsrc wip documentation to correctly use pkgsrc wip. Especially look at the section titled Getting the "source".
In brief, assuming you have a copy of pkgsrc in /usr/pkgsrc and you want to use git to checkout pkgsrc wip, run these commands:
cd /usr/pkgsrc
git clone git://wip.pkgsrc.org/pkgsrc-wip.git wip
Then build py-libvirt with these commands:
cd /usr/pkgsrc/wip/py-libvirt
make
If it builds successfully, you could install it with:
cd /usr/pkgsrc/wip/py-libvirt
make install
I am getting following error even after having following packages installed. Recently os has been upgraded and python has been updated from 2.5 to 2.7 and before that application was using 2.7.11 which is installed on local folder.
After up gradation I am unable to run my scirpts and getting following ssl error.
File "/itStorage/tools/swutils/pylibs/shu/common.py", line 5, in <module>
import ssl
File "/itStorage/tools/swutils/deps/python_2.7.11/lib/python2.7/ssl.py", line 97, in
import _ssl # if we can't import it, let the error propagate
ImportError: libssl.so.6: cannot open shared object file: No such file or directory
After searching google it may be due to openssl packages or libssl path. we have every thing in place even after that we having issue.
[aafedc#afeae ~]$ sudo rpm -qa *openssl*
openssl-1.0.2k-8.el7.x86_64
openssl-devel-1.0.2k-8.el7.x86_64
openssl-libs-1.0.2k-8.el7.i686
openssl-libs-1.0.2k-8.el7.x86_64
openssl098e-0.9.8e-29.el7_2.3.i686
[abcd#abcd ~]$ sudo ls -l /usr/lib/libssl.so.6*
lrwxrwxrwx. 1 root root 16 May 25 03:34 /usr/lib/libssl.so.6 -> libssl.so.0.9.8e
any help is greatly appropriated!!..
Thanks in advance.
You could try to run the script using strace, then you should see what fails.. I'm not sure but I think it could be a missing dependency of libssl as well or permissions problem.
I'm trying to run a python script using python 2.6.4. The hosting company has 2.4 installed so I compiled my own 2.6.4 on a similar server and then moved the files over into ~/opt/python. that part seems to be working fine.
anyhow, when I run the script below, I am getting ImportError: No module named _sqlite3 and I'm not sure what to do to fix this.
Most online threads mention that sqlite / sqlite3 is included in python 2.6 - so I'm not sure why this isn't working.
-jailshell-3.2$ ./pyDropboxValues.py
Traceback (most recent call last):
File "./pyDropboxValues.py", line 21, in
import sqlite3
File "/home/myAccount/opt/lib/python2.6/sqlite3/__init__.py", line 24, in
from dbapi2 import *
File "/home/myAccount/opt/lib/python2.6/sqlite3/dbapi2.py", line 27, in
from _sqlite3 import *
ImportError: No module named _sqlite3
I think I have everything set up right as far as the directory structure.
-jailshell-3.2$ find `pwd` -type d
/home/myAccount/opt
/home/myAccount/opt/bin
/home/myAccount/opt/include
/home/myAccount/opt/include/python2.6
/home/myAccount/opt/lib
/home/myAccount/opt/lib/python2.6
/home/myAccount/opt/lib/python2.6/distutils
/home/myAccount/opt/lib/python2.6/distutils/command
/home/myAccount/opt/lib/python2.6/distutils/tests
/home/myAccount/opt/lib/python2.6/compiler
/home/myAccount/opt/lib/python2.6/test
/home/myAccount/opt/lib/python2.6/test/decimaltestdata
/home/myAccount/opt/lib/python2.6/config
/home/myAccount/opt/lib/python2.6/json
/home/myAccount/opt/lib/python2.6/json/tests
/home/myAccount/opt/lib/python2.6/email
/home/myAccount/opt/lib/python2.6/email/test
/home/myAccount/opt/lib/python2.6/email/test/data
/home/myAccount/opt/lib/python2.6/email/mime
/home/myAccount/opt/lib/python2.6/lib2to3
/home/myAccount/opt/lib/python2.6/lib2to3/pgen2
/home/myAccount/opt/lib/python2.6/lib2to3/fixes
/home/myAccount/opt/lib/python2.6/lib2to3/tests
/home/myAccount/opt/lib/python2.6/xml
/home/myAccount/opt/lib/python2.6/xml/parsers
/home/myAccount/opt/lib/python2.6/xml/sax
/home/myAccount/opt/lib/python2.6/xml/etree
/home/myAccount/opt/lib/python2.6/xml/dom
/home/myAccount/opt/lib/python2.6/site-packages
/home/myAccount/opt/lib/python2.6/logging
/home/myAccount/opt/lib/python2.6/lib-dynload
/home/myAccount/opt/lib/python2.6/sqlite3
/home/myAccount/opt/lib/python2.6/sqlite3/test
/home/myAccount/opt/lib/python2.6/encodings
/home/myAccount/opt/lib/python2.6/wsgiref
/home/myAccount/opt/lib/python2.6/multiprocessing
/home/myAccount/opt/lib/python2.6/multiprocessing/dummy
/home/myAccount/opt/lib/python2.6/curses
/home/myAccount/opt/lib/python2.6/bsddb
/home/myAccount/opt/lib/python2.6/bsddb/test
/home/myAccount/opt/lib/python2.6/idlelib
/home/myAccount/opt/lib/python2.6/idlelib/Icons
/home/myAccount/opt/lib/python2.6/tmp
/home/myAccount/opt/lib/python2.6/lib-old
/home/myAccount/opt/lib/python2.6/lib-tk
/home/myAccount/opt/lib/python2.6/hotshot
/home/myAccount/opt/lib/python2.6/plat-linux2
/home/myAccount/opt/lib/python2.6/ctypes
/home/myAccount/opt/lib/python2.6/ctypes/test
/home/myAccount/opt/lib/python2.6/ctypes/macholib
/home/myAccount/opt/share
/home/myAccount/opt/share/man
/home/myAccount/opt/share/man/man1
And finally the contents of the sqlite3 directory:
-jailshell-3.2$ find `pwd`
/home/myAccount/opt/lib/python2.6/sqlite3
/home/myAccount/opt/lib/python2.6/sqlite3/__init__.pyo
/home/myAccount/opt/lib/python2.6/sqlite3/dump.pyc
/home/myAccount/opt/lib/python2.6/sqlite3/__init__.pyc
/home/myAccount/opt/lib/python2.6/sqlite3/dbapi2.pyo
/home/myAccount/opt/lib/python2.6/sqlite3/dbapi2.pyc
/home/myAccount/opt/lib/python2.6/sqlite3/dbapi2.py
/home/myAccount/opt/lib/python2.6/sqlite3/dump.pyo
/home/myAccount/opt/lib/python2.6/sqlite3/__init__.py
/home/myAccount/opt/lib/python2.6/sqlite3/dump.py
I feel like I need to add something into the sqlite3 directory - maybe sqlite3.so? But I don't know where to get that.
What am I doing wrong here? Please remember that I'm using a shared host so that means installing / compiling on another server and then copying the files over. Thanks! :)
Update
Just wanted to confirm that the answer from #samplebias did work out very well. I needed to have the dev package installed on the machine I was compiling from to get it to add in sqlite3.so and related files. Also found the link in the answer very helpful. Thanks #samplebias !
Python's build system uses a setup.py file to compile all of the native extensions, including sqlite3. It searches common operating system paths for the sqlite3 include and library dirs. If the sqlite3 development package is not installed Python will skip compiling the _sqlite3.so extension, but the pure Python portion of the sqlite3 package will still be installed.
You would need to have the operating system's sqlite3 development package installed when you compile Python and at runtime: sqlite3-devel on Centos, both libsqlite3-0 and libsqlite3-dev on Ubuntu.
Here's an example of the _sqlite3.so extension linkage on my Ubuntu system:
% ldd /usr/lib/python2.6/lib-dynload/_sqlite3.so | grep sqlite3
libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x00007f29ef3be000)
% dpkg -S /usr/lib/libsqlite3.so.0
libsqlite3-0: /usr/lib/libsqlite3.so.0
In general, the first thing to do is to ask your host. I seems a bit odd that SQLite is not installed (or installed properly). So they'll likely fix it quite fast if you ask them.
For python 2.4, you need sqlite and bindings, pysqlite 2 or aspw
None of the files listed in the sqlite folder is the _sqlite3.pyd Python shared library. Are you sure you compiled it when compiling Python? What does the build log say? I think there's a configure flag that needs to be passed.
Alternatively, just install pysqlite
Compiled the libjpeg v8, PIL 1.1.7 and and import for _imaging works on the system Python, but spouts this error inside the virtualenv:
libjpeg.so.8: cannot open shared object file: No such file or directory
here is the error run with a python -v interpreter inside the virtualenv
>>> import _imaging
dlopen("/home/ygamretuta/dev/py/django/lib/python2.6/site-packages/PIL/_imaging.so", 2);
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libjpeg.so.8: cannot open shared object file: No such file or directory
and here are the paths:
/home/ygamretuta/dev/py/django/lib/python2.6/site-packages/distribute-0.6.14-py2.6.egg
/home/ygamretuta/dev/py/django/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg
/home/ygamretuta/dev/py/django/lib/python2.6
/home/ygamretuta/dev/py/django/lib/python2.6/plat-linux2
/home/ygamretuta/dev/py/django/lib/python2.6/lib-tk
/home/ygamretuta/dev/py/django/lib/python2.6/lib-old
/home/ygamretuta/dev/py/django/lib/python2.6/lib-dynload
/usr/lib/python2.6
/usr/lib/python2.6/plat-linux2
/usr/lib/python2.6/lib-tk
/home/ygamretuta/dev/py/django/lib/python2.6/site-packages
/home/ygamretuta/dev/py/django/lib/python2.6/site-packages/PIL
I am using Ubuntu 10.10 and this is the uname-a output:
Linux ygam-desktop 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:40:58 UTC 2011 i686 GNU/Linux
I am using Python 2.6
I followed the following guides already:
http://appelfreelance.com/2010/06/libjpeg-pil-snow-leopard-python2-6-_jpeg_resync_to_restart/
http://www.jooncode.com/2010/12/02/python-pil-jpeg-resync-restart-error-imaging-module-solve/
http://djangodays.com/2008/09/03/django-imagefield-validation-error-caused-by-incorrect-pil-installation-on-mac/
See an explanation here: Why can't Python find shared objects that are in directories in sys.path?
A quick fix is to add the directory that contains libjpeg.so.8 to your /etc/ld.so.conf file, and then run ldconfig
Also if you are doing local Python installations you can also control dynamic linking on the session level using LD_LIBRARY_PATH environment variable::
export LD_LIBRARY_PATH=/srv/plone/python/python-2.6/lib
python
import _imaging
...
This way you cannot break your OS itself, even accidentally. (It happens: http://opensourcehacker.com/2011/08/31/zend-server-installation-potentially-kills-your-ssh/)
Compiling the library from source works too: http://www.ijg.org/files/
Make sure to use jpegsrc.v8.tar.gz if you're on a Unix like system though. jpegsr8.zip appears to be the MS version, and throws all the standard formatting issues while building.
maybe just install libjpeg
conda install -c conda-forge libjpeg-turbo
I am trying to install postgrepsql to cygwin on a windows 7 machine and want it to work with django.
After built and installed postgrepsql in cygwin, I built and installed psycopg2 in cygwin as well and got no error, but when use it in python with cygwin, I got the "no such process" error:
import psycopg2
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.5/site-packages/psycopg2/init.py", line 60, in
from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: No such process
any clues?
Thanks!
Jerry
The no such process error comes about because psycopg2 is looking for cygpq.dll and can't find it.
When you install postgres from source, it puts this .dll in /usr/local/pgsql/lib/
Evidently, cygpq.dll is resolved by the win32 process loader, NOT cygwin or python, so you have to put it somewhere on your Windows path. A good spot is /usr/local/bin.
cp /usr/local/pgsql/lib/cygpq.dll /usr/local/bin/
In my case, I had to reinstall libpq5.
Why? There is native psycopg2 for Win.
you could try these:
http://www.stickpeople.com/projects/python/win-psycopg/