pyimport_conda not finding the package?
- 主要言語
- Julia
- スター
- 1.5k
- フォーク
- 186
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
MWE:
```julia
using PyCall
ENV["PYTHON"] = ""
using Pkg; Pkg.build("PyCall")
pyimport_conda("scipy.optimize", "scipy")
```
Outputs:
```julia
Conda ─→ `C:\Users\accou\.julia\packages\Conda\x5ml4\deps\build.log`
Building PyCall → `C:\Users\accou\.julia\packages\PyCall\tqyST\deps\build.log`
[ Info: Installing scipy.optimize via the Conda scipy package...
[ Info: Running `conda install -y scipy` in root environment
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
PyError (PyImport_ImportModule
The Python package scipy.optimize could not be imported by pyimport. Usually this means
that you did not install scipy.optimize 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 scipy.optimize module, you can
use `pyimport_conda("scipy.optimize", PKG)`, where PKG is the Anaconda
package the contains the module scipy.optimize, 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('DLL load failed while importing _iterative: The specified module could not be found.')
File "C:\Users\accou\.julia\conda\3\lib\site-packages\scipy\optimize\__init__.py", line 400, in
from .optimize import *
File "C:\Users\accou\.julia\conda\3\lib\site-packages\scipy\optimize\optimize.py", line 36, in
from ._numdiff import approx_derivative
File "C:\Users\accou\.julia\conda\3\lib\site-packages\scipy\optimize\_numdiff.py", line 6, in
from scipy.sparse.linalg import LinearOperator
File "C:\Users\accou\.julia\conda\3\lib\site-packages\scipy\sparse\linalg\__init__.py", line 111, in
from .isolve import *
File "C:\Users\accou\.julia\conda\3\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 4, in
from .iterative import *
File "C:\Users\accou\.julia\conda\3\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 8, in
from . import _iterative
pyimport(::String) at PyCall.jl:547
pyimport_conda(::String, ::String, ::String) at PyCall.jl:711
pyimport_conda(::String, ::String) at PyCall.jl:704
top-level scope at test.jl:103
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず Windows MWE を実行して stack trace を確認し、特に PyCall.jl の 704-711 行付近にある pyimport_conda を確認します。Conda でインストールされた scipy パッケージがどのように読み込まれるか、また報告された DLL エラーを再現できるかを確認してください。ドキュメントに記載されたインストール手順の後に pyimport_conda("scipy.optimize", "scipy") の import が成功すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- julia, python
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 30/100