Posts: 4
Threads: 1
Joined: Jan 2026
hello all,
i've just upgraded one of our servers to python 3.12 and i'm running into some issues. i'm hoping someone will see this as a simple enough problem.
the goal is to download huggingface models locally. on 3.9 we used huggingface-cli. however, when i run the CLI with this update, i get :
Quote:Traceback (most recent call last):
File "/usr/local/bin/huggingface-cli", line 3, in <module>
from huggingface_hub.commands.huggingface_cli import main
ModuleNotFoundError: No module named 'huggingface_hub.commands'
this issue is critical because it creates an incompatibility with one of the widely-used packages, transformers :
Quote:transformers 4.57.6 requires huggingface_hub<1.0,>=0.34.0, but you have huggingface_hub 1.3.2 which is incompatible.
after trying several things :
- the server tells me that all dependencies have already been met if i try to reinstall huggingface_hub, so it won't try to reinstall.
- the server chastises me if i try to downgrade or uninstall huggingface_hub, saying it's impossible as huggingface_hub is part of the distro.
- i've verified that huggingface_hub does in fact exist in the 3.12 tree, but it appears huggingface-cli can't find it.
SYSTEM INFO
- alma linux 9.6
- intel AMD
- python retrieved directly from the site.
any ideas on how i can solve this would be appreciated.
many thanks!
Posts: 4,904
Threads: 79
Joined: Jan 2018
Jan-20-2026, 05:12 PM
(This post was last modified: Jan-20-2026, 05:12 PM by Gribouillis.)
(Jan-20-2026, 05:03 PM)dave007 Wrote: any ideas on how i can solve this would be appreciated. You could perhaps create a virtualenv and install modules and run Python from there instead of using the system Python. I don't know Alma Linux, but in Ubuntu, I use pyenv and pyenv-virtualenv and it is very easy to manage.
« We can solve any problem by introducing an extra level of indirection »
Posts: 7,431
Threads: 125
Joined: Sep 2016
Jan-20-2026, 10:01 PM
(This post was last modified: Jan-20-2026, 10:01 PM by snippsat.)
Use uv then no need to install Python all is done automatic and much faster that standard pip.
transformers install demo
E:\div_code\hugface
(hugface) λ uv --version
uv 0.9.26 (ee4f00362 2026-01-15)
E:\div_code\hugface
λ uv venv --python 3.13.10
Using CPython 3.13.10
Creating virtual environment at: .venv
Activate with: .venv\Scripts\activate
E:\div_code\hugface
λ .venv\Scripts\activate
E:\div_code\hugface
(hugface) λ uv pip install "transformers[torch]"
Resolved 27 packages in 1.05s
Prepared 15 packages in 22.43s
Installed 27 packages in 3m 43s
+ accelerate==1.12.0
+ certifi==2026.1.4
+ charset-normalizer==3.4.4
+ colorama==0.4.6
+ filelock==3.20.3
+ fsspec==2026.1.0
+ huggingface-hub==0.36.0
+ idna==3.11
+ jinja2==3.1.6
+ markupsafe==3.0.3
+ mpmath==1.3.0
+ networkx==3.6.1
+ numpy==2.4.1
+ packaging==25.0
+ psutil==7.2.1
+ pyyaml==6.0.3
+ regex==2026.1.15
+ requests==2.32.5
+ safetensors==0.7.0
+ setuptools==80.9.0
+ sympy==1.14.0
+ tokenizers==0.22.2
+ torch==2.9.1
+ tqdm==4.67.1
+ transformers==4.57.6
+ typing-extensions==4.15.0
+ urllib3==2.6.3
E:\div_code\hugface
(hugface) λ python
Python 3.13.10 (main, Dec 2 2025, 19:42:11) [MSC v.1944 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from transformers import pipeline
>>>
>>> pipeline = pipeline(task="text-generation", model="Qwen/Qwen2.5-1.5B")
Device set to use cpu
>>> pipeline("Programming in python")
[{'generated_text': 'Programming in python is very easy and is one of the most popular languages for programming. Python is a high level, interpreted, object-oriented programmin]
Posts: 4
Threads: 1
Joined: Jan 2026
thanks very much to both of you for the replies.
this is only one small part of the architecture, it has to run on the machine. we need the same environment for all users on the machine, real and virtual, and don't want a situation where each and every user is creating a new VE each varying from the other in one respect or another.
@ snippsat i see you're using python 3.13, and yet your install process seems to show you've managed to reinstall huggingface-hub v.0.36.0 and got no errors saying you couldn't because it's part of the distro! could you confirm? or is it simply that the VE is different from a standard install and doesn't impose these constraints...
Posts: 7,431
Threads: 125
Joined: Sep 2016
Jan-21-2026, 10:49 AM
(This post was last modified: Jan-21-2026, 03:00 PM by snippsat.)
(Jan-21-2026, 07:59 AM)dave007 Wrote: @snippsat i see you're using python 3.13 With uv it dos not matter it download install Python 3.13.10 into environment automaticity i did nor have this version on OS
I i had done this it would have use Python 3.12.10,it dos not matter what install on OS.
E:\div_code\hugface
λ uv venv --python 3.12.10 E:\div_code\hugface
(hugface) λ uv pip install huggingface-hub
Audited 1 package in 538ms
E:\div_code\hugface
(hugface) λ python
Python 3.13.10 (main, Dec 2 2025, 19:42:11) [MSC v.1944 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from huggingface_hub import hf_hub_download
>>>
>>> hf_hub_download(repo_id="tiiuae/falcon-7b-instruct", filename="config.json")
'C:\\Users\\<name>\\.cache\\huggingface\\hub\\models--tiiuae--falcon-7b-instruct\\snapshots\\8782b5c5d8c9290412416618f36a133653e85285\\config.json'
Posts: 232
Threads: 0
Joined: Jun 2019
Hello,
there's context missing... How did you install Python on the Linux machine? Fully manual? Did you replace the system's Python? The latter is typically not a good idea, as it may lead to all type of problems with installation. If possible, please post _all_ commands incl. their output here you used to install Python 3.12 on your machine.
However, multiple versions of Python can be installed parallel conflict-free. Other version than the system's version need to be called explicitly with the version number, so let's say the system's version installed by your Linux distro is 3.10 and you manually installed 3.12 _without_ making this the system's default, Python 3.12 needs to be called with python3.12 ... and the related pip with pip3.12.
Which interactive open when you run the python3 command in the terminal?
Please also remember that multiple version of Python do _not_ share the Python modules, so you pip install it for each Python version.
Regards, noisefloor
Posts: 4
Threads: 1
Joined: Jan 2026
(Jan-21-2026, 05:51 PM)noisefloor Wrote: there's context missing... How did you install Python on the Linux machine? i downloaded the source from the official python repo.
i configured the source tree with:
./configure "--enable-shared" "--with-ssl-default-suites=openssl" "--without-ensurepip" "--enable-optimizations" "CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -march=sapphirerapids -D_GNU_SOURCE -fPIC -fwrapv " "LDFLAGS=-Wl,-z,relro -g " "CPPFLAGS= " "PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig"
i ran make to compile it, then make altinstall. i noticed everything was put into a new python tree rooted at /usr/local/lib/python3.12. the previous version was conserved.
i then ran python3 -m ensurepip --upgrade.
fwiw the self-run tests during the make apparently came out clean (but i'm guessing huggingface wasn't tested). not sure why some tests were skipped.
Total duration: 1 min 15 sec
Total tests: run=9,112 skipped=185
Total test files: run=43/43
Result: SUCCESS
when i try to run python programs, i've made sure the following are set in my environment:
PYTHONPATH=/usr/local/lib/python3.12:/usr/local/lib/python3.12/site-packages
PYTHONUSERBASE=/usr/local/lib/python3.12
maybe there was something else i could/should have taken care of?
Posts: 232
Threads: 0
Joined: Jun 2019
Hi,
thanks for the additional details. The important part you did fully right: make altinstall is crucial to ensure you install this Python version parallel to the system's one.
However, pip3 uses the system's Python pip. To use Python 3.12 pip, you need to use pip3.12. Try in the terminal whether the command is available or not. Normally it should be. With pip3.12 install MODUL_NAME you should be able to install modul's for Python 3.12, conflict-free with modules for the system's Python.
Regards, noisefloor
Posts: 4
Threads: 1
Joined: Jan 2026
Jan-29-2026, 02:19 PM
(This post was last modified: Jan-29-2026, 02:19 PM by dave007.)
thanks very much for the suggestions up to now.
in fact, pip3 appears to have been a hard link to pip3.12 :
$ diff -sw /usr/local/bin/pip3{,.12}
Files /usr/local/bin/pip3 and /usr/local/bin/pip3.12 are identical
so i went back and did a completely new altinstall starting over from scratch, but with 3.13.10 this time, as @ snippsat did.
after the altinstall i did another python3 -m ensurepip --upgrade, reset my environment, etc.
i ended up with :
$ set | grep ^PY
PYTHONPATH=/usr/local/lib/python3.13:/usr/local/lib/python3.13/site-packages
PYTHONUSERBASE=/usr/local/lib/python3.13
$ python3 -V
Python 3.13.10
$ pip3 -V
pip 25.3 from /usr/local/lib/python3.13/site-packages/pip (python 3.13)
the hugging face hub is apparently not part of the 3.13 distro (it wasn't in the 3.13 tree after installation), so i installed it with pip3. unfortunately the problem still persists. even worse, it doesn't appear to be confined to just huggingface. i'm also having problems with gdb! this happens for both 3.12 and 3.13.
$ gdb
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Python runtime state: core initialized
Traceback (most recent call last):
File "/usr/local/lib/python3.13/io.py", line 55, in <module>
ImportError: cannot import name 'text_encoding' from 'io' (unknown location)
when i change my PYPATH back to use python 3.9, i can invoke gdb without errors, as usual.
it seems to me like there is something in the python framework that is misidentifying some aspects of the system (file locations or paths, maybe?), but my ignorance prevents me from knowing what.
what else can i check ?
and thanks once again for the help.
Posts: 4,904
Threads: 79
Joined: Jan 2018
I'm sure the solution is to use 'uv' as snippsat does or 'pyenv' as I do. These programs install and let you run any version of Python. Don't struggle with a manual install of Python.
« We can solve any problem by introducing an extra level of indirection »
|