Re: Python not able to find package but it is installed

2017-05-31 Thread Mahmood Naderan via Python-list
Consider this output

[root@cluster ~]# pip --version
pip 9.0.1 from /opt/rocks/lib/python2.6/site-packages/pip-9.0.1-py2.6.egg 
(python 2.6)
[root@cluster ~]# easy_install --version
distribute 0.6.10
[root@cluster ~]# find /opt -name python
/opt/rocks/lib/graphviz/python
/opt/rocks/bin/python
/opt/rocks/usr/bin/python
/opt/python
/opt/python/bin/python
[root@cluster ~]# find /usr -name python
/usr/include/google/protobuf/compiler/python
/usr/bin/python
/usr/share/doc/m2crypto-0.20.2/demo/Zope/lib/python
/usr/share/doc/m2crypto-0.20.2/demo/ZopeX3/install_dir/lib/python
/usr/share/doc/m2crypto-0.20.2/demo/Zope27/install_dir/lib/python
/usr/share/gdb/python
/usr/share/swig/1.3.40/python
[root@cluster ~]# find /opt -name pip
/opt/rocks/lib/python2.6/site-packages/pip-9.0.1-py2.6.egg/pip
/opt/rocks/bin/pip
[root@cluster ~]# find /usr -name pip
[root@cluster ~]#




So, yes there are multiple versions of python and it seems that the search 
location of pip and python are different. I will try to modify the path to see 
what is what.
 
Regards,
Mahmood
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python not able to find package but it is installed

2017-05-31 Thread Wolfgang Maier

On 05/30/2017 09:27 PM, Mahmood Naderan via Python-list wrote:

Well yes. It looks in other folders


But

$ find /opt -name openpyxl
/opt/rocks/lib/python2.6/site-packages/openpyxl



So, your pip knows about a search path that python doesn't know.
That can have a number of reasons still and one would be Pavol's 
suggestion that your pip command may run on a different python than the 
python you invoke with the commmand 'python'. However, this would 
require that you have two separate installs of python2.6 on your system, 
which sounds rather unlikely.


Another possibility is that pip picks up additional directories from a 
pip config file somewhere. To check this you could compare


pip show openpyxl
to
pip show --isolated openpyxl
(which would ignore any pip config file or environment variable)

or (since I don't remember what commands your rather old version of pip 
will support):


