JuliaPy / JuliaPy/PyCall.jl

PyCall insists upon using system python

Ouverte
#886 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Julia
Étoiles
1.5k
Forks
186
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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!

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par l’appel défaillant dans PyCall.jl:547 et par les étapes signalées PyCall.current_python() et pyimport. Reproduisez les versions indiquées de Julia, PyCall et Conda, puis déterminez pourquoi numpy est chargé depuis le Python du système ; le travail est terminé lorsque l’importation utilise le Python Conda configuré sans l’erreur PyInit_multiarray de Python 2.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
numpy, python
Domaine
tooling
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.