rstudio / rstudio/reticulate

"OSError: [WinError 6] The handle is invalid" when importing arviz

Open
#511 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.8k
Forks
349
Avg merge
5h 13m
Merged PRs (30d)
4

Description

I am trying to install arviz (within a conda environment) and use it within an rmarkdown file. It installs fine, but gives an error when I import it: OSError: [WinError 6] The handle is invalid (see below for details). The package is stored on a shared drive.

Could this be because the arviz filename (returned using py_discover_config) is incorrect? I think it should end with .py not .p (\GFS\myusername$\Profile\appdata\Python\Python36\site-packages\arviz_init_.p)

> conda_install("testpymc3", "arviz")
> py_discover_config(required_module = "arviz")
python:         C:/ProgramData/Anaconda3/envs/testpymc3/python.exe
libpython:      C:/ProgramData/Anaconda3/envs/testpymc3/python36.dll
pythonhome:     C:\PROGRA~3\ANACON~1\envs\TESTPY~1
version:        3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:27:44) [MSC v.1900 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:\PROGRA~3\ANACON~1\envs\TESTPY~1\lib\site-packages\numpy
numpy_version:  1.15.4
arviz:          \\GFS\myusername$\Profile\appdata\Python\Python36\site-packages\arviz\__init__.p

NOTE: Python version was forced by RETICULATE_PYTHON
> import("arviz")
Error in py_module_import(module, convert = convert) : 
  OSError: [WinError 6] The handle is invalid

Detailed traceback: 
  File "\\GFS\myusername$\Profile\appdata\Python\Python36\site-packages\arviz\__init__.py", line 25, in <module>
    from .plots import *
  File "\\GFS\myusername$\Profile\appdata\Python\Python36\site-packages\arviz\plots\__init__.py", line 14, in <module>
    from .ppcplot import plot_ppc
  File "\\GFS\myusername$\Profile\appdata\Python\Python36\site-packages\arviz\plots\ppcplot.py", line 6, in <module>
    from matplotlib import animation
  File "C:\PROGRA~3\ANACON~1\envs\TESTPY~1\lib\site-packages\matplotlib\animation.py", line 625, in <module>
    class FFMpegWriter(FFMpegBase, MovieWriter):
  File "C:\PROGRA~3\ANACON~1\envs\TESTPY~1\lib\site-packages\matplotlib\animation.py", line 120, in wrapper
    if writerClass.isAvailable():
  File "C:\PROGRA~3\ANACON~1\envs\TESTPY~1\lib\site-packages\matplotlib\animation.py", line 620, in isAvailable
    stdout=subprocess.DEVNULL, stderr=subprocess.PIPE).stderr)
  File "C:\PR

Possibly related to this bug: https://github.com/KrishnaswamyLab/MAGIC/issues/148

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with py_discover_config(required_module = "arviz") and the import traceback, especially the Python discovery path and matplotlib's animation.py subprocess call. Reproduce the reported conda, Windows, shared-drive setup; done means importing arviz from the R Markdown workflow no longer raises WinError 6 and the discovered module path is correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
anaconda, matplotlib, python, r
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.