"Unable to find a valid Python installation" error, a python__define error ? [message #91773] |
Tue, 25 August 2015 04:16  |
Kallisthène
Messages: 15 Registered: October 2012
|
Junior Member |
|
|
Dear all,
I had difficulties using the Python bridge with my own winpython installation and I received the 'Unable to find a valid Python installation.' error message.
Thus after spending a lot of time in Windows innards, I just opened the python__define.pro file and found the following piece of code :
; Determine which Python version to load.
SPAWN, ['python', '--version'], stdout, stderr, /noshell
if (stderr[0].Contains('Python 2.7')) then begin
DLM_LOAD, 'Python27'
endif else if (stderr[0].Contains('Python 3.4')) then begin
DLM_LOAD, 'Python34'
endif else begin
MESSAGE, 'Unable to find a valid Python installation.'
endelse
Simply by replacing stderr[0] by the correct stdout[0] I succeeded in fully using Python in IDL as well as the IDL notebook.
What is strange is that a previous anaconda installation worked perfectly well, as well as an earlier winpython 2.7. I have no explanation.
By the way, the 3.5 Python will be released in one month, maybe you should update this piece of code ?
Hope it helps those with similar issues
|
|
|
Re: "Unable to find a valid Python installation" error, a python__define error ? [message #91779 is a reply to message #91773] |
Tue, 25 August 2015 09:11   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Tuesday, August 25, 2015 at 5:16:30 AM UTC-6, Kallisthène wrote:
> Dear all,
>
>
> I had difficulties using the Python bridge with my own winpython installation and I received the 'Unable to find a valid Python installation.' error message.
>
> Thus after spending a lot of time in Windows innards, I just opened the python__define.pro file and found the following piece of code :
>
> ; Determine which Python version to load.
> SPAWN, ['python', '--version'], stdout, stderr, /noshell
> if (stderr[0].Contains('Python 2.7')) then begin
> DLM_LOAD, 'Python27'
> endif else if (stderr[0].Contains('Python 3.4')) then begin
> DLM_LOAD, 'Python34'
> endif else begin
> MESSAGE, 'Unable to find a valid Python installation.'
> endelse
>
> Simply by replacing stderr[0] by the correct stdout[0] I succeeded in fully using Python in IDL as well as the IDL notebook.
>
> What is strange is that a previous anaconda installation worked perfectly well, as well as an earlier winpython 2.7. I have no explanation.
>
> By the way, the 3.5 Python will be released in one month, maybe you should update this piece of code ?
>
> Hope it helps those with similar issues
Hi Kallisthène,
Thanks for reporting this. For some reason different flavors of Python uses stdout or stderr, but not consistently. I'll go ahead and update the code to check both.
Cheers,
Chris
|
|
|
|
Re: "Unable to find a valid Python installation" error, a python__define error ? [message #93763 is a reply to message #93762] |
Thu, 13 October 2016 08:36   |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
On Thursday, 13 October 2016 08:08:21 UTC-7, Kallisthène wrote:
> Dear Chris,
>
> Thanks for updating the code, it works.
> Unfortunately I needed to update the scipy svd function and thus tried your "recommended" solution of installing Anaconda.
> Since Anaconda is now MKL-compiled for free it is indeed a good solution. BUT, Anaconda switched to Python 3.5 a year ago, and you still don't provide a idl_python35.dll for this new python flavor in your IDL install.
>
> Thus, unless I am mistaking, all users trying to install your recommended solution will always fail !
>
> Hope you'll find time to create one, as well as compiling IDL against MKL instead of providing third-party solution to your speed impediment.
>
> Best regards
Hi Kallisthène,
It's true that Anaconda installs Python 3.5 by default, but I've managed to get a new Anaconda (or Miniconda) installation to work by having it create another "environment" with Python 3.4, which works well with IDL 8.5.1. Use this command:
conda create -n py34 python=3.4
This will create a whole Python installation under ...Anaconda\envs\py34, and you'll need to make sure that environment variables are set correctly (your minutiae may vary):
set PATH=C:\Anaconda\envs\py34;C:\Program Files\Exelis\IDL85\bin\bin.x86_64;%PATH%
set PYTHONPATH=C:\Program Files\Exelis\IDL85\bin\bin.x86_64;C:\Program Files\Exelis\IDL85\lib\bridges
set PYTHONHOME=C:\Anaconda\envs\py34
That last one, PYTHONHOME, is not described in IDL docs for Windows, but I can assure you that on one installation I had, if that was not set, creating the Python() object would load the DLL, but any request to Python would crash IDL. PYTHONHOME was required. I am told by a reliable Exelis source that "you aren’t supposed to need to do that, at least on Windows with Anaconda" so perhaps in a future release that won't be needed.
Cheers,
-Dick
Dick Jackson Software Consulting Inc.
Victoria, BC, Canada --- http://www.d-jackson.com
|
|
|
|
Re: "Unable to find a valid Python installation" error, a python__define error ? [message #93774 is a reply to message #93763] |
Fri, 14 October 2016 00:02  |
Kallisthène
Messages: 15 Registered: October 2012
|
Junior Member |
|
|
Le jeudi 13 octobre 2016 17:37:15 UTC+2, Dick Jackson a écrit :
> On Thursday, 13 October 2016 08:08:21 UTC-7, Kallisthène wrote:
>> Dear Chris,
>>
>> Thanks for updating the code, it works.
>> Unfortunately I needed to update the scipy svd function and thus tried your "recommended" solution of installing Anaconda.
>> Since Anaconda is now MKL-compiled for free it is indeed a good solution. BUT, Anaconda switched to Python 3.5 a year ago, and you still don't provide a idl_python35.dll for this new python flavor in your IDL install.
>>
>> Thus, unless I am mistaking, all users trying to install your recommended solution will always fail !
>>
>> Hope you'll find time to create one, as well as compiling IDL against MKL instead of providing third-party solution to your speed impediment.
>>
>> Best regards
>
> Hi Kallisthène,
>
> It's true that Anaconda installs Python 3.5 by default, but I've managed to get a new Anaconda (or Miniconda) installation to work by having it create another "environment" with Python 3.4, which works well with IDL 8.5.1. Use this command:
>
> conda create -n py34 python=3.4
>
> This will create a whole Python installation under ...Anaconda\envs\py34, and you'll need to make sure that environment variables are set correctly (your minutiae may vary):
>
> set PATH=C:\Anaconda\envs\py34;C:\Program Files\Exelis\IDL85\bin\bin.x86_64;%PATH%
> set PYTHONPATH=C:\Program Files\Exelis\IDL85\bin\bin.x86_64;C:\Program Files\Exelis\IDL85\lib\bridges
> set PYTHONHOME=C:\Anaconda\envs\py34
>
> That last one, PYTHONHOME, is not described in IDL docs for Windows, but I can assure you that on one installation I had, if that was not set, creating the Python() object would load the DLL, but any request to Python would crash IDL. PYTHONHOME was required. I am told by a reliable Exelis source that "you aren’t supposed to need to do that, at least on Windows with Anaconda" so perhaps in a future release that won't be needed.
>
> Cheers,
> -Dick
>
> Dick Jackson Software Consulting Inc.
> Victoria, BC, Canada --- http://www.d-jackson.com
Thank you for the information, I also tried to reverse to an older instance of Anaconda, but since I wanted to have the 0.18 scipy version in order to solve a SVD discrepancy, I simply installed WinPython 3.4 which is still maintained with up to date python library.
In this case I didn't need to set a PYTHONHOME.
Thanks again
Best
|
|
|