Sample Header Ad - 728x90

Learning Python, can't install scikit-learn

1 vote
0 answers
322 views
On my Windows machine, I ran pip3 install scikit-learn and it installed without any problems, however, on my Mac, I've tried a lot of things:
@macbook-pro: ~
$ brew list                                                                                                                            [17:21:35]
==> Formulae
ca-certificates	glib		libidn2		libunistring	little-cms2	ncurses		pipx		tree-sitter	zstd
cairo		gmp		libimagequant	libuv		lua		neovim		pixman		unibilium
fontconfig	graphite2	liblinear	libvterm	luajit		nmap		python@3.12	utf8proc
freetype	harfbuzz	libmpc		libx11		luv		numpy		readline	watch
fribidi		htop		libpng		libxau		lz4		openblas	scikit-image	webp
gcc		icu4c		libraqm		libxcb		lzo		openjpeg	scipy		wget
gettext		isl		libssh2		libxdmcp	mpdecimal	openssl@3	sqlite		xorgproto
giflib		jpeg-turbo	libtermkey	libxext		mpfr		pcre2		tcl-tk		xsimd
git		libevent	libtiff		libxrender	msgpack		pillow		tmux		xz

==> Casks
android-file-transfer	firefox			iina			microsoft-teams		transmission-remote-gui	wireshark
dozer			freecad			inkscape		shadowsocksx-ng-r	visual-studio-code	zoom
dropbox			google-chrome		jellyfin-media-player	steam			vlc
eddie			google-earth-pro	microsoft-auto-update	teamviewer		warp
 
atom@macbook-pro: ~
$ brew install scikit-learn                                                                                                            [17:21:38]
Warning: No available formula with the name "scikit-learn". Did you mean scikit-image?
==> Searching for similarly named formulae and casks...
==> Formulae
scikit-image ✔

To install scikit-image ✔, run:
  brew install scikit-image ✔
FAIL

atom@macbook-pro: ~
$ pip3 install scikit-learn                                                                                                            [17:21:44]
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
    xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a Python library that isn't in Homebrew,
    use a virtual environment:
    
    python3 -m venv path/to/venv
    source path/to/venv/bin/activate
    python3 -m pip install xyz
    
    If you wish to install a Python application that isn't in Homebrew,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. You can install pipx with
    
    brew install pipx
    
    You may restore the old behavior of pip by passing
    the '--break-system-packages' flag to pip, or by adding
    'break-system-packages = true' to your pip.conf file. The latter
    will permanently disable this error.
    
    If you disable this error, we STRONGLY recommend that you additionally
    pass the '--user' flag to pip, or set 'user = true' in your pip.conf
    file. Failure to do this can result in a broken Homebrew installation.
    
    Read more about this behavior here: 

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
FAIL

atom@macbook-pro: ~
$ pipx install scikit-learn                                                                                                            [17:21:52]
Note: Dependent package 'numpy' contains 1 apps
  - f2py

No apps associated with package scikit-learn. Try again with '--include-deps' to include apps of dependent packages, which are listed above. If
you are attempting to install a library, pipx should not be used. Consider using pip or a similar tool instead.
FAIL
I've also tried the commands on the official website, https://scikit-learn.org/stable/install.html , which produce similar errors as my system doesn't recognize pip and the -U flag doesn't make a difference. What am I doing wrong?
Asked by ohshitgorillas (31 rep)
May 4, 2024, 12:26 AM
Last activity: Jun 10, 2025, 12:26 AM