Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception Value:failed to find libmagic. Check your installation in windows 7

When I am trying to open django admin panel this error is showing:

ImportError at /admin/
failed to find libmagic.  Check your installation
Request Method: GET
Request URL:    Django Version: 1.5.1
Exception Type: ImportError
Exception Value:    failed to find libmagic.  Check your installation
Exception Location: C:\Python27\lib\site-packages\magic.py in <module>, line 131
Python Executable:  C:\Python27\python.exe
Python Version: 2.7.2
Python Path:
['C:\\Users\\farhan\\Downloads\\dist\\Django-1.5.1\\django\\bin\\mysite',
 'C:\\Python27\\lib\\site-packages\\distribute-0.6.49-py2.7.egg',
 'C:\\Windows\\system32\\python27.zip',
 'C:\\Python27\\DLLs',
 'C:\\Python27\\lib',
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk',
 'C:\\Python27',
 'C:\\Python27\\lib\\site-packages',
 'C:\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg-info']
Server time:    Thu, 22 Aug 2013 13:19:01 +0600

Here is my traceback

like image 852
Akhter Al Amin Avatar asked Aug 22 '13 07:08

Akhter Al Amin


3 Answers

Go here and then:

For Windoes 32bit, download the file "python_magic_bin-0.4.14-py2.py3-none-win32.whl" and run

pip install python_magic_bin-0.4.14-py2.py3-none-win32.whl

For Windows 64bit, download "python_magic_bin-0.4.14-py2.py3-none-win_amd64.whl" and run

pip install python_magic_bin-0.4.14-py2.py3-none-win_amd64.whl

now python-magic works

enter image description here

EDIT: As suggested in the comments, this also works:

pip install python-magic-bin==0.4.14
like image 161
Francesco Mantovani Avatar answered Nov 20 '22 04:11

Francesco Mantovani


Your multiuploader form uses python-magic library possibly for filetype identification. However you probably do not have all the missing dependencies installed. Please install the missing dependencies.

https://github.com/ahupp/python-magic#dependencies

like image 14
dusual Avatar answered Nov 20 '22 05:11

dusual


As per the documentation (https://pypi.org/project/python-magic/) you have to install libmagic.

For Windows OS, you can do it by run the bellow command:

pip install python-magic-bin

And for Ubuntu based OS, you have to it by the bellow command:

sudo apt-get install libmagic1

From, your exception it is easy to say that, you are using Windows OS, so you have install it by the first command.

like image 8
Samiddha Avatar answered Nov 20 '22 05:11

Samiddha