pip list vs pip list --isolated
(which should give all installed packages pip knows about with and 
without additional config settings.


Wolfgang

--
https://mail.python.org/mailman/listinfo/python-list


Re: Python not able to find package but it is installed

2017-05-30 Thread Pavol Lisy
On 5/31/17, Dennis Lee Bieber  wrote:
> On Tue, 30 May 2017 19:27:48 + (UTC), Mahmood Naderan via Python-list
>  declaimed the following:
>
>># trying /usr/lib/python2.6/site-packages/openpyxl.so
>># trying /usr/lib/python2.6/site-packages/openpyxlmodule.so
>># trying /usr/lib/python2.6/site-packages/openpyxl.py
>># trying /usr/lib/python2.6/site-packages/openpyxl.pyc
>>Traceback (most recent call last):
>>File "", line 1, in 
>>ImportError: No module named openpyxl
>>
>>
>>
>>
>>But
>>
>>$ find /opt -name openpyxl
>>/opt/rocks/lib/python2.6/site-packages/openpyxl
>
>
>   Which tells us that the running python is not configured to LOOK in
> /opt/rocks/...
>
>   That means you need to modify the pythonpath environment to add your
> directory...

In case there are two python environment it could create mess.

Maybe problem started by adding /opt/rocks/bin into PATH manually? If
it is true I rather remove it, then  and then .
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python not able to find package but it is installed

2017-05-30 Thread Pavol Lisy
What is output from

$ pip ---version
$ easy_install --version

?

Maybe you have two pythons and only one pip?

$ find /opt -name python
$ find /usr -name python

$ find /opt -name pip
$ find /usr -name pip


On 5/30/17, Mahmood Naderan via Python-list  wrote:
> Well yes. It looks in other folders
>
 import openpyxl
> # trying openpyxl.so
> # trying openpyxlmodule.so
> # trying openpyxl.py
> # trying openpyxl.pyc
> # trying /usr/lib64/python2.6/openpyxl.so
> # trying /usr/lib64/python2.6/openpyxlmodule.so
> # trying /usr/lib64/python2.6/openpyxl.py
> # trying /usr/lib64/python2.6/openpyxl.pyc
> # trying /usr/lib64/python2.6/plat-linux2/openpyxl.so
> # trying /usr/lib64/python2.6/plat-linux2/openpyxlmodule.so
> # trying /usr/lib64/python2.6/plat-linux2/openpyxl.py
> # trying /usr/lib64/python2.6/plat-linux2/openpyxl.pyc
> # trying /usr/lib64/python2.6/lib-dynload/openpyxl.so
> # trying /usr/lib64/python2.6/lib-dynload/openpyxlmodule.so
> # trying /usr/lib64/python2.6/lib-dynload/openpyxl.py
> # trying /usr/lib64/python2.6/lib-dynload/openpyxl.pyc
> # trying /usr/lib64/python2.6/site-packages/openpyxl.so
> # trying /usr/lib64/python2.6/site-packages/openpyxlmodule.so
> # trying /usr/lib64/python2.6/site-packages/openpyxl.py
> # trying /usr/lib64/python2.6/site-packages/openpyxl.pyc
> # trying /usr/lib64/python2.6/site-packages/gtk-2.0/openpyxl.so
> # trying /usr/lib64/python2.6/site-packages/gtk-2.0/openpyxlmodule.so
> # trying /usr/lib64/python2.6/site-packages/gtk-2.0/openpyxl.py
> # trying /usr/lib64/python2.6/site-packages/gtk-2.0/openpyxl.pyc
> # trying /usr/lib/python2.6/site-packages/openpyxl.so
> # trying /usr/lib/python2.6/site-packages/openpyxlmodule.so
> # trying /usr/lib/python2.6/site-packages/openpyxl.py
> # trying /usr/lib/python2.6/site-packages/openpyxl.pyc
> Traceback (most recent call last):
> File "", line 1, in 
> ImportError: No module named openpyxl
>
>
>
>
> But
>
> $ find /opt -name openpyxl
> /opt/rocks/lib/python2.6/site-packages/openpyxl
>
>
>
>
> Regards,
> Mahmood
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python not able to find package but it is installed

2017-05-30 Thread Mahmood Naderan via Python-list
Well yes. It looks in other folders

>>> import openpyxl
# trying openpyxl.so
# trying openpyxlmodule.so
# trying openpyxl.py
# trying openpyxl.pyc
# trying /usr/lib64/python2.6/openpyxl.so
# trying /usr/lib64/python2.6/openpyxlmodule.so
# trying /usr/lib64/python2.6/openpyxl.py
# trying /usr/lib64/python2.6/openpyxl.pyc
# trying /usr/lib64/python2.6/plat-linux2/openpyxl.so
# trying /usr/lib64/python2.6/plat-linux2/openpyxlmodule.so
# trying /usr/lib64/python2.6/plat-linux2/openpyxl.py
# trying /usr/lib64/python2.6/plat-linux2/openpyxl.pyc
# trying /usr/lib64/python2.6/lib-dynload/openpyxl.so
# trying /usr/lib64/python2.6/lib-dynload/openpyxlmodule.so
# trying /usr/lib64/python2.6/lib-dynload/openpyxl.py
# trying /usr/lib64/python2.6/lib-dynload/openpyxl.pyc
# trying /usr/lib64/python2.6/site-packages/openpyxl.so
# trying /usr/lib64/python2.6/site-packages/openpyxlmodule.so
# trying /usr/lib64/python2.6/site-packages/openpyxl.py
# trying /usr/lib64/python2.6/site-packages/openpyxl.pyc
# trying /usr/lib64/python2.6/site-packages/gtk-2.0/openpyxl.so
# trying /usr/lib64/python2.6/site-packages/gtk-2.0/openpyxlmodule.so
# trying /usr/lib64/python2.6/site-packages/gtk-2.0/openpyxl.py
# trying /usr/lib64/python2.6/site-packages/gtk-2.0/openpyxl.pyc
# trying /usr/lib/python2.6/site-packages/openpyxl.so
# trying /usr/lib/python2.6/site-packages/openpyxlmodule.so
# trying /usr/lib/python2.6/site-packages/openpyxl.py
# trying /usr/lib/python2.6/site-packages/openpyxl.pyc
Traceback (most recent call last):
File "", line 1, in 
ImportError: No module named openpyxl




But

$ find /opt -name openpyxl
/opt/rocks/lib/python2.6/site-packages/openpyxl



 
Regards,
Mahmood
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python not able to find package but it is installed

2017-05-30 Thread Mahmood Naderan via Python-list
Well, on rocks there exist multiple pythons. But by default the active is 2.6.6

$ python -V
Python 2.6.6


I have to say that the script doesn't modify sys.path. I only use sys.argv[] 
there

I can put all dependent modules in my project folder but that will be dirty.

 
Regards,
Mahmood


On Tuesday, May 30, 2017 2:09 PM, Wolfgang Maier 
 wrote:
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python not able to find package but it is installed

2017-05-30 Thread Wolfgang Maier

On 05/30/2017 10:18 AM, Mahmood Naderan via Python-list wrote:

Hello,
Although I have installed a package via pip on a centos-6.6, python interpreter 
still says there is no such package!

Please see the output below

$ python exread2.py input.xlsx tmp/output
Traceback (most recent call last):
File "/home/mahmood/excetest/exread2.py", line 1, in 
from openpyxl import load_workbook
ImportError: No module named openpyxl


$ pip install openpyxl
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please 
upgrade your Python. A future version of pip will drop support for Python 2.6
Requirement already satisfied: openpyxl in 
/opt/rocks/lib/python2.6/site-packages

...



In addition to checking sys.path as suggested, also try running

python -V

to check if it's Python2.6 as reported by pip or if you have two 
different versions of Python installed.


--
https://mail.python.org/mailman/listinfo/python-list


Re: Python not able to find package but it is installed

2017-05-30 Thread Nagy László Zsolt
Do you have /opt/rocks/lib/python2.6/site-packages on sys.path?

Does your exread2.py file manipulate sys.path in any way?

2017. 05. 30. 10:18 keltezéssel, Mahmood Naderan via Python-list írta:
> Hello,
> Although I have installed a package via pip on a centos-6.6, python 
> interpreter still says there is no such package!

-- 
https://mail.python.org/mailman/listinfo/python-list


Python not able to find package but it is installed

2017-05-30 Thread Mahmood Naderan via Python-list
Hello,
Although I have installed a package via pip on a centos-6.6, python interpreter 
still says there is no such package!

Please see the output below

$ python exread2.py input.xlsx tmp/output
Traceback (most recent call last):
File "/home/mahmood/excetest/exread2.py", line 1, in 
from openpyxl import load_workbook
ImportError: No module named openpyxl


$ pip install openpyxl
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please 
upgrade your Python. A future version of pip will drop support for Python 2.6
Requirement already satisfied: openpyxl in 
/opt/rocks/lib/python2.6/site-packages

...


$ ls -l /opt/rocks/lib/python2.6/site-packages/openpyxl*
/opt/rocks/lib/python2.6/site-packages/openpyxl:
total 84
drwxr-xr-x 2 root root 4096 May 30 12:26 cell
drwxr-xr-x 2 root root 4096 May 30 12:26 chart
drwxr-xr-x 2 root root 4096 May 30 12:26 chartsheet
drwxr-xr-x 2 root root 4096 May 30 12:26 comments
drwxr-xr-x 2 root root 4096 May 30 12:26 compat
-rw-r--r-- 1 root root 1720 Mar 16 21:35 conftest.py
-rw-r--r-- 1 root root 2111 May 30 12:26 conftest.pyc
drwxr-xr-x 2 root root 4096 May 30 12:26 descriptors
drwxr-xr-x 2 root root 4096 May 30 12:26 drawing
drwxr-xr-x 2 root root 4096 May 30 12:26 formatting
drwxr-xr-x 2 root root 4096 May 30 12:26 formula
-rw-r--r-- 1 root root  880 Mar 16 21:35 __init__.py
-rw-r--r-- 1 root root 1009 May 30 12:26 __init__.pyc
drwxr-xr-x 2 root root 4096 May 30 12:26 packaging
drwxr-xr-x 2 root root 4096 May 30 12:26 reader
drwxr-xr-x 2 root root 4096 May 30 12:26 styles
drwxr-xr-x 2 root root 4096 May 30 12:26 utils
drwxr-xr-x 3 root root 4096 May 30 12:26 workbook
drwxr-xr-x 2 root root 4096 May 30 12:26 worksheet
drwxr-xr-x 2 root root 4096 May 30 12:26 writer
drwxr-xr-x 2 root root 4096 May 30 12:26 xml

/opt/rocks/lib/python2.6/site-packages/openpyxl-2.4.7-py2.6.egg-info:
total 36
-rw-r--r-- 1 root root 1 May 30 12:26 dependency_links.txt
-rw-r--r-- 1 root root 11193 May 30 12:26 installed-files.txt
-rw-r--r-- 1 root root  2381 May 30 12:26 PKG-INFO
-rw-r--r-- 1 root root16 May 30 12:26 requires.txt
-rw-r--r-- 1 root root  5224 May 30 12:26 SOURCES.txt
-rw-r--r-- 1 root root 9 May 30 12:26 top_level.txt




Any idea to fix that?

Regards,
Mahmood
-- 
https://mail.python.org/mailman/listinfo/python-list