Search Postgresql Archives

Re: Python 3.2 XP64 and Numpy...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here is the test code
---------------
--creating plpython3u
DROP LANGUAGE plpython3u CASCADE;
CREATE LANGUAGE plpython3u ;


--create a test function
DROP FUNCTION IF EXISTS rc_test_python(   );
CREATE FUNCTION rc_test_python(  )
RETURNS void
AS $$"""
@brief This function test python
"""
import sys
import imp
#sys.path.insert(0, 'C:\\Python32\\Lib\\site-packages\\numpy')
plpy.notice(sys.path)
plpy.notice('importing numpy')
#import numpy #first way to do it

file, pathname, description = imp.find_module('numpy')
plpy.notice(file, pathname, description) # numpy was found
imp.load_module('numpy',file, pathname, description ) #second way to do it
plpy.notice('end of importing numpy, this message won t show, an exception is raised before')
#plpy.notice(numpy.__version__)
import helloworld as h
imp.reload(h)
s = h.helloworld()
plpy.notice(s)
return
$$ LANGUAGE plpython3u IMMUTABLE STRICT;

--call function
SELECT *
FROM rc_test_python(   ) ;
---------------------
---------------

2015-06-01 18:09 GMT+02:00 Rémi Cura <remi.cura@xxxxxxxxx>:
Hey, thanks to help me with that.
I started fresh to have a truly reproducible process,
so you can have all information and rule out some error possibilities.

 - Uninstall all python.
 - Check that PythonPath doesn't exist anymore
 - check that python doesn't exist anymore

 - install python 3.2.5 64 bit from official python website into C/Python32

 - Reload configuration for server.

 - create plpython3u , create a python function, test it (show path)

   * It works, python path is
    'C:\\Windows\\system32\\python32.zip', 'C:\\Python32\\Lib', 'C:\\Python32\\DLLs', 'E:\\9.3\\data', 'C:\\Program Files\\PostgreSQL\\9.3\\bin', 'C:\\Python32', 'C:\\Python32\\lib\\site-packages'

 - Donwload latest numpy from website.
 - ON antoher PC
   * Compile numpy with visual 2008 , 64 bit
   * Create an binary installer for windows (using python.exe setup.py )with proper argument

 - On the server :
 - install numpy with the compiled installer.


 - check that numpy is correctly installer in C:\Python32\Lib\site-packages
 - using an external terminal, check that numpy works (import numpy -> OK)

 - Now, define a plpython3u function containing "import numpy"

 - Run the function --> error is
  "ERREUR:  ImportError: DLL load failed: Le module spécifié est introuvable.",
   which roughly translate to
  "ERROR: ImportError : DLL load failed : the specified module couldn't be found".

 - Create a plpython3u function returning sys.path
the path is "C:\\Windows\\system32\\python32.zip', 'C:\\Python32\\Lib', 'C:\\Python32\\DLLs', 'E:\\9.3\\data', 'C:\\Program Files\\PostgreSQL\\9.3\\bin', 'C:\\Python32', 'C:\\Python32\\lib\\site-packages"
numpy is in this path, in C:\\Python32\\lib\\site-packages
All user of the computer have all rights on the C:\\Python32\\lib\\site-packages folder


 - execute `import imp; imp.find_package('numpy')` within the plpython3u function
   -> returns "None, 'C:\\Python32\\lib\\site-packages\\numpy', ('', '', 5)"

 - create a helloworld module , put it next to numpy, try to call it
   -> it gets called

I really don't see what I can do more.

Cheers,
Rémi-C



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux