I'm having a heck of a time trying to get cx_Oracle installed.
I've tried various versions of the Oracle libraries. The ones I get closest with the 32-bit 11.1 libraries
oracle-instantclient11.1-basic-11.1.0.7.0-1.i386.rpm
oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm
oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.i386.rpm
I have the environment variables set to:
[~]# set | grep -i oracle
LD_LIBRARY_PATH=/usr/lib/oracle/11.1/client/lib:
ORACLE_HOME=/usr/lib/oracle/11.1/client/lib
PATH=/usr/lib/oracle/11.1/client/lib:/home/sekingerg/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/.rvm/bin
SQLPATH=/usr/lib/oracle/11.1/client/lib:
and when I run pipinstall, it fails to find the include files:
[~]# pip install cx_Oracle
Downloading/unpacking cx-Oracle
Running setup.py egg_info for package cx-Oracle
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build-root/cx-Oracle/setup.py", line 180, in <module>
raise DistutilsSetupError("cannot locate Oracle include files")
distutils.errors.DistutilsSetupError: cannot locate Oracle include files
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build-root/cx-Oracle/setup.py", line 180, in <module>
raise DistutilsSetupError("cannot locate Oracle include files")
distutils.errors.DistutilsSetupError: cannot locate Oracle include files
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-root/cx-Oracle
Storing complete log in /root/.pip/pip.log
Here's the rpms that have been installed:
[~]# rpm -qa | grep -i oracle
oracle-instantclient11.1-devel-11.1.0.7.0-1.i386
oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.i386
oracle-instantclient11.1-basic-11.1.0.7.0-1.i386
[~]#
I also tried to install the cx_Oracle rpm: cx_Oracle-5.1.2-11g-py33-1.x86_64.rpm and that didn't work either.
[~]# rpm -ipv cx_Oracle-5.1.2-11g-py33-1.x86_64.rpm
Preparing packages for installation...
cx_Oracle-5.1.2-1
But after that install, it's still not recognized.
[~]# python3
Python 3.3.2 (default, Nov 18 2013, 12:27:03)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'cx_Oracle'
>>>
I wrote this script about one years ago for install cx_Oracle in debian:
TMP_ORACLE_HOME="/usr/lib/oracle/11.2/client64"
dpkg -i $PWD/libpython3.2_3.2.3-2_amd64.deb
dpkg -i $PWD/libaio1_0.3.107-7_amd64.deb
dpkg -i $PWD/oracle-instantclient11.2-basic_11.2.0.3.0-2_amd64.deb
echo "$TMP_ORACLE_HOME/lib" > /etc/ld.so.conf.d/oracle.conf
echo "export ORACLE_HOME=$TMP_ORACLE_HOME" > /etc/profile.d/oracle.sh
dpkg -i $PWD/cx-oracle_5.1.2-2-py32_amd64.deb
cd /usr/lib/python3.2
mv site-packages dist-packages
ln -s dist-packages site-packages
ldconfig
I also encountered this situation. The issue was a permissions issue due to installations requiring "sudo" permissions for "pip install".
NOTE: I'm using oracle linux 6, so mileage may differ
Here is the directory listing where cx_Oracle.so was sent following build so you can see the default permissions (compare to cx_Freeze, for example, which has world access):
[vagrant#oracle /]$ ll /usr/lib64/python2.6/site-packages
total 4308
drwxr-xr-x 5 root root 4096 Jan 17 09:48 cx_Freeze
drwxr-x--- 2 root root 4096 Jan 17 11:30 cx_Oracle-5.1.2-py2.6.egg-info
-rwxr-x--- 1 root root 351475 Jan 17 11:30 cx_Oracle.so
I could identify this issue with the following, which executes python as root, and then "import cx_Oracle" works:
[vagrant#oracle cx_OracleTools-8.0]$ sudo ORACLE_HOME=/usr/lib/oracle/11.2/client64 LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/oracle/11.2/client64/lib python
Python 2.6.6 (r266:84292, Oct 15 2013, 07:32:41)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>>
So... I hit it over the head with a hammer... and let my user own it all (which is the wrong solution, admittedly, and may have later fallout.
- I would love to hear the right way to let my vagrant user "pip install"
Hope this help,
J
Nothing I did could resolve the library issue. While Farhadix's suggestion was helpful, I could not get past this error when doing an "import cx_Oracle":
ImportError: libpython3.3m.so.1.0: cannot open shared object file: No such file or directory
I ended up removing the cx_Oracle package (rpm -e cx_Oracle-5.1.2-1.x86_64) and building the module from source following instructions from here. That was what I needed to do to get the extension to work on CentOS 6.4 with python 3.3.
Related
I ran pip3 install opencv-python==3.3.0.10
but I am getting
$ python3
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'
I know there are many ways to install opencv but this one seemed the most straightforward.
1 - Open a terminal and pip install cmake:
pip install cmake
2 - Download opencv repository from https://github.com/opencv/opencv
3 - On your terminal cd to the folder where you downloaded the opencv repository and compile it with cmake typing the following commands:
mkdir release
cd release
cmake -D CMAKE_BULD_TYPE=RELEASE -D BUILD_PYTHON_SUPPORT=ON USE_V4L=ON WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON USE_GStreamer=ON ..
make
make install
Opencv is now correctly installed on your machine and you should be able to successfully import it in Python with no error.
Let me know if this solves the problem
I wrote a command line tool with cliff 2.3.0, tested on my laptop (Mac, Python 2.7.12). When I was tried to install it (python setup.py install) on a server (Linux, Python 2.7.2), I encountered this error:
Installed /private/tmp/easy_install-EGMO15/cliff-2.3.0/pbr-1.10.0-py2.7.egg
ERROR:root:Error parsing
Traceback (most recent call last): File "/private/tmp/easy_install-EGMO15/cliff-2.3.0/pbr-1.10.0-> py2.7.egg/pbr/core.py", line 111, in pbr
attrs = util.cfg_to_args(path, dist.script_args) File "/private/tmp/easy_install-EGMO15/cliff-2.3.0/pbr-1.10.0-py2.7.egg/pbr/util.py", line 248, in cfg_to_args
kwargs = setup_cfg_to_setup_kwargs(config, script_args) File "/private/tmp/easy_install-EGMO15/cliff-2.3.0/pbr-1.10.0-py2.7.egg/pbr/util.py", line 431, in setup_cfg_to_setup_kwargs
if pkg_resources.evaluate_marker('(%s)' % env_marker):
AttributeError: 'module' object has no attribute 'evaluate_marker' error: Setup script exited with error in setup command: Error parsing /private/tmp/easy_install-EGMO15/cliff-2.3.0/setup.cfg: AttributeError: 'module' object has no attribute 'evaluate_marker'
Any suggestions?
It looks like your server may have a (much) older version of the setuptools package installed (which provides the pkg_resources module). The evaluate_marker method looks as if it first showed up at the end of 2014, so if you're using an older system it is possible that method is not available.
Depending on your environment, you may be able to simply pip install -U setuptools, or you may need to see if your distribution has a newer isntallable package available.
If you can update your question to include details about your server's operating environment (what distribution and version are you running? What version of Python? What version of setuptools?), we can probably provide a more complete answer.
Update
For example, Ubuntu 12.04 only has setuptools 0.6, and the pkg_resources module (which is packaged in the python-pkg-resources package) does not have the evaluate_marker method:
# python
Python 2.7.3 (default, Jun 22 2015, 19:33:41)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> pkg_resources.evaluate_marker
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'evaluate_marker'
In this environment, I can install pip:
# apt-get install python-pip
And then upgrade the installed version of setuptools:
# pip install -U setuptools
And now:
# python
Python 2.7.3 (default, Jun 22 2015, 19:33:41)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> pkg_resources.evaluate_marker
<function evaluate_marker at 0x1535050>
>>>
NB Upgrading distribution packages (e.g., things installed by apt-get in this example) using pip can often lead to sadness and heartache, and you are much better off if you are able to upgrade the underlying environment to one where such workarounds are not necessary. Alternatively, running your code from a Python virtual environment (so that your upgraded packages do not override system packages) is also a technically better solution.
I have done through the other questions online here, and I feel that mine is different enough to warrant a new question.
So I have a Centos 6 box, which is running a small website for me, acts as an office git server and I am trying to configure Python3 on it.
So I followed the following these steps to set up python3 on the server. However it seems that I cannot import paramiko into my script.
I downloaded the paramiko rpm however I get this message:
When I try to import paramiko I get:
[root#GIT Python-3.4.2]# rpm -ivh /usr/lib/Python-3.4.2/Modules/python-paramiko-1.7.5-2.1.el6.noarch.rpm
Preparing... ########################################### [100%]
package python-paramiko-1.7.5-2.1.el6.noarch is already installed
When I run python3 directly:
[root#GIT inserv_health_check]# python3
Python 3.4.2 (default, Jan 21 2015, 06:28:04)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'paramiko'
>>>
I am sure there is a simple solution to this problem perhaps the path is wrong, or I should have put a symbolic link in somewhere. Any help would be appreciated :)
Before anyone asks, which python output:
[root#GIT Python-3.4.2]# which python
/usr/bin/python
[root#GIT Python-3.4.2]# which pytho~n3
/usr/bin/which: no pytho~n3 in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root#GIT Python-3.4.2]# which python3
/usr/local/bin/python3
Thanks
You need to do pip install paramiko so that python sees that module. If you work on a virtual environment, you need to workon <env_name> first and then pip install the desired module.
type pip3 install paramiko
if you want to install it for python3
I am doing a course on udacity where I need need to install twilio for python. I have sucessfully installed but still i get import error
Any pointers or help will be useful:
abhinav#abhinav-HP-Pavilion-dv5-Notebook-PC:~$ which -a python
/usr/local/bin/python
/usr/bin/python
abhinav#abhinav-HP-Pavilion-dv5-Notebook-PC:~$ which -a pip
/usr/bin/pip
abhinav#abhinav-HP-Pavilion-dv5-Notebook-PC:~$ pip freeze|grep twilio
Warning: cannot find svn location for distribute==0.6.24dev-r0
twilio==3.6.6
abhinav#abhinav-HP-Pavilion-dv5-Notebook-PC:~$ pip install --upgrade twilio
abhinav#abhinav-HP-Pavilion-dv5-Notebook-PC:~$ sudo pip install --upgrade twilio
abhinav#abhinav-HP-Pavilion-dv5-Notebook-PC:~$ python
Python 2.7.6 (default, Mar 16 2014, 19:06:43)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
</code>
>>> import twilio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named twilio
>>>
You have two python installs, your pip is pointing to /usr/bin so and your default python is in /usr/local/bin.
You can remove the /usr/bin/pip and install pip get-pip.py, which will use your now default /usr/local/bin/python.
It would probably be best to remove one of the python installs and set your paths accordingly.
Just be careful when removing python, it can be detrimental to your system if you mess up your python install.
I get the following errors, I've placed [my name] for anonymity:
>>> python /Users/[myname]/Desktop/setuptools-0.6c11/ez_setup.py
File "<stdin>", line 1
python /Users/[myname]/Desktop/setuptools-0.6c11/ez_setup.py
^
SyntaxError: invalid syntax
If you can't see the ^ is under the 11.
Or I get this error:
>>> python /Users/[myname]/Desktop/EZ_tutorial/ez_setup.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'python' is not defined
The ez_setup.py script may or may not work depending on your environment. If not, follow the instructions here. In particular, from the shell, make sure that the python 2.6 you installed is now invoked by the command python:
$ python
Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
If not, modify your shell's PATH environment variable. Then download the setuptools 2.6 python egg from here, change to your brower's download directory, and run the downloaded script:
$ cd ~/Downloads # substitute the appropriate directory name
$ sh setuptools-0.6c11-py2.6.egg
Try running that command from a shell (i.e. straight from Terminal.app), not from inside the python interpreter.