JuliaPy / JuliaPy/PyCall.jl

PyCall insists upon using system python

Abierto
#886 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Julia
Estrellas
1.5k
Forks
186
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Julia version: 1.5.2
PyCall version: 1.92.2
Conda version: 1.5.1

Setup
```
ENV["PYTHON"]=""
]add Conda
Conda.add("numpy")
]add PyCall
]build PyCall
```

Check some variables:
```
julia> PyCall.conda
true
julia> PyCall.current_python()
"/home/rkurchin/.julia/conda/3/bin/python"
```

Now here's the problem:
```
np = pyimport("numpy") # same error results from np = pyimport_conda("numpy","numpy")
```

And here's the output...
```
ERROR: PyError (PyImport_ImportModule

The Python package numpy could not be imported by pyimport. Usually this means
that you did not install numpy in the Python version being used by PyCall.

PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package. To install the numpy module, you can
use `pyimport_conda("numpy", PKG)`, where PKG is the Anaconda
package the contains the module numpy, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).

Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python. As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.

)
ImportError('dynamic module does not define module export function (PyInit_multiarray)')
File "/opt/ohpc/pub/libs/gnu/numpy/1.9.2/lib64/python2.7/site-packages/numpy/__init__.py", line 170, in
from . import add_newdocs
File "/opt/ohpc/pub/libs/gnu/numpy/1.9.2/lib64/python2.7/site-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/opt/ohpc/pub/libs/gnu/numpy/1.9.2/lib64/python2.7/site-packages/numpy/lib/__init__.py", line 8, in
from .type_check import *
File "/opt/ohpc/pub/libs/gnu/numpy/1.9.2/lib64/python2.7/site-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/opt/ohpc/pub/libs/gnu/numpy/1.9.2/lib64/python2.7/site-packages/numpy/core/__init__.py", line 6, in
from . import multiarray

Stacktrace:
[1] pyimport(::String) at /home/rkurchin/.julia/packages/PyCall/tqyST/src/PyCall.jl:547
[2] top-level scope at REPL[17]:1
```

Note that the stacktrace shows the system python (2.7) as opposed to the Conda.jl Python 3 that it should be using. This PyInit_multiarray seems to be a documented error arising when using Python 2 where Python 3 is needed.

OS details:
```
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
```

The really weird part is I've gotten this to work perfectly on another system with the same OS and the only difference between the two that I can figure out is that the other system is running Julia 1.5.1 whereas this one is on 1.5.2.

I've completely run out of troubleshooting ideas here and would love any input!

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza con la llamada que falla en PyCall.jl:547 y con los pasos indicados PyCall.current_python() y pyimport. Reproduce las versiones indicadas de Julia, PyCall y Conda, y luego rastrea por qué numpy se carga desde el Python del sistema; se considera terminado cuando la importación usa el Python de Conda configurado sin el error PyInit_multiarray de Python 2.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
numpy, python
Área
tooling
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.