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
  import module with syntax error Skaperen 7 379 Jun-22-2021, 10:38 AM
Last Post: Skaperen
  Import Error Christian 3 681 Apr-17-2021, 11:27 PM
Last Post: bowlofred
  'urllib3' Module not found when import 'requests' spanz 5 1,594 Jan-06-2021, 05:57 PM
Last Post: snippsat
  Folium import error kashif_flavio 2 701 Dec-07-2020, 08:58 AM
Last Post: bowlofred
  Import error Beingcode 0 785 Nov-20-2020, 02:57 AM
Last Post: Beingcode
Smile Import error with local file colt 1 549 Nov-08-2020, 07:56 AM
Last Post: Gribouillis
  switch from version 3.5.3 to 3.8.6 get import error python001 9 967 Oct-31-2020, 03:02 PM
Last Post: python001
  Problem with Flask Bcrypt import module marcello86 2 1,069 Aug-31-2020, 08:10 PM
Last Post: marcello86
  import yaml error for python3 maiya 4 3,714 Jul-15-2020, 06:07 PM
Last Post: Gribouillis
  Unable to import my own module ThePhantom 3 889 May-01-2020, 01:30 AM
Last Post: menator01

Forum Jump:

User Panel Messages

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