JuliaPy / JuliaPy/PyCall.jl

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

Offen
#386 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Julia
Sterne
1.5k
Forks
186
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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](https://github.com/JuliaPy/Pandas.jl/issues/15).

To be clear, all that was done (tested multiple times with no change to _test.jl_) was:
```
> include("test.jl")

> include("test.jl")

```

_test.jl
```julia
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)
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 )
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.