# Help understanding PyCall-related Travis failure

**URL:** <https://discourse.julialang.org/t/help-understanding-pycall-related-travis-failure/15957>\
**Category:** General Usage\
**Tags:** pycall\
**Created:** [October 6, 2018, 2:49am UTC](https://discourse.julialang.org/t/help-understanding-pycall-related-travis-failure/15957 "2018-10-06T02:49:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![crbinz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crbinz/32/1919_2.png) [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Post date:** [October 6, 2018, 2:49am UTC](https://discourse.julialang.org/t/help-understanding-pycall-related-travis-failure/15957/1 "2018-10-06T02:49:19Z")

</div>

I made a fairly trivial commit in [SGP4.jl](https://github.com/crbinz/SGP4.jl/pull/17) (removing ` __precompile__ ()`, but now the CI [is failing](https://travis-ci.org/crbinz/SGP4.jl/jobs/436431625) – apparently `PyCall` can’t find the `sgp4` python module, although it appears that the `SGP4.jl` build process installs it properly. I’m not sure what could be going on here… any ideas?

---

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [October 6, 2018, 3:05am UTC](https://discourse.julialang.org/t/help-understanding-pycall-related-travis-failure/15957/2 "2018-10-06T03:05:20Z")

</div>

It looks like [Python executable is downgraded during `pyimport_conda`](https://travis-ci.org/crbinz/SGP4.jl/jobs/436431625#L328) and after loading PyCall. It means that PyCall uses Python 3.7 (still exists in memory) while the conda environment is wiped out and Python 3.6 is installed. Maybe [pinning](https://conda.io/docs/user-guide/tasks/manage-pkgs.html#preventing-packages-from-updating-pinning) Python version would help although it looks like there is no Conda.jl API nor conda CLI… (but there is a [github comment](https://github.com/conda/conda/issues/1718#issuecomment-300430334) saying that conda has an undocumented CLI…)

---

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [October 6, 2018, 3:08am UTC](https://discourse.julialang.org/t/help-understanding-pycall-related-travis-failure/15957/3 "2018-10-06T03:08:22Z")

</div>

An easier solution would be to install it in `deps/build.jl`.

---

<div class="post-metadata">

**Author:** ![crbinz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crbinz/32/1919_2.png) [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Post date:** [October 6, 2018, 3:13pm UTC](https://discourse.julialang.org/t/help-understanding-pycall-related-travis-failure/15957/4 "2018-10-06T15:13:28Z")

</div>

Thank you for your help. I think I understand what the problem is (although I don’t understand _why_ it’s happening). I don’t think there is a way to pin Python while using `pyimport_conda`.

RE: using `deps/build.jl`, do you know of an example I could follow? I’m not sure how I’d do that.

---

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [October 6, 2018, 3:41pm UTC](https://discourse.julialang.org/t/help-understanding-pycall-related-travis-failure/15957/5 "2018-10-06T15:41:26Z")

</div>

Actually, pinning Python version was a bad idea since it makes impossible to install spg4. `conda` was forced to downgrade Python since there is no spg4 package for 3.7.

IJulia.jl installs jupyter during the build. But IJulia.jl does many other things so maybe it’s hard to see what’s going on:

> <https://github.com/JuliaLang/IJulia.jl/blob/7b00bb53cdeb40b488addce487855f8a7d52a036/deps/build.jl#L45>

Something like this may work (untested):

```julia
using PyCall
using Conda

if PyCall.conda
    Conda.add_channel("conda-forge")
    Conda.add("sgp4")
end

```

But I just noticed it has a problem too. You have to re-build PyCall after running `Conda.add("sgp4")` since PyCall has to be re-configured when Python interpreter is changed. Putting something like `julia -e 'using Pkg; Pkg.clone(pwd()); try Pkg.build("SGP4"); catch; Pkg.build("SGP4"); end; Pkg.test("SGP4"; coverage=true)'` in `.travis.yml` may work.

---

<div class="post-metadata">

**Author:** ![crbinz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crbinz/32/1919_2.png) [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Post date:** [October 7, 2018, 2:23pm UTC](https://discourse.julialang.org/t/help-understanding-pycall-related-travis-failure/15957/6 "2018-10-07T14:23:50Z")

</div>

Thanks again. It seems to me that force-rebuilding `PyCall` upon building `SGP4.jl` is not a great way to handle installation in general, thought it might work for Travis.

> [@tkf](#):
>
> there is no spg4 package for 3.7.

Maybe it makes the most sense to focus on fixing this – to start, how can you even tell this is the case?

---

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [October 7, 2018, 11:10pm UTC](https://discourse.julialang.org/t/help-understanding-pycall-related-travis-failure/15957/7 "2018-10-07T23:10:37Z")

</div>

I think it’s a general problem in Conda.jl. It’s not great that anyone can have issues like this every time Python has an update.

> [@crbinz](#):
>
> > there is no spg4 package for 3.7.
> 
> Maybe it makes the most sense to focus on fixing this

I think you can post an issue here [GitHub - conda-forge/sgp4-feedstock: A conda-smithy repository for sgp4.](https://github.com/conda-forge/sgp4-feedstock)
