Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiqHw-0004yh-6T for pgsql-general@arkaria.postgresql.org; Wed, 10 Jun 2020 02:16:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jiqHv-0007Jy-2j for pgsql-general@arkaria.postgresql.org; Wed, 10 Jun 2020 02:16:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiqHt-0007Jr-J0 for pgsql-general@lists.postgresql.org; Wed, 10 Jun 2020 02:16:22 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiqHq-00047q-85 for pgsql-general@lists.postgresql.org; Wed, 10 Jun 2020 02:16:20 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 13C465C0135; Tue, 9 Jun 2020 22:16:17 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 09 Jun 2020 22:16:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=g mxB0m+fS5jn8pTfb7kGYzvdcelsIIBKPrpDwRUOkMI=; b=bpBOrX2ABKGBzbhEx LQ+OkWVbIOxYdIIjUUfaGnfhLQcw6GHcl1TR+Wn9DjBMXcHMKTJ6dxB529Q96h3x uQ/ZfJad7Ji2suYj/aloGFnCTgP9RIGVq5+UySv/dCfxCGHdL/BOHa5VwBLkDvRL VqSTME8MNh5eQNfuHsSIcNoKBOGWRDwWblVywp2nZ6wFQj22D8X86nJ1966bbFk5 u9XZcqDp7aV5j+qtYE4doaH2lCaTFaPKVZdQc6XN7F5D1z0q7o18WijuZABpCR1Q 7M0FTaD0Q8qNumnwNuz59Q2+LSPmN4C50y5ozLm5QCqKBI7Ug/j8MlqR7Bg/pI8J GgVxA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=gmxB0m+fS5jn8pTfb7kGYzvdcelsIIBKPrpDwRUOk MI=; b=Kjbuwey6u5f1oWv8Vp8Y9CB16P8PnijXjhzrVkZrENO73d01bfHmsVGdl 8F+DegRaSyngnBi7os2QTB2WeMKn+MbtkPUcStXkJGlDscuUtVQKHsuqTqT5ZaxW sq3utrNINfLi5slri4lwbbdnrCT6eMvytHMmfU8vJE6xJMU2WMIwwnTwe3SXIE2O Fw4h4gHd+GsQhmALZuhoDNSMcLnzCSYnfHXMcLkv51iWHGZJNLrWYairz8WbnY4m Q/FD0ovgJJKzk3D2LiiXgT33cWHdWf6wDHCo2Ijws4Hp1GbRkw6KHqC5iFc7uc/D CDFdkaevklIDw9NomZvV3ZYl+eqpQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudehhedgheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhushhpvggtthffohhmrghinhculdegledmnecujfgurhepuffvfhfhkffffgggjggt gfesthekredttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrih grnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeeu veevheejledutedukeeulefhkefhieejfeekhfekhefgvdeigeevtdffkeethfenucffoh hmrghinhepphihthhhohhnrdhorhhgpdhgohhoghhlvgdrtghomhdpphhoshhtghhrvghs qhhlrdhorhhgpdgvnhhtvghrphhrihhsvggusgdrtghomhenucfkphepjeehrddujedvrd ehrddvfedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.3] (75-172-5-231.tukw.qwest.net [75.172.5.231]) by mail.messagingengine.com (Postfix) with ESMTPA id 244553060F09; Tue, 9 Jun 2020 22:16:16 -0400 (EDT) Subject: Re: Help with plpython3u To: PEDRO PABLO SEVERIN HONORATO Cc: pgsql-general@lists.postgresql.org References: <630c303b-1c82-90dc-b602-54e461335fc6@aklaver.com> From: Adrian Klaver Message-ID: Date: Tue, 9 Jun 2020 19:16:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 6/9/20 6:17 PM, PEDRO PABLO SEVERIN HONORATO wrote: > Thanks Adrian, this actually helped me. I was looking for the "language > pack" thing without any success and thanks god that you pointed me in > the right direction :) > > What I don't understand is the following. After installing the language > pack with stack builder, added a variable named "PYTHONHOME" with its > path (C:\edb\languagepack\v1\Python-3.7) and then added PYTHONHOME and > the full path to the PATH variable. After that, I restarted the server > as requested but nothing happened. Then I added "%" to the beginning and > the end of PYTHONHOME and C:\edb\languagepack\v1\Python-3.7, restarted > the server and then it worked. Why is that? For explanation see here: https://docs.python.org/3.7/using/windows.html 3.6.1. Excursus: Setting environment variables > > Also, I would like to know if it is possible to import specific python > libraries? For example, I would like to use the talib library, which can > be downloaded and installed. Or a custom library made by myself. And how > can I import other python libraries, like scikit learn? Where can I find > information about this? Yes you can import libraries/packages. The issue is where you are installing them, in the system or the Anaconda environment. I don't work with Windows much anymore, so I am not up on how to grab a library from within an Anaconda environment. Maybe someone else can help or you might ask the Anaconda forum: https://groups.google.com/a/anaconda.com/forum/#!forum/anaconda > > Thank you so much for your help!! :D > PS > > El mar., 9 jun. 2020 a las 20:37, Adrian Klaver > (>) escribió: > > On 6/9/20 5:26 PM, PEDRO PABLO SEVERIN HONORATO wrote: > > Hi Adrian, > > > > I installed Postgres downloading the file > posgresql-12.2-1-windows-x64 > > from the website https://www.postgresql.org/download/windows/. > > Did you go through the steps here?: > > https://www.enterprisedb.com/edb-docs/d/postgresql/user-guides/language-pack-guide/12/toc.html > > > > > The python37.dll I copied to the System32 folder was located > > in C:\Users\developer\Anaconda3. > > After trying this, I installed python 3.7.0 and copied the > python37.dll > > that comes with the installation, but got the same result. > > > > Thanks, > > PS > > > > El mar., 9 jun. 2020 a las 20:17, Adrian Klaver > > ( > >>) escribió: > > > >     On 6/9/20 5:09 PM, PEDRO PABLO SEVERIN HONORATO wrote: > >      > Hello! > >      > > >      > I'm cracking my head while trying to make python language work > >     within > >      > postges. I executed "*create extension plpython3u*" but I get > >     this error: > >      > > >      > "*ERROR: could not load library "C:/Program > >      > Files/PostgreSQL/12/lib/plpython3.dll": The specified module > >     could not > >      > be found. SQL state: 58P01*" > >      > > >      > Looking into several stackoverflow pages and asking like > >     everywhere, I > >      > also installed dependency walker and saw that python37.dll was > >     required. > >      > My PC already has python 3.7.4, but I don't know if that is an > >     issue and > >      > postgres requires python 3.7.0 strictly. > >      > > >      > I also copied the python37.dll file directly in the System32 > >     folder, as > >      > some pages suggested. That actually made it possible to > run the > >      > "* create extension plpython3u* ", but when I try to > create a simple > >      > function like: > >      > > >      > "*CREATE FUNCTION pymax (a integer, b integer)* > >      > *  RETURNS integer > >      > AS $$ > >      >    if a > b: > >      >      return a > >      >    return b > >      > * > >      > *$$ LANGUAGE plpython3u*;" > >      > > >      > The server crashes and I get this message: "*Connection to the > >     server > >      > has been lost*." > >      > > >      > Some additional information: > >      > - My PC is running windows server 2019 64 bits (its a vps) > > > >     How did you install Postgres? > > > >      > - The python version I have is 3.7.4. Installed it with > Anaconda > > > >     Unless things have changed since the last time I used > Anaconda, it > >     basically creates virtualenvs for it's installs. So when you > refer to > >     the Python dll above are you talking about a system installed > one or > >     one > >     from within the Anaconda environment? > > > >      > - Postgres version is 12.2-1. pgAdmin is 4.18 > >      > > >      > Please, help me :( > >      > Regards, > >      > PS > > > > > >     -- > >     Adrian Klaver > > adrian.klaver@aklaver.com > > > > > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com