Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with conda_list(), pls change back to behavior in reticulate 1.0.0 #100

Closed
jannes-m opened this issue Sep 15, 2017 · 4 comments
Closed

Comments

@jannes-m
Copy link

jannes-m commented Sep 15, 2017

Hey there,
I'm on Windows and have been using reticulate in combination with the Python binary shipped by QGIS since January 2017 for the **RQGIS ** package. This has worked like a charm (thanks!!, and still does under UNIX) until your latest update.
Running Sys.getenv("PATH") yields in my case:

[1] "C:\\OSGeo4W64\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\WBem"

Subsequently, running py_discover_config() works, and results in:

python:         C:\OSGEO4~1\bin\python.exe
libpython:      C:/OSGEO4~1/bin/python27.dll
pythonhome:     C:\Users\pi37pat\AppData\Local\Continuum\Anaconda2
version:        2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:\Users\pi37pat\AppData\Local\Continuum\Anaconda2\lib\site-packages\numpy
numpy_version:  1.11.1

python versions found: 
 C:\OSGEO4~1\bin\python.exe
 C:\Users\pi37pat\AppData\Local\CONTIN~1\ANACON~1\python.exe

However, as soon as I change PYTHONHOME with Sys.setenv(PYTHONHOME = "C:\\OSGeo4W64\\apps\\Python27"), py_discover_config() fails saying:

Error: lexical error: invalid char in json text.
                                       Traceback (most recent call las
                     (right here) ------^
In addition: Warning message:
running command '"C:\Users\pi37pat\AppData\Local\CONTIN~1\ANACON~1/Scripts/conda.exe" info --json' had status 1 

As I have said before, everything just worked fine until your latest update. Digging a bit deeper, I found the culprit to be reticulate:::python_environment_versions() and within this function it is conda_list() causing trouble (by the way, I actually do not want to use Anaconda at all, all the contrary, I want to make sure to not use Anaconda at all.) Well, basically, what I am asking is if you could change the function's behavior back to what it used to be in reticulate 1.0.0.

@jjallaire
Copy link
Member

The problem is that parsing Anaconda environments from the text generated for user display (as opposed to JSON) led to numerous similar error conditions (as that text isn't really intended to be machine parsed). So if I revert that change I'm "un-fixing" a bunch of bugs.

In your case it looks like an error is being thrown when calling conda info --json (can't see the whole text of the error). For cases like yours where conda info --json throws an error I think it's legit for us to consider that as equivalent to "no conda environments" and just return an empty data frame from conda_list. Here's that fix:

8447ad6

Could you try again with the latest from master to see if we successfully ignore the error condition in conda_list in your setup?

@jannes-m
Copy link
Author

Hey JJ,
perfect, this fixes this issue. Thank you so much for the really quick response and fix!! Running py_config() now yields this warning message:

Warning message:
running command '"C:\Users\pi37pat\AppData\Local\CONTIN~1\ANACON~1/Scripts/conda.exe" info --json' had status 1 

But that's ok, I simply suppress it. Loads of thanks again!

@jjallaire
Copy link
Member

Just added a suppressWarnings as well so you shouldn't need to do that on your end.

@jannes-m
Copy link
Author

Perfect, thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants