JuliaPy / JuliaPy/PyCall.jl

Julia script needs to be ran twice (PyCall not repeatable)

オープン
#386 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Julia
スター
1.5k
フォーク
186
PR マージ指標
30日以内にマージされた PR はありません

説明

I'm having an issue where I need to run my Julia script twice before it runs successfully. Below, I include the script (which fails on line 13 - the one before the empty last empty line) and the output of the first and second run. I have no idea what's changing between the first and second runs. Note that this may be a Pandas.jl issue related to Pandas.jl issue #15.

To be clear, all that was done (tested multiple times with no change to test.jl) was:

 > include("test.jl")
<Output 1>
 > include("test.jl")
 <Output 2>

_test.jl

ENV["PYTHON"] = "C:\\Users\\JohnRinehart\\AppData\\Local\\Programs\\Python\\Python36\\python36.exe"
#ENV["PYTHON"] = "C:\\Python27\\python27.exe"

Pkg.build("PyCall")
import PyCall
import Pandas
PyCall.@pyimport fbprophet

df = Pandas.read_csv("test.csv")
m = fbprophet.Prophet()
m[:fit](df)
future = m[:make_future_dataframe](periods=365)
future = Pandas.DataFrame(future)

forecast = m[:predict](future)
forecast = Pandas.DataFrame(forecast)
m[:plot](forecast)
Output 1
julia> include("test.jl")
INFO: Building Conda
INFO: Building PyCall
INFO: PyCall is using C:\Users\JohnRinehart\AppData\Local\Programs\Python\Python36\python36.exe (Python 3.6.1) at C:\Users\JohnRinehart\AppData\Local\Programs\Python\Python36\python36.exe, libpython = C:\Users\JohnRinehart\AppData\Local\Programs\Python\Python36\python36
INFO: C:\Users\JohnRinehart\.julia\v0.5\PyCall\deps\deps.jl has not changed
INFO: C:\Users\JohnRinehart\.julia\v0.5\PyCall\deps\PYTHON has not changed
Disabling yearly seasonality. Run prophet with yearly_seasonality=True to override this.
STAN OPTIMIZATION COMMAND (LBFGS)
init = user
save_iterations = 1
init_alpha = 0.001
tol_obj = 1e-12
tol_grad = 1e-08
tol_param = 1e-08
tol_rel_obj = 10000
tol_rel_grad = 1e+07
history_size = 5
seed = 1298044300
initial log joint probability = -2.55344
    Iter      log prob        ||dx||      ||grad||       alpha      alpha0  # evals  Notes
      99       35.4748   2.29724e-05       102.999           1           1      135
     129       35.4775   6.66438e-09       99.8894     0.08496           1      177
Optimization terminated normally:
  Convergence detected: absolute parameter change was below tolerance
ERROR: LoadError: PyError (:PyDict_SetItem) <class 'TypeError'>
TypeError("unhashable type: 'numpy.ndarray'",)

 in pyerr_check at C:\Users\JohnRinehart\.julia\v0.5\PyCall\src\exception.jl:56 [inlined]
 in pyerr_check at C:\Users\JohnRinehart\.julia\v0.5\PyCall\src\exception.jl:61 [inlined]
 in macro expansion at C:\Users\JohnRinehart\.julia\v0.5\PyCall\src\exception.jl:81 [inlined]
 in PyCall.PyObject(::Dict{Any,Any}) at C:\Users\JohnRinehart\.julia\v0.5\PyCall\src\conversions.jl:548
 in macro expansion at C:\Users\JohnRinehart\.julia\v0.5\PyCall\src\exception.jl:78 [inlined]
 in PyCall.PyObject(::Dict{Any,Any}) at C:\Users\JohnRinehart\.julia\v0.5\PyCall\src\conversions.jl:548
 in map(::Type{T}, ::Tuple{Dict{Any,Any}}) at .\tuple.jl:92
 in #_pycall#66(::Array{Any,1}, ::Function, ::PyCall.PyObject, ::Dict{Any,Any}, ::Vararg{Dict{Any,Any},N}) at C:\Users\JohnRinehart\.julia\v0.5\PyCall\src\PyCall.jl:537
 in _pycall(::PyCall.PyObject, ::Dict{Any,Any}, ::Vararg{Dict{Any,Any},N}) at C:\Users\JohnRinehart\.julia\v0.5\PyCall\src\PyCall.jl:537
 in #pycall#69(::Array{Any,1}, ::Function, ::PyCall.PyObject, ::Type{PyCall.PyObject}, ::Dict{Any,Any}, ::Vararg{Dict{Any,Any},N}) at C:\Users\JohnRinehart\.julia\v0.5\PyCall\src\PyCall.jl:568
 in pycall(::PyCall.PyObject, ::Type{PyCall.PyObject}, ::Dict{Any,Any}, ::Vararg{Dict{Any,Any},N}) at C:\Users\JohnRinehart\.julia\v0.5\PyCall\src\PyCall.jl:568
 in (::Pandas.##call#1#4)(::Array{Any,1}, ::Type{T}, ::Dict{Any,Any}, ::Vararg{Dict{Any,Any},N}) at C:\Users\JohnRinehart\.julia\v0.5\Pandas\src\Pandas.jl:46
 in Pandas.DataFrame(::Dict{Any,Any}) at C:\Users\JohnRinehart\.julia\v0.5\Pandas\src\Pandas.jl:45
 in include_from_node1(::String) at .\loading.jl:488
while loading C:\Users\JohnRinehart\Downloads\test\test.jl, in expression starting on line 13
Output 2
julia> include("test.jl")
INFO: Building Conda
INFO: Building PyCall
INFO: PyCall is using C:\Users\JohnRinehart\AppData\Local\Programs\Python\Python36\python36.exe (Python 3.6.1) at C:\Users\JohnRinehart\AppData\Local\Programs\Python\Python36\python36.exe, libpython = C:\Users\JohnRinehart\AppData\Local\Programs\Python\Python36\python36
INFO: C:\Users\JohnRinehart\.julia\v0.5\PyCall\deps\deps.jl has not changed
INFO: C:\Users\JohnRinehart\.julia\v0.5\PyCall\deps\PYTHON has not changed
Disabling yearly seasonality. Run prophet with yearly_seasonality=True to override this.
STAN OPTIMIZATION COMMAND (LBFGS)
init = user
save_iterations = 1
init_alpha = 0.001
tol_obj = 1e-12
tol_grad = 1e-08
tol_param = 1e-08
tol_rel_obj = 10000
tol_rel_grad = 1e+07
history_size = 5
seed = 783594523
initial log joint probability = -2.55344
    Iter      log prob        ||dx||      ||grad||       alpha      alpha0  # evals  Notes
      99       35.4748   2.29724e-05       102.999           1           1      135
     129       35.4775   6.66438e-09       99.8894     0.08496           1      177
Optimization terminated normally:
  Convergence detected: absolute parameter change was below tolerance
PyPlot.Figure(PyObject <matplotlib.figure.Figure object at 0x000000001D3D25F8>)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

test.jl の再現から始め、特に 13 行目を確認し、src/conversions.jl と Pandas/src/Pandas.jl の PyCall のスタックエントリを調べてください。報告されている Julia/Python セットアップで include("test.jl") を 2 回実行し、1 回目は失敗するのに 2 回目は成功する理由を特定してください。最初の include でスクリプトが正常に実行されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
julia, pandas, python
領域
backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。