Python Forum
Error while humansize module import.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error while humansize module import.
Error message while trying to import humansize. Please help
from humansize import approximate_size
The error message is:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from humansize import approximate_size
ModuleNotFoundError: No module named 'humansize'

(I am having humansize ver. 1.0 in pip list.)
Please help me.
I tried it too but for some reason I cannot find any code intalled after the installation, but indeed humansize is in pip list... i can only find the zipfile with some metadata and stuff. On PyPi there is no documentation at all. But I searched on GitHub and got some alternatives you may want to look into.
- Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid. Albert Einstein
The file is not in PyPi repo only
The file is still on the web.
Just save save as and use it as module.
>>> from humansize import approximate_size
>>> approximate_size(1024)
'1.0 KiB'
>>> approximate_size(4096)
'4.0 KiB'
>>> approximate_size(100000)
'97.7 KiB'
>>> approximate_size(10000000000000)
'95.4 MiB'
>>> approximate_size(10000000000000)
'9.1 TiB'
Thank you, it worked. Even though I had to add a new path to make it global.
import sys
sys.path.append(r'C:\Users\JOHNSON K G\AppData\Local\Programs\Python\Python38\Lib\site-packages\humansize-1.0-py3.8.egg-info')

Possibly Related Threads…
Thread Author Replies Views Last Post
  Can't install nor import delorean module Tek 3 190 11 hours ago
Last Post: Tek
  import module with syntax error Skaperen 7 767 Jun-22-2021, 10:38 AM
Last Post: Skaperen
  Import Error Christian 3 1,009 Apr-17-2021, 11:27 PM
Last Post: bowlofred
  'urllib3' Module not found when import 'requests' spanz 5 2,955 Jan-06-2021, 05:57 PM
Last Post: snippsat
  Folium import error kashif_flavio 2 970 Dec-07-2020, 08:58 AM
Last Post: bowlofred
  Import error Beingcode 0 1,020 Nov-20-2020, 02:57 AM
Last Post: Beingcode
Smile Import error with local file colt 1 670 Nov-08-2020, 07:56 AM
Last Post: Gribouillis
  switch from version 3.5.3 to 3.8.6 get import error python001 9 1,318 Oct-31-2020, 03:02 PM
Last Post: python001
  Problem with Flask Bcrypt import module marcello86 2 1,458 Aug-31-2020, 08:10 PM
Last Post: marcello86
  import yaml error for python3 maiya 4 6,498 Jul-15-2020, 06:07 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020