# How to use sklearn in julia

**URL:** <https://discourse.julialang.org/t/how-to-use-sklearn-in-julia/133493>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [October 28, 2025, 10:19pm UTC](https://discourse.julialang.org/t/how-to-use-sklearn-in-julia/133493 "2025-10-28T22:19:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Monicate](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Monicate](https://discourse.julialang.org/u/Monicate)\
**Post date:** [October 28, 2025, 10:19pm UTC](https://discourse.julialang.org/t/how-to-use-sklearn-in-julia/133493/1 "2025-10-28T22:19:19Z")

</div>

Hello, when installing a package I got the error:

The Python package sklearn could not be imported by pyimport. Usually this means  
that you did not install sklearn in the Python version being used by PyCall.

So I install sklearn to python, cmd ‘python -m pip show scikit-learn’ shows I have it.  
I use ‘’'ENV[“PYTHON”]=“” to the result I get when I use “where python” in cmd (I tried both results) and Pkg.build(“PyCall”) as other questions suggested, but this yields a StackOverflowError

Does anybody know how to install sklearn such that I can install some packages? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [October 29, 2025, 1:25am UTC](https://discourse.julialang.org/t/how-to-use-sklearn-in-julia/133493/2 "2025-10-29T01:25:52Z")

</div>

Install the ScikitLearn.jl package with the Julia package manager:

```julia
using Pkg

Pkg.add("ScikitLearn")

```

and read the documentation:

> **[Introduction · ScikitLearn.jl](https://cstjean.github.io/ScikitLearn.jl/dev/)**

---

<div class="post-metadata">

**Author:** ![Monicate](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Monicate](https://discourse.julialang.org/u/Monicate)\
**Post date:** [October 29, 2025, 9:17am UTC](https://discourse.julialang.org/t/how-to-use-sklearn-in-julia/133493/3 "2025-10-29T09:17:12Z")

</div>

> [@juliohm](#):
>
> `Pkg.add("ScikitLearn")`

Thank you, but when I do Pkg.add(“ScikitLearn”), it throws warnings about other packages I’m trying to install, and ?ScikitLearn says it didnt install.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [October 29, 2025, 9:28am UTC](https://discourse.julialang.org/t/how-to-use-sklearn-in-julia/133493/4 "2025-10-29T09:28:30Z")

</div>

Try to install it in a fresh environment:

```julia
] activate --temp
] add ScikitLearn

```

The `]` key will change the Julia prompt into a package manager. You can exit the package manager with backspace.

If the installation is succesful with the commands above, then you are probably trying to install the package in an environment with other conflicting packages. If it fails, I suggest opening an issue on the ScikitLearn.jl GitHub page.
