No module named 'msilib'

After I deployed my Django project in Heroku for the first time and clicked view, I got this error. when I looked up this module it says it is depreciated. I tried pycopy-msilib but it is asking for setup.py which I can’t find how it’s made

Any advice or directions would be appreciated. Thank You

The error:

Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/app/.heroku/python/lib/python3.10/site-packages/django/core/handlers/base.py", line 167, in _get_response
    callback, callback_args, callback_kwargs = self.resolve_request(request)
  File "/app/.heroku/python/lib/python3.10/site-packages/django/core/handlers/base.py", line 290, in resolve_request
    resolver_match = resolver.resolve(request.path_info)
  File "/app/.heroku/python/lib/python3.10/site-packages/django/urls/resolvers.py", line 556, in resolve
    for pattern in self.url_patterns:
  File "/app/.heroku/python/lib/python3.10/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/app/.heroku/python/lib/python3.10/site-packages/django/urls/resolvers.py", line 598, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/app/.heroku/python/lib/python3.10/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/app/.heroku/python/lib/python3.10/site-packages/django/urls/resolvers.py", line 591, in urlconf_module
    return import_module(self.urlconf_name)
  File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
    <source code not available>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
    <source code not available>
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
    <source code not available>
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
    <source code not available>
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
    <source code not available>
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    <source code not available>
  File "/app/mysite/urls.py", line 22, in <module>
    path('', include('core.urls')),
  File "/app/.heroku/python/lib/python3.10/site-packages/django/urls/conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
    <source code not available>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
    <source code not available>
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
    <source code not available>
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
    <source code not available>
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
    <source code not available>
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    <source code not available>
  File "/app/core/urls.py", line 10, in <module>
    from .views.managment_view import ManagmentPageView, UpdateCallItem, UpdateCallist,UpdateCashbal
  File "/app/core/views/managment_view.py", line 15, in <module>
    from core.serialize import CallListSerializer
  File "/app/core/serialize.py", line 3, in <module>
    from msilib.schema import Class

Exception Type: ModuleNotFoundError at /
Exception Value: No module named 'msilib'
My requirment.txt: 
APScheduler==3.8.1
arabic-reshaper==2.1.3
asgiref==3.4.1
asn1crypto==1.5.1
Brotli==1.0.9
certifi==2022.5.18.1
cffi==1.15.0
charset-normalizer==2.0.12
click==8.1.3
colorama==0.4.4
cryptography==37.0.2
cssselect2==0.6.0
defusedxml==0.7.1
diff-match-patch==20200713
dj-database-url==1.0.0
Django==3.2.9
django-appconf==1.0.5
django-compressor==4.0
django-easy-pdf3==0.1.4
django-heroku==0.3.1
django-import-export==2.6.1
django-wkhtmltopdf==3.4.0
djangorestframework==3.12.4
djangorestframework-datatables==0.7.0
et-xmlfile==1.1.0
fonttools==4.33.3
future==0.18.2
html5lib==1.1
idna==3.3
lxml==4.9.0
MarkupPy==1.14
numpy==1.22.3
odfpy==1.4.1
openpyxl==3.0.9
oscrypto==1.3.0
pandas==1.4.2
Pillow==9.1.1
psycopg2==2.9.3
pycparser==2.21
pydyf==0.2.0
pyHanko==0.13.1
pyhanko-certvalidator==0.19.5
PyPDF3==1.0.6
pyphen==0.12.0
python-bidi==0.4.2
python-dateutil==2.8.2
pytz==2021.3
pytz-deprecation-shim==0.1.0.post0
PyYAML==6.0
qrcode==7.3.1
rcssmin==1.1.0
reportlab==3.6.10
requests==2.28.0
rjsmin==1.2.0
six==1.16.0
sqlparse==0.4.2
svglib==1.3.0
tablib==3.1.0
tinycss2==1.1.1
tqdm==4.64.0
tzdata==2021.5
tzlocal==4.1
uritools==4.0.0
urllib3==1.26.9
weasyprint==55.0
webencodings==0.5.1
whitenoise==6.2.0
xhtml2pdf==0.2.7
xlrd==2.0.1
xlwt==1.3.0
zopfli==0.2.1

What are you doing that is even trying to use that library? I’d think you’d be better off avoiding that issue completely.

I am not doing anything with that module. I just Uploaded my project in to github and followed the steps on this site https://studygyaan.com/django/deploy-django-project-on-heroku.

I have uploaded the error shown and the requirements.txt file

What are the contents of that file?

1 Like

I opened the file and saw that it imported msilib.schema for class. The cause of this problem was my negligence. In VSCode when you type function name which you must import, and you click ctrl+. to get the options for the import. I did this for several functions without checking the options since it worked previously

That was the cause of this problem.

I am sorry for taking your time and Thank You for your Response

Hi do you figure out the problem? Can you tell me what happened? I have the same error with you now.

Did you read the complete thread? The answer is posted directly above your post.

If you are stil having this issue, I suggest you open a new topic. This one has been marked as solved, and most people aren’t going to read any follow-up posts.

Yes I have read the thread. But I dont fully understand his words. Why the VScode will cause the problem of showing “No module found named ‘msilib’”?

It’s because of the autocomplete function in VSCode.

The original poster caused the problem by accepting an import statement being generated by VSCode without verifying that it was correct.

This inserted the line:
from msilib.schema import Class
into their code that shouldn’t have been there.

1 Like