Re: ImportError: No module named multiarray (is back)

2011-11-23 Thread Mathieu Malaterre
[CC me please]

hi all,

2011/11/22 Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl:
[...]
 Hi Mathieu,

 I don't think that your problem can be solved in any simple way, apart from
 physically moving the script or providing a second helper script.

 This is a very unfortunate interaction between Python semantics (prepend
 realpath of script to sys.path) and the Debian way of installing modules
 (symlink farm between Python versions). Nevertheless, I think that Python is
 wrong, and Debian is right. What Python does means that it is not possible
 to run a Python script from /tmp or any other directory writeable by other
 users securely. Even if this is by design, it is not advertised well (or
 maybe even at all?) and is thus a big security hole.

Just like everything in computer, just add another extra layer of
indirection. However this is exaclty that layer of indirection that I
need help to get working.

[Copy pasted from http://lists.debian.org/debian-python/2011/11/msg00059.html]
Jakub Wilk jw...@debian.org:
 It'd tad easier for us to help you if you explained what you were trying to 
 do.

Short answer: trying to package the cellprofiler application. That is all.

I can get the application working from my $HOME or /tmp no problem.
However as soon as I move the CellProfiler.py within some know python
location things behave differently.

Package is at:
http://mentors.debian.net/package/cellprofiler

However it wont be very usefull as it wont work from the installed path.

Thanks
-- 
Mathieu


--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CA+7wUsz5ioRp153BJv5DGKz_o=fPxXH+QV=zg9mvsgjecjy...@mail.gmail.com



ImportError: No module named multiarray (is back)

2011-11-22 Thread Mathieu Malaterre
[CC me please]

Hi all,

  The issue with multiarray came back. I manage to get things working
for the tifffile package installing the tifffile.py into
/usr/bin/tiffile (removing the py extension). However another package
is now failing: CellProfiler. Symptoms are:


$ python /usr/lib/python2.7/dist-packages/CellProfiler.py
Traceback (most recent call last):
  File /usr/lib/python2.7/dist-packages/CellProfiler.py, line 17, in module
import numpy as np
  File /usr/share/pyshared/numpy/__init__.py, line 136, in module
import add_newdocs
  File /usr/share/pyshared/numpy/add_newdocs.py, line 9, in module
from numpy.lib import add_newdoc
  File /usr/share/pyshared/numpy/lib/__init__.py, line 4, in module
from type_check import *
  File /usr/share/pyshared/numpy/lib/type_check.py, line 8, in module
import numpy.core.numeric as _nx
  File /usr/share/pyshared/numpy/core/__init__.py, line 5, in module
import multiarray
ImportError: No module named multiarray


Now if I do:

$ cp /usr/lib/python2.7/dist-packages/CellProfiler.py /tmp
$ python /tmp/CellProfiler.py
Traceback (most recent call last):
  File /tmp/CellProfiler.py, line 193, in module
os.chdir(os.path.join(root, script_path))
OSError: [Errno 2] No such file or directory: '/tmp/cellprofiler/cpmath'

Could someone please point me to some documentation get rid definitely
of this kind of issues. I'd like to keep as much as the original
package as possible, therefore I would like to keep the
/usr/lib/python2.7/dist-packages/CellProfiler.py (or pyshared
equivalent). But how do I load this file ?

Thanks very much.


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CA+7wUswQVDddJJiXaJFk8gNmYMW9L4W_3GtSWKDV9LAL=sa...@mail.gmail.com



Re: ImportError: No module named multiarray (is back)

2011-11-22 Thread Zbigniew Jędrzejewski-Szmek

On 11/22/2011 04:38 PM, Mathieu Malaterre wrote:

[CC me please]

Hi all,

   The issue with multiarray came back. I manage to get things working
for the tifffile package installing the tifffile.py into
/usr/bin/tiffile (removing the py extension). However another package
is now failing: CellProfiler. Symptoms are:


$ python /usr/lib/python2.7/dist-packages/CellProfiler.py
Traceback (most recent call last):
   File /usr/lib/python2.7/dist-packages/CellProfiler.py, line 17, inmodule
 import numpy as np
   File /usr/share/pyshared/numpy/__init__.py, line 136, inmodule
 import add_newdocs
   File /usr/share/pyshared/numpy/add_newdocs.py, line 9, inmodule
 from numpy.lib import add_newdoc
   File /usr/share/pyshared/numpy/lib/__init__.py, line 4, inmodule
 from type_check import *
   File /usr/share/pyshared/numpy/lib/type_check.py, line 8, inmodule
 import numpy.core.numeric as _nx
   File /usr/share/pyshared/numpy/core/__init__.py, line 5, inmodule
 import multiarray
ImportError: No module named multiarray


Hi Mathieu,

I don't think that your problem can be solved in any simple way, apart 
from physically moving the script or providing a second helper script.


This is a very unfortunate interaction between Python semantics (prepend 
realpath of script to sys.path) and the Debian way of installing modules 
(symlink farm between Python versions). Nevertheless, I think that 
Python is wrong, and Debian is right. What Python does means that it is 
not possible to run a Python script from /tmp or any other directory 
writeable by other users securely. Even if this is by design, it is not 
advertised well (or maybe even at all?) and is thus a big security hole.



Now if I do:

$ cp /usr/lib/python2.7/dist-packages/CellProfiler.py /tmp
$ python /tmp/CellProfiler.py
Traceback (most recent call last):
   File /tmp/CellProfiler.py, line 193, inmodule
 os.chdir(os.path.join(root, script_path))
OSError: [Errno 2] No such file or directory: '/tmp/cellprofiler/cpmath'

Could someone please point me to some documentation get rid definitely
of this kind of issues.
You can wait for Python 3.2 and the PEP 3149 (ABI version tagged .so 
files) which makes the Debian-style symlinks farms unnecessary (just 
joking :).


Best,
Zbyszek

 I'd like to keep as much as the original

package as possible, therefore I would like to keep the
/usr/lib/python2.7/dist-packages/CellProfiler.py (or pyshared
equivalent). But how do I load this file ?

Thanks very much.



--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4ecbff19.8080...@in.waw.pl



ImportError: No module named multiarray

2011-11-16 Thread Mathieu Malaterre
[CC me please]

Hi all,

  I am trying to package a tiny python module:

http://mentors.debian.net/debian/pool/main/t/tifffile/tifffile_2012-1.dsc

  I thought I did it right, but I cannot load the python module
properly when installed, it fails with:

$ python /usr/share/pyshared/tifffile.py
Traceback (most recent call last):
  File /usr/share/pyshared/tifffile.py, line 117, in module
import numpy
  File /usr/share/pyshared/numpy/__init__.py, line 132, in module
import add_newdocs
  File /usr/share/pyshared/numpy/add_newdocs.py, line 9, in module
from lib import add_newdoc
  File /usr/share/pyshared/numpy/lib/__init__.py, line 4, in module
from type_check import *
  File /usr/share/pyshared/numpy/lib/type_check.py, line 8, in module
import numpy.core.numeric as _nx
  File /usr/share/pyshared/numpy/core/__init__.py, line 5, in module
import multiarray
ImportError: No module named multiarray


  However doing the following works nicely:

$ cd /tmp
$ cp /usr/share/pyshared/tifffile.py .
$ python tifffile.py --version
tifffile.py 2011.11.12

Thanks for suggestion,
-- 
Mathieu


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/ca+7wusy4azc5lsgqpbcypr7sb3w8nur8tep4m+1nwvdrs36...@mail.gmail.com