# PyCall pyimport segfault for the poliastro module

**URL:** <https://discourse.julialang.org/t/pycall-pyimport-segfault-for-the-poliastro-module/96812>\
**Category:** General Usage\
**Tags:** question, package, pycall\
**Created:** [March 29, 2023, 10:43pm UTC](https://discourse.julialang.org/t/pycall-pyimport-segfault-for-the-poliastro-module/96812 "2023-03-29T22:43:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![isaac.rubberducky](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/isaac.rubberducky/32/36791_2.png) [@isaac.rubberducky](https://discourse.julialang.org/u/isaac.rubberducky)\
**Post date:** [March 29, 2023, 10:43pm UTC](https://discourse.julialang.org/t/pycall-pyimport-segfault-for-the-poliastro-module/96812/1 "2023-03-29T22:43:51Z")

</div>

I am trying to use the package poliastro with PyCall.

The following lines of code work fine:

```julia
using PyCall
poliastro_body = pyimport("poliastro.bodies")
poliastro_planes = pyimport("poliastro.frames")

```

These do not:

```julia
poliastro_orbit = pyimport("poliastro.twobody")
poliastro_maneuver = pyimport("poliastro.maneuver")

```

The ones that do not cause a segmentation fault that crashes julia. `keys(pyimport("poliastro"))` returns:  
: **builtins**  
: **cached**  
: **doc**  
: **file**  
: **loader**  
: **name**  
: **package**  
: **path**  
: **spec**  
: **version**  
:bodies  
:constant  
:frames

So I checked inside the directory where Conda installed the packages and everything seems to be there. There is a maneuver.py just like there is a bodies.py.

I’m at a loss, how do I fix this?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 30, 2023, 1:04am UTC](https://discourse.julialang.org/t/pycall-pyimport-segfault-for-the-poliastro-module/96812/2 "2023-03-30T01:04:53Z")

</div>

> [@isaac.rubberducky](#):
>
> These do not:
> 
> ```julia
> poliastro_orbit = pyimport("poliastro.twobody")
> poliastro_maneuver = pyimport("poliastro.maneuver")
> 
> ```
> 
> The ones that do not cause a segmentation fault that crashes julia.

A segfault on import often means that they link to a conflicting version of some shared library used by Julia.

It looks like a basic problem with poliastro is that it uses numba, which uses LLVM, which is also used by Julia, but if Julia and Numba link to conflicting versions of LLVM it may crash upon load. See e.g. [Segfault importing numba](https://github.com/JuliaPy/PyCall.jl/issues/903) and [Using numba and julia (or any other LLVM loader) leads to segfaults](https://github.com/numba/numba/issues/7857#issuecomment-1048338622). The only workaround is to build numba differently. The linked issues suggest using `conda install -c numba llvmlite`, for example.

---

<div class="post-metadata">

**Author:** ![isaac.rubberducky](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/isaac.rubberducky/32/36791_2.png) [@isaac.rubberducky](https://discourse.julialang.org/u/isaac.rubberducky)\
**Post date:** [March 30, 2023, 11:02am UTC](https://discourse.julialang.org/t/pycall-pyimport-segfault-for-the-poliastro-module/96812/3 "2023-03-30T11:02:06Z")

</div>

> [@stevengj](#):
>
> `conda install -c numba llvmlite`

Thanks, this is the correct answer, with one very small modification I want to add for anyone who stumbles on this post. PyCall uses a Julia specific installation of python. To make the switch in Julia I used:

`Conda.add("numba::llvmlite")`